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

chore(docs): Set up Charmhub docs and update tutorial. #74

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion charm/charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ description: |
into multiple environments for testing of changes, and supports scaling out for
enterprise deployments.

links:
website:
- https://charmhub.io/httprequest-lego-provider
source:
- https://github.com/canonical/httprequest-lego-provider
issues:
- https://github.com/canonical/httprequest-lego-provider/issues
documentation: https://discourse.charmhub.io/t/httprequest-lego-provider-documentation-overview/15783

extensions:
- django-framework

Expand All @@ -45,7 +54,7 @@ config:
git-repo:
type: string
description: >
The repository URL where the DNS records are stored. The username has to be provided as in
The repository URL where the DNS records are stored. The username has to be provided as in
git+ssh://username@repository@branch, where the branch is optional.
git-ssh-key:
type: string
Expand Down
4 changes: 2 additions & 2 deletions charm/docs/reference/configurations.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Integrations
# Configurations

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

See [Configurations](https://charmhub.io/httprequest-lego-provider/configure).
See [Integrations](https://charmhub.io/httprequest-lego-provider/integrations).
59 changes: 47 additions & 12 deletions charm/docs/tutorial/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@
- 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/).

## Requirements

- Juju 3 installed.
- Juju controller and model created.
- A working station, e.g., a laptop, with amd64 architecture.
- Juju 3 installed and bootstrapped to a MicroK8s controller. You can accomplish this process by following this guide: [Set up / Tear down your test environment](https://juju.is/docs/juju/set-up--tear-down-your-test-environment)
- NGINX Ingress Controller. If you're using [MicroK8s](https://microk8s.io/), this can be done by running the command `microk8s enable ingress`. For more details, see [Addon: Ingress](https://microk8s.io/docs/addon-ingress).

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

:warning: When using a Multipass VM, make sure to replace `127.0.0.1` IP addresses with the
alithethird marked this conversation as resolved.
Show resolved Hide resolved
VM IP in steps that assume you're running locally. To get the IP address of the
Multipass instance run ```multipass info my-juju-vm```.
### Shell into the Multipass VM
> NOTE: If you're working locally, you don't need to do this step.

To be able to work inside the Multipass VM first you need to log in with the following command:
```
multipass shell my-juju-vm
```

## Steps
### Set up the tutorial model
To easily clean up the resources and to separate your workload from the contents of this tutorial, set up a new model with the following command.
Expand All @@ -27,7 +38,7 @@ The HTTPRequest Lego provider requires integration with [the PostgreSQL K8s char

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
Expand All @@ -37,57 +48,81 @@ juju deploy httprequest-lego-provider --channel=latest/edge

To see the pod created by the charm, run `kubectl get pods -n httprequest-lego-provider-tutorial`. 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:
> NOTE: For tutorial you can fork this [repo](https://github.com/canonical/httprequest-lego-provider/tree/main) and use you own fork and ssh key.
> If you fork the repo the `git-repo` will be in the form `git+ssh://git@github.com/<username>/httprequest-lego-provider.git@main`.
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"
```

### Create a user and log in

To create a user, use the `create-user` action:
```
juju run httprequest-lego-provider/0 create-user username=my_user
```

The command will return the password of the created user.
If you are following the tutorial in your local machine, modify your `/etc/hosts` file so that it points to `127.0.0.1`:

```
echo 127.0.0.1 lego.local >> /etc/hosts
```

After that, visit `http://lego.local/present` to reach Httprequest Lego Provider, using the credentials returned from the `create-user` action to login.

### Clean up the environment
Congratulations! You have successfully finished the httprequest-lego-provider tutorial. You can now remove the model environment that you've created using the following command.

```
juju destroy-model --destroy-storage httprequest-lego-provider-tutorial
```

If you used Multipass, to remove the Multipass instance you created for this tutorial, use the following command.
```
multipass delete --purge my-juju-vm
```
Finally, remove the `127.0.0.1 lego.local` line from the `/etc/hosts` file.
Loading