Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add charm documentation #42

Merged
merged 11 commits into from
Mar 6, 2024
16 changes: 16 additions & 0 deletions charm/docs/how-to/manage-domains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# How to manage domains

To manage the list of domains a user is allowed to request changes to, the following actions are available

## Allowing domains
To add domains to the list of allowed domains, run `juju run --wait=5s httprequest-lego-provider/0 allow-domains username=example domains="example.domain.com,example2.domain.com"`.

## Revoking domains
To remove domains from the list of allowed domains, run `juju run --wait=5s httprequest-lego-provider/0 revoke-domains username=example domains="example.domain.com,example2.domain.com"`.

## Listing domains
To query the list of allowed domains for a user, run `juju run --wait=5s httprequest-lego-provider/0 list-domains username=example` and the list of domains will be returned as in
```bash
result: |
_acme-challenge.example.domain.com, _acme-challenge.example2.domain.com
```
10 changes: 10 additions & 0 deletions charm/docs/how-to/manage-users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# How to manage users

Users will be leveraged to determine if a request is authorised to manage a specific domain. To add a new user simply run
`juju run --wait=5s httprequest-lego-provider/0 create-user username=example-user`. The action will generate and output a password:
```bash
result: |
Created or updated "example" with password "**REDACTED**"
```

arturo-seijas marked this conversation as resolved.
Show resolved Hide resolved
If the action is rerun, a new password will be generated.
Empty file added charm/docs/index.md
Empty file.
3 changes: 3 additions & 0 deletions charm/docs/reference/actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Actions

See [Actions](https://charmhub.io/httprequest-lego-provider/actions).
3 changes: 3 additions & 0 deletions charm/docs/reference/configurations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Integrations

See [Integrations](https://charmhub.io/httprequest-lego-provider/integrations).
3 changes: 3 additions & 0 deletions charm/docs/reference/integrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Configurations

See [Configurations](https://charmhub.io/httprequest-lego-provider/configure).
79 changes: 79 additions & 0 deletions charm/docs/tutorials/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Quick guide

## What you’ll do

- Deploy the [Httprequest Lego Provider charm](https://charmhub.io/httprequest-lego-provider).
- Integrate with [the PostgreSQL K8s charm](https://charmhub.io/postgresql-k8s).
- Integrate with [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress) by using [NGINX Ingress Integrator](https://charmhub.io/nginx-ingress-integrator/).

## Prerequisites

- Juju 3 installed.
- Juju controller and model created.

For more information about how to install Juju, see [Get started with Juju](https://juju.is/docs/olm/get-started-with-juju).

## Deploy the Httprequest Lego Provider charm

The HTTPRequest Lego provider requires integration with [the PostgreSQL K8s charm](https://charmhub.io/postgresql-k8s) and [NGINX Ingress Integrator](https://charmhub.io/nginx-ingress-integrator/) for external access:

Deploy the charms:

```bash
juju deploy nginx-ingress-integrator --channel=v2/edge
juju trust nginx-ingress-integrator --scope=cluster
juju deploy postgresql-k8s --channel 14/stable
juju trust postgresql-k8s --scope=cluster
juju deploy httprequest-lego-provider --channel=latest/edge
```

To see the pod created by the charm, run `kubectl get pods` on the namespace for the Juju model you've deployed the charm to. The output is similar to the following:

```bash
NAME READY STATUS RESTARTS AGE
httprequest-lego-provider-0 2/2 Running 0 9m36s
```

Run [`juju status`](https://juju.is/docs/olm/juju-status) to see the current status of the deployment. In the Unit list, you can see that the charm is waiting:

```bash
httprequest-lego-provider/0* waiting idle 10.1.180.77 Config git_repo is required
```

This means the required configurations have not been set yet.

## Configure the Httprequest Lego Provider charm
Provide the configurations `git_repo` and `git_ssh_key` required by the charm:

```bash
juju config httprequest-lego-provider git_repo=git+ssh://username@host/repo@branch
juju config httprequest-lego-provider git_ssh_key=**REDACTED**
```
You can see the message has changed:

```bash
httprequest-lego-provider/0* waiting idle 10.1.180.77 Waiting for database integrations
```

## Integrate the Httprequest Lego Provider charm
For the charm to reach active status, integrate the charm with the PostgreSQL K8s charm and the NGINX Ingress Integrator charm:

```bash
juju integrate httprequest-lego-provider postgresql-k8s
juju integrate httprequest-lego-provider nginx-ingress-integrator
```

Run `juju status` and wait until the Application status is `Active`:

```bash
App Version Status Scale Charm Channel Rev Address Exposed Message
httprequest-lego-provider active 1 httprequest-lego-provider latest/edge 17 10.152.183.194 no
```

In order to access the HTTP endpoints, you'll need configure a hostname and add it to Django's allow list and configure the path routes that will be accessible:
```bash
juju config nginx-ingress-integrator service-hostname=lego.local
juju config httprequest-lego-provider django_allowed_hosts=localhost,127.0.0.1,lego.local
juju config nginx-ingress-integrator path-routes="/admin,/present,/cleanup"
```

Loading