Skip to content

Commit 47466e0

Browse files
authored
Fix automatic doc checks (16) (#1034)
* feat: add rediraffe sphinx extension and discourse redirects for each page * fix broken urls and update custom wordlist * fix spelling errors * polish explanation landing page and toctree
1 parent 9679313 commit 47466e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+310
-213
lines changed

docs/.custom_wordlist.txt

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,154 @@
1+
12
# Leave a blank line at the end of this file to support concatenation
3+
airgap
4+
airgapped
5+
analyze
6+
artifact
7+
Artifactory
8+
artifacts
9+
async
10+
aws
11+
AWS
12+
AZ
13+
AZs
214
backend
315
backends
16+
backport
17+
balancer
18+
balancers
19+
benchmark
20+
benchmarking
21+
CharmBase
422
Charmcraft
23+
charmhub
24+
checksum
25+
checksums
26+
CIS
527
cjk
28+
codebase
29+
config
30+
configs
631
cryptographically
32+
CSR
33+
CSRs
34+
databag
35+
databags
36+
dev
737
dvipng
38+
eks
39+
EKS
40+
entrypoint
41+
failover
42+
filesystem
43+
filesystems
844
fonts
945
freefont
46+
gapped
47+
gce
48+
GCE
49+
gcloud
50+
GCloud
51+
GCP
1052
github
53+
GLAuth
1154
GPG
1255
gyre
56+
HLD
57+
hostname
58+
hostnames
1359
https
60+
IAAS
61+
integration
62+
integrations
1463
Intersphinx
64+
io
65+
IPs
66+
IPv
67+
Jira
68+
jitter
69+
Juju
70+
Juju's
1571
lang
1672
LaTeX
1773
latexmk
74+
LDAP
75+
libs
76+
lifecycle
77+
LXD
78+
LXD's
79+
MicroK8s
80+
MinIO
1881
Multipass
82+
nameserver
83+
nameservers
84+
Nextcloud
1985
otf
86+
Parca
87+
Parca's
88+
Patroni
89+
patronictl
90+
pgbackrest
91+
pgBackRest
92+
pgbouncer
93+
pgsql
94+
PITR
2095
plantuml
2196
PNG
97+
pooler
98+
postgres
99+
postgresql
100+
PPA
101+
PPAs
102+
pqsql
103+
programmatically
104+
PSC
105+
PVCs
106+
py
22107
Pygments
23108
QEMU
109+
RadosGW
110+
requirer
111+
rockcraft
24112
Rockcraft
113+
routable
25114
rst
115+
scalable
116+
sdk
117+
SHA
118+
snap
119+
snapcraft
120+
SoS
121+
squashfs
122+
SquashFS
123+
src
124+
SSL
125+
stateful
126+
subnet
26127
SVG
128+
Sysbench
129+
terraform
27130
tex
28131
texlive
132+
TimescaleDB
29133
TOC
30134
toctree
135+
Traefik
31136
txt
137+
ubuntu
32138
uncommenting
139+
uncordon
33140
utils
141+
vm
34142
VMs
143+
WAL
144+
walkthrough
35145
WCAG
146+
wget
36147
whitespace
37148
whitespaces
149+
WIP
38150
wordlist
39151
xetex
152+
XID
40153
xindy
154+
yaml

docs/.sphinx/spellingcheck.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ matrix:
99
- .custom_wordlist.txt
1010
output: .sphinx/.wordlist.dic
1111
sources:
12-
- _build/**/*.html
12+
- _build/**/*.html|!_build/reference/alert-rules/index.html
1313
pipeline:
1414
- pyspelling.filters.html:
1515
comments: false

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@
208208
linkcheck_ignore = [
209209
"http://127.0.0.1:8000",
210210
"https://github.com/canonical/ACME/*",
211-
"https://matrix.to/*"
211+
"https://matrix.to/*",
212+
"https://portal.azure.com/#browse/Microsoft.Compute/VirtualMachines"
212213
]
213214

214215
# A regex list of URLs where anchors are ignored by 'make linkcheck'

docs/explanation/architecture.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
![image|690x423, 100%](architecture-diagram.png)
66

7-
<a name="hld"></a>
87
## HLD (High Level Design)
98

109
The charm design leverages on the SNAP “[charmed-postgresql](https://snapcraft.io/charmed-postgresql)” which is deployed by Juju on the specified VM/MAAS/bare-metal machine based on Ubuntu Jammy/22.04. SNAP allows to run PostgreSQL service(s) in a secure and isolated environment ([strict confinement](https://ubuntu.com/blog/demystifying-snap-confinement)). The installed SNAP:
@@ -56,7 +55,6 @@ The snap "charmed-postgresql" also ships list of tools used by charm:
5655
All snap resources must be executed under the special snap user `_daemon_` only!
5756
```
5857

59-
<a name="integrations"></a>
6058
## Integrations
6159

6260
### PgBouncer
@@ -85,7 +83,7 @@ GLAuth is a secure, easy-to-use and open-sourced LDAP server which provides capa
8583

8684
### Grafana
8785

88-
Grafana is an open-source visualization tools that allows to query, visualize, alert on, and visualize metrics from mixed datasources in configurable dashboards for observability. This charms is shipped with its own Grafana dashboard and supports integration with the [Grafana Operator](https://charmhub.io/grafana-k8s) to simplify observability. Please follow [COS Monitoring](/how-to/monitoring-cos/enable-monitoring) setup.
86+
Grafana is an open-source visualisation tools that allows to query, visualise, alert on, and visualise metrics from mixed data sources in configurable dashboards for observability. This charms is shipped with its own Grafana dashboard and supports integration with the [Grafana Operator](https://charmhub.io/grafana-k8s) to simplify observability. Please follow [COS Monitoring](/how-to/monitoring-cos/enable-monitoring) setup.
8987

9088
### Loki
9189

@@ -97,7 +95,7 @@ Prometheus is an open-source systems monitoring and alerting toolkit with a dime
9795

9896
## LLD (Low Level Design)
9997

100-
Please check the charm state machines displayed in the [workflow diagrams](https://canonical-charmed-postgresql-k8s.readthedocs-hosted.com/14/explanation/flowcharts/). The low-level logic is mostly common for both VM and K8s charms.
98+
Please check the charm state machines displayed in the [workflow diagrams](https://discourse.charmhub.io/t/charmed-postgresql-k8s-explanations-charm-flowcharts/9305). The low-level logic is mostly common for both VM and K8s charms.
10199

102100
<!--- TODO: Describe all possible installations? Cross-model/controller? --->
103101

@@ -107,25 +105,26 @@ Accordingly to the [Juju SDK](https://juju.is/docs/sdk/event): “an event is a
107105

108106
For this charm, the following events are observed:
109107

110-
1. [`on_install`](https://juju.is/docs/sdk/install-event): install the snap "charmed-postgresql" and perform basic preparations to bootstrap the cluster on the first leader (or join the already configured cluster).
111-
2. [`leader-elected`](https://juju.is/docs/sdk/leader-elected-event): generate all the secrets to bootstrap the cluster.
112-
3. [`leader-settings-changed`](https://juju.is/docs/sdk/leader-settings-changed-event): Handle the leader settings changed event.
113-
4. [`start`](https://juju.is/docs/sdk/start-event): Init/setting up the cluster node.
114-
5. [`config_changed`](https://juju.is/docs/sdk/config-changed-event): usually fired in response to a configuration change using the GUI or CLI. Create and set default cluster and cluster-set names in the peer relation databag (on the leader only).
115-
6. [`update-status`](https://juju.is/docs/sdk/update-status-event): Takes care of workload health checks.
108+
1. [`on_install`](https://documentation.ubuntu.com/juju/3.6/reference/hook/#install): install the snap "charmed-postgresql" and perform basic preparations to bootstrap the cluster on the first leader (or join the already configured cluster).
109+
2. [`leader-elected`](https://documentation.ubuntu.com/juju/3.6/reference/hook/#leader-elected): generate all the secrets to bootstrap the cluster.
110+
3. [`leader-settings-changed`](https://documentation.ubuntu.com/juju/3.6/reference/hook/#leader-settings-changed): Handle the leader settings changed event.
111+
4. [`start`](https://documentation.ubuntu.com/juju/3.6/reference/hook/#start): Init/setting up the cluster node.
112+
5. [`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. Create and set default cluster and cluster-set names in the peer relation databag (on the leader only).
113+
6. [`update-status`](https://documentation.ubuntu.com/juju/3.6/reference/hook/#update-status): Takes care of workload health checks.
116114
<!--- 7. database_storage_detaching: TODO: ops? event?
117-
8. TODO: any other events?
115+
1. TODO: any other events?
118116
--->
119117

120118
### Charm code overview
121119

122-
[`src/charm.py`](https://github.com/canonical/postgresql-operator/blob/main/src/charm.py) is the default entry point for a charm and has the `PostgresqlOperatorCharm` Python class which inherits from CharmBase.
120+
[`src/charm.py`](https://github.com/canonical/postgresql-operator/blob/main/src/charm.py) is the default entry point for a charm and has the `PostgresqlOperatorCharm` Python class which inherits from `CharmBase`.
123121

124-
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). See more information in [Charm](https://juju.is/docs/sdk/constructs#charm).
122+
`CharmBase` is the base class from which all Charms are formed, defined by [Ops](https://ops.readthedocs.io/en/latest/) (Python framework for developing charms). See more information in the [Ops documentation for `CharmBase`](https://ops.readthedocs.io/en/latest/reference/ops.html#ops.CharmBase).
125123

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

128-
The VM and K8s charm flavors shares the codebase via [charm libraries](https://juju.is/docs/sdk/libraries) in [lib/charms/postgresql_k8s/v0/](https://github.com/canonical/postgresql-k8s-operator/blob/main/lib/charms/postgresql_k8s/v0/postgresql.py) (of K8s flavor of the charm!):
126+
The VM and K8s charm flavours shares the codebase via charm libraries in [`lib/charms/postgresql_k8s/v0/`](https://github.com/canonical/postgresql-k8s-operator/blob/main/lib/charms/postgresql_k8s/v0/postgresql.py) (of K8s flavour of the charm!):
127+
129128
```text
130129
> charmcraft list-lib postgresql-k8s
131130
Library name API Patch

docs/explanation/index.md

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,33 @@
11
# Explanation
22

3-
This section contains pages with more detailed explanations that provide additional context about key concepts behind the PostgreSQL charm.
3+
Additional context about key concepts behind the PostgreSQL charm, including design and legacy information.
44

55
## Core concepts and design
6-
* [Architecture]
7-
* [Interfaces and endpoints]
8-
* [Legacy charm]
9-
10-
## Operational concepts
11-
* [Units]
12-
* [Users]
13-
* [Logs]
14-
* [Connection pooling]
15-
16-
## Security and hardening
17-
* [Security hardening guide][Security]
18-
* [Cryptography]
19-
20-
21-
<!-- Links -->
22-
23-
[Architecture]: /explanation/architecture
24-
[Interfaces and endpoints]: /explanation/interfaces-and-endpoints
25-
[Units]: /explanation/units
26-
[Users]: /explanation/users
27-
[Logs]: /explanation/logs
28-
[Legacy charm]: /explanation/legacy-charm
29-
[Connection pooling]: /explanation/connection-pooling
30-
[Security]: /explanation/security/index
31-
[Cryptography]: /explanation/security/cryptography
32-
336

347
```{toctree}
358
:titlesonly:
36-
:maxdepth: 2
37-
:glob:
38-
:hidden:
399
4010
Architecture <architecture>
4111
Interfaces and endpoints <interfaces-and-endpoints>
4212
Legacy charm <legacy-charm>
13+
```
14+
15+
## Operational concepts
16+
17+
```{toctree}
18+
:titlesonly:
19+
4320
Units <units>
4421
Users <users>
4522
Roles <roles>
4623
Logs <logs>
4724
Connection pooling <connection-pooling>
48-
Security <security/index>
25+
```
26+
27+
## Security and hardening
28+
29+
```{toctree}
30+
:titlesonly:
31+
32+
Security <security/index>
33+
```

docs/explanation/legacy-charm.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Charm types: "legacy" vs "modern"
1+
# Legacy charm
22

3-
There are [two types of charms](https://juju.is/docs/sdk/charm-taxonomy#charm-types-by-generation) stored under the same charm name `postgresql`:
3+
There are [two types of charms](https://documentation.ubuntu.com/juju/3.6/reference/charm/#by-generation) stored under the same charm name `postgresql`:
44

5-
1. [Reactive](https://juju.is/docs/sdk/charm-taxonomy#reactive) charm in the channel `latest/stable` (called `legacy`)
6-
2. [Ops-based](https://juju.is/docs/sdk/ops) charm in the channels `14/stable` and `16/stable` (called `modern`)
5+
1. [Reactive](https://documentation.ubuntu.com/juju/3.6/reference/charm/#reactive) charm in the channel `latest/stable` (called `legacy`)
6+
2. [Ops-based](https://documentation.ubuntu.com/juju/3.6/reference/charm/#ops) charm in the channel `14/stable` (called `modern`)
77

88
The legacy charm provided endpoints `db` and `db-admin` (for the interface `pgsql`). The modern charm provides old endpoints as well + new endpoint `database` (for the interface `postgresql_client`). Read more details about the available [endpoints/interfaces](/explanation/interfaces-and-endpoints).
99

1010
```{note}
1111
Choose one endpoint to use, rather than relating both simultaneously.
1212
```
1313

14-
<!--TODO: Explain `latest` in the context of `16`-->
14+
<!--TODO: Explain in the context of 16 -->
1515

16-
## The default track `latest` vs `14`
16+
## The default track "latest" vs "14"
1717

1818
The [default track](https://docs.openstack.org/charm-guide/yoga/project/charm-delivery.html) has been switched from the `latest` to `14`. It is [to ensure](https://discourse.charmhub.io/t/request-switch-default-track-from-latest-to-14-for-postgresql-k8s-charms/10314) all new deployments use a modern codebase. We strongly advise against using the latest track due to its implicit nature. In doing so, a future charm upgrade may result in a PostgreSQL version incompatible with an integrated application. Track 14 guarantees PostgreSQL 14 deployment only. The track `latest` will be closed after all applications migrated from Reactive to Ops-based charm.
1919

@@ -31,12 +31,13 @@ The "modern" charm provides temporary support for the legacy interfaces:
3131

3232
* **proper migration**: migrate the application to the new interface "[postgresql_client](https://github.com/canonical/charm-relation-interfaces)". The application will connect PostgreSQL using "[data_interfaces](https://charmhub.io/data-platform-libs/libraries/data_interfaces)" library from "[data-platform-libs](https://github.com/canonical/data-platform-libs/)" via endpoint `database`.
3333

34+
3435
```{warning}
3536
**In-place upgrades are not supported for this case.**
3637
3738
Reactive charms cannot be upgraded to an operator-framework-based version. To move database data, the new DB application must be launched nearby, and data should be copied from "legacy" application to the "modern" one.
3839
39-
Please [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) if you need migration instructions.
40+
Please [contact us](/reference/contacts) if you need migration instructions.
4041
```
4142

4243
## How to deploy old "legacy" PostgreSQL charm
@@ -49,7 +50,7 @@ Deploy the charm using the channel `latest/stable`:
4950
channel: latest/stable
5051
```
5152

52-
```{note}
53+
```{caution}
5354
Remove the charm store prefix `cs:` from the bundle.
5455
5556
Otherwise, the modern charm will be chosen by Juju (due to the default track pointing to `14/stable` and not `latest/stable`).
@@ -61,7 +62,7 @@ A common error message is: `cannot deploy application "postgresql": unknown opti
6162

6263
The legacy charm config options were not moved to the modern charm due to no need. The modern charm applies the best possible configuration automatically.
6364

64-
Feel free to [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) about the DB tuning/config options.
65+
Feel free to [contact us](/reference/contacts) about the DB tuning/config options.
6566

6667
## Extensions supported by modern charm
6768

@@ -81,7 +82,7 @@ For more information about migrating the new interface, see [this guide](/how-to
8182

8283
At the moment, the modern charms support PostgreSQL 14 (based on Jammy/22.04 series) only.
8384

84-
Please [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) if you need different versions/series.
85+
Please [contact us](/reference/contacts) if you need different versions/series.
8586

8687
## Supported architectures
8788

docs/explanation/logs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ Charmed PostgreSQL is configured to rotate PostgreSQL text logs every minute and
9898

9999
For PostgreSQL, logs will be truncated when the week turns and the same minute of the same hour of the same weekday comes to pass. E.g. at 12:01 UTC on Monday either a new log file will be created or last week's log will be overwritten.
100100

101-
Due to Patroni only supporting size based rotation, it has been configured to retain logs for a comparatively similar timeframe as PostgreSQL. The assumed size of a minute of Patroni logs is 600 bytes, but the estimation is bound to be imprecise. Patroni will retain 10,080 log files (for every minute of a week). The current log is `patroni.log`, when rotating Patroni will append a number to the name of the file and remove logs over the limit.
101+
Due to Patroni only supporting size based rotation, it has been configured to retain logs for a comparatively similar time frame as PostgreSQL. The assumed size of a minute of Patroni logs is 600 bytes, but the estimation is bound to be imprecise. Patroni will retain 10,080 log files (for every minute of a week). The current log is `patroni.log`, when rotating Patroni will append a number to the name of the file and remove logs over the limit.
102102

0 commit comments

Comments
 (0)