Skip to content

Commit a886fb2

Browse files
authored
Add tox lint-docs target to check broken links (#344)
* Add tox lint-docs target to check broken links * Change link checker to more rebust tool * add checksum for lycee link checker
1 parent d42724f commit a886fb2

File tree

6 files changed

+37
-14
lines changed

6 files changed

+37
-14
lines changed

docs/explanation/charm-architecture.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ UpdateRelStyle(discourse_charm, postgresql_charm, $textColor="blue", $offsetX="2
7070

7171
## Containers
7272

73-
Configuration files for the containers can be found in [the image directory of the charm repository](https://github.com/canonical/discourse-k8s-operator/tree/main/image).
73+
Configuration files for the workload can be found [here](https://github.com/canonical/discourse-k8s-operator/blob/main/config.yaml).
7474

7575
### Discourse
7676

@@ -94,7 +94,7 @@ This section provides information about the integrations.
9494

9595
The Discourse charm also supports being integrated with [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress) by using [NGINX Ingress Integrator](https://charmhub.io/nginx-ingress-integrator/).
9696

97-
In this case, an existing Ingress controller is required. For more information, see [Adding the Ingress Relation to a Charm](https://charmhub.io/nginx-ingress-integrator/docs/adding-ingress-relation).
97+
In this case, an existing Ingress controller is required. For more information, see [Adding the Ingress Relation to a Charm](https://charmhub.io/nginx-ingress-integrator/docs/add-the-ingress-relation).
9898

9999
### PostgreSQL
100100

@@ -119,8 +119,8 @@ Accordingly to the [Juju SDK](https://juju.is/docs/sdk/event): "an event is a da
119119

120120
For this charm, the following events are observed:
121121

122-
1. [<container name>_pebble_ready](https://juju.is/docs/sdk/container-name-pebble-ready-event): fired on Kubernetes charms when the requested container is ready. Action: wait for the integrations, and configure the containers.
123-
2. [config_changed](https://juju.is/docs/sdk/config-changed-event): usually fired in response to a configuration change using the GUI or CLI. Action: wait for the integrations, validate the configuration, update Ingress, and restart the containers.
122+
1. [<container name>_pebble_ready](https://documentation.ubuntu.com/juju/3.6/reference/hook/#container-pebble-ready): fired on Kubernetes charms when the requested container is ready. Action: wait for the integrations, and configure the containers.
123+
2. [config_changed](https://documentation.ubuntu.com/juju/3.6/reference/hook/#config-changed): usually fired in response to a configuration change using the GUI or CLI. Action: wait for the integrations, validate the configuration, update Ingress, and restart the containers.
124124
3. [add_admin_user_action](https://charmhub.io/discourse-k8s/actions): fired when add-admin-user action is executed. Action: add an admin user with the provided email and password.
125125
<!-- vale Canonical.400-Enforce-inclusive-terms = NO -->
126126
<!-- master refers to the main database -->
@@ -135,6 +135,6 @@ The `src/charm.py` is the default entry point for a charm and has the DiscourseC
135135

136136
CharmBase is the base class from which all Charms are formed, defined by [Ops](https://juju.is/docs/sdk/ops) (Python framework for developing charms).
137137

138-
See more information in [Charm](https://juju.is/docs/sdk/constructs#heading--charm).
138+
See more information in [Charm](https://documentation.ubuntu.com/juju/3.6/howto/manage-charms/#build-a-charm).
139139

140140
The `__init__` method guarantees that the charm observes all events relevant to its operation and handles them.

docs/how-to/backup-and-restore.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ If the same S3 bucket can be used in the restored Discourse instance, then it is
3636
to backup the database.
3737

3838
This can be easily done with [Charmed PostgreSQL](https://charmhub.io/postgresql) and [Charmed PostgreSQL K8s](https://charmhub.io/postgresql-k8s).
39-
See [How to create and list backups in Charmed PostgreSQL](https://charmhub.io/postgresql/docs/h-create-and-list-backups)
40-
or [How to create and list backups in Charmed PostgreSQL K8s](https://charmhub.io/postgresql-k8s/docs/h-create-and-list-backups) for the full procedure.
39+
See [How to create and list backups in Charmed PostgreSQL](https://canonical-charmed-postgresql.readthedocs-hosted.com/latest/how-to/back-up-and-restore/create-a-backup/)
40+
or [How to create and list backups in Charmed PostgreSQL K8s](https://canonical-charmed-postgresql-k8s.readthedocs-hosted.com/latest/how-to/back-up-and-restore/create-a-backup/) for the full procedure.
4141

4242
To restore Discourse, once it is deployed and configured as the Discourse instance to restore, it is only necessary
4343
to restore the database. The instructions, depending on the configuration, can be found in the next links:
4444
- Charmed PostgreSQL. Local backup: https://charmhub.io/postgresql/docs/h-restore-backup
45-
- Charmed PostgreSQL. Migrate a cluster: https://charmhub.io/postgresql/docs/h-migrate-cluster-via-restore
45+
- Charmed PostgreSQL. Migrate a cluster: https://canonical-charmed-postgresql.readthedocs-hosted.com/latest/how-to/back-up-and-restore/migrate-a-cluster/
4646
- Charmed PostgreSQL K8s. Local backup: https://charmhub.io/postgresql-k8s/docs/h-restore-backup
47-
- Charmed PostgreSQL K8s. Migrate a cluster: https://charmhub.io/postgresql-k8s/docs/h-migrate-cluster-via-restore
47+
- Charmed PostgreSQL K8s. Migrate a cluster: https://canonical-charmed-postgresql-k8s.readthedocs-hosted.com/latest/how-to/back-up-and-restore/migrate-a-cluster/
4848

4949
## S3 and the backup and restore procedure
5050

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- "Operator" is part of the name -->
33
# Discourse Operator
44
<!-- vale Canonical.007-Headings-sentence-case = YES -->
5-
A [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators) deploying and managing Discourse on Kubernetes.
5+
A [Juju](https://juju.is/) [charm](https://documentation.ubuntu.com/juju/3.6/reference/charm/) deploying and managing Discourse on Kubernetes.
66

77
Discourse is an open-source software application used to create customer-friendly and community-friendly discussion platforms,
88
forums, and mailing lists. It's designed to work as a discussion platform for various topics and is widely used by numerous

docs/reference/integrations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ juju integrate discourse-k8s nginx-ingress-integrator
5959
### metrics-endpoint
6060
<!-- vale Canonical.000-US-spellcheck = NO -->
6161
<!-- prometheus_scrape is the name of the interface>
62-
_Interface_: [prometheus_scrape](https://charmhub.io/interfaces/prometheus_scrape-v0)
62+
_Interface_: [prometheus_scrape](https://charmhub.io/interfaces/prometheus_scrape)
6363
<!-- vale Canonical.000-US-spellcheck = YES -->
6464

6565
_Supported charms_: [prometheus-k8s](https://charmhub.io/prometheus-k8s)

docs/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ In this tutorial, we'll go through each step of the process to get a basic Disco
1010

1111
## Requirements
1212
- A working station, e.g., a laptop, with amd64 architecture.
13-
- Juju 3 installed and bootstrapped to a MicroK8s controller. You can accomplish this process by using a Multipass VM as outlined in this guide: [Set up / Tear down your test environment]([https://juju.is/docs/juju/set-up--tear-down-your-test-environment](https://documentation.ubuntu.com/juju/3.6/howto/manage-your-deployment/#set-up-your-deployment-local-testing-and-development))
13+
- Juju 3 installed and bootstrapped to a MicroK8s controller. You can accomplish this process by using a Multipass VM as outlined in this guide: [Set up / Tear down your test environment](https://documentation.ubuntu.com/juju/3.6/howto/manage-your-deployment/#set-up-your-deployment-local-testing-and-development)
1414
- 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 [Add-on: Ingress](https://microk8s.io/docs/addon-ingress).
1515

16-
For more information about how to install Juju, see [Get started with Juju]([https://juju.is/docs/olm/get-started-with-juju](https://documentation.ubuntu.com/juju/3.6/tutorial/)).
16+
For more information about how to install Juju, see [Get started with Juju](https://documentation.ubuntu.com/juju/3.6/tutorial/).
1717

1818
:warning: When using a Multipass VM, make sure to replace `127.0.0.1` IP addresses with the
1919
VM IP in steps that assume you're running locally. To get the IP address of the
@@ -38,7 +38,7 @@ juju add-model discourse-tutorial
3838

3939
### Deploy the charms
4040

41-
Discourse requires connections to PostgreSQL and Redis. For more information, see the [Charm Architecture](https://charmhub.io/discourse-k8s/docs/charm-architecture).
41+
Discourse requires connections to PostgreSQL and Redis. For more information, see the [Charm Integrations](https://charmhub.io/discourse-k8s/docs/reference-integrations).
4242

4343
> NOTE: Discourse requires PostgreSQL extensions to be available in the relation.
4444

tox.ini

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ envlist = lint, unit, static, coverage-report
99
[vars]
1010
src_path = {toxinidir}/src/
1111
tst_path = {toxinidir}/tests/
12+
docs_path = {toxinidir}/docs
1213
;lib_path = {toxinidir}/lib/charms/operator_name_with_underscores
1314
all_path = {[vars]src_path} {[vars]tst_path}
1415

@@ -122,6 +123,28 @@ deps =
122123
commands =
123124
pytest -v --tb native --ignore={[vars]tst_path}unit --ignore={[vars]tst_path}unit_harness --log-cli-level=INFO -s {posargs}
124125

126+
[testenv:lint-docs]
127+
skip_install = true
128+
allowlist_externals =
129+
curl
130+
tar
131+
chmod
132+
echo
133+
sh
134+
{envtmpdir}/lychee
135+
setenv =
136+
LYCHEE_VERSION = 0.19.1
137+
EXPECTED_SHA256 = 537bcfbb0f3bf997f4cbdab259cc5500f2804b69614140ac3edebb4de94b3574
138+
DOWNLOAD_URL = https://github.com/lycheeverse/lychee/releases/download/lychee-v{env:LYCHEE_VERSION}/lychee-x86_64-unknown-linux-gnu.tar.gz
139+
commands_pre =
140+
echo "Download URL: {env:DOWNLOAD_URL}"
141+
curl -L {env:DOWNLOAD_URL} -o {envtmpdir}/lychee.tar.gz
142+
sh -c "echo '{env:EXPECTED_SHA256} {envtmpdir}/lychee.tar.gz' | sha256sum -c -"
143+
tar -xzf {envtmpdir}/lychee.tar.gz -C {envtmpdir}
144+
chmod +x {envtmpdir}/lychee
145+
commands =
146+
{envtmpdir}/lychee --max-concurrency 2 README.md {[vars]docs_path}
147+
125148
[testenv:src-docs]
126149
allowlist_externals=sh
127150
setenv =

0 commit comments

Comments
 (0)