You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/explanation/architecture.md
+18-19Lines changed: 18 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
## Juju K8s concept
8
8
9
-
The charm design leverages the [sidecar](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/#example-1-sidecar-containers) pattern to allow multiple containers in each pod with [Pebble](https://juju.is/docs/sdk/pebble) running as the workload container’s entrypoint.
9
+
The charm design leverages the [sidecar](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/#example-1-sidecar-containers) pattern to allow multiple containers in each pod with [Pebble](https://documentation.ubuntu.com/juju/3.6/reference/pebble/) running as the workload container’s entrypoint.
10
10
11
11
Pebble is a lightweight, API-driven process supervisor that is responsible for configuring processes to run in a container and controlling those processes throughout the workload lifecycle.
12
12
@@ -28,23 +28,23 @@ And if you run `kubectl describe pod postgresql-k8s-0`, all the containers will
28
28
29
29
## HLD (High Level Design)
30
30
31
-
The Charmed PostgreSQL K8s (`workload` container) based on `postgresql-image` resource defined in the [charm metadata.yaml](https://github.com/canonical/postgresql-k8s-operator/blob/main/metadata.yaml). It is an official Canonical [charmed-postgresql](https://github.com/canonical/charmed-postgresql-rock)[OCI/Rock](https://ubuntu.com/server/docs/rock-images/introduction) image, which is recursively based on the Canonical [`charmed-postgresql` snap].
31
+
The Charmed PostgreSQL K8s (`workload` container) based on `postgresql-image` resource defined in the [charm metadata.yaml](https://github.com/canonical/postgresql-k8s-operator/blob/main/metadata.yaml). It is an official Canonical [charmed-postgresql](https://github.com/canonical/charmed-postgresql-rock)[OCI/Rock](https://documentation.ubuntu.com/rockcraft/en/latest/explanation/rockcraft/) image, which is based on the Canonical [`charmed-postgresql` snap].
32
32
33
-
[Charmcraft](https://juju.is/docs/sdk/install-charmcraft) uploads an image as a [charm resource](https://charmhub.io/postgresql-k8s/resources/postgresql-image) to [Charmhub](https://charmhub.io/postgresql-k8s) during the [publishing](https://github.com/canonical/postgresql-k8s-operator/blob/main/.github/workflows/release.yaml), as described in the [Juju SDK How-to guides](https://juju.is/docs/sdk/publishing).
33
+
[Charmcraft](https://canonical-charmcraft.readthedocs-hosted.com/stable/) uploads an image as a [charm resource](https://charmhub.io/postgresql-k8s/resources/postgresql-image) to [Charmhub](https://charmhub.io/postgresql-k8s) during the [publishing](https://github.com/canonical/postgresql-k8s-operator/blob/main/.github/workflows/release.yaml).
34
34
35
-
The charm supports Juju deploymed to all Kubernetes environments: [MicroK8s](https://microk8s.io/), [Charmed Kubernetes](https://ubuntu.com/kubernetes/charmed-k8s), [GKE](https://charmhub.io/postgresql-k8s/docs/h-deploy-gke), [Amazon EKS](https://aws.amazon.com/eks/), ...
35
+
The charm supports Juju deployment on all Kubernetes environments: [MicroK8s](https://microk8s.io/), [Charmed Kubernetes](https://ubuntu.com/kubernetes/charmed-k8s), [GKE](/how-to/deploy/gke), [Amazon EKS](/how-to/deploy/aks)...
36
36
37
37
The OCI/Rock ships the following components:
38
38
39
39
* PostgreSQL Community Edition (based on [`charmed-postgresql` snap])
40
40
* Patroni (based on [`charmed-postgresql` snap])
41
41
* PgBouncer (based on [`charmed-postgresql` snap])
42
-
*pgBackRest (based on [`charmed-postgresql` snap])
42
+
*PgBackRest (based on [`charmed-postgresql` snap])
43
43
* Prometheus PostgreSQL Exporter (based on [`charmed-postgresql` snap])
44
44
* Prometheus PgBouncer Exporter (based on [`charmed-postgresql` snap])
45
45
* Prometheus Grafana dashboards and Loki alert rules are part of the charm revision (and missing in SNAP).
46
46
47
-
SNAP-based rock images guarantee the same components versions and functionality between VM and K8s charm flavors.
47
+
SNAP-based rock images guarantee the same components versions and functionality between VM and K8s charm flavours.
48
48
49
49
Pebble runs layers of all the currently enabled services, e.g. monitoring, backups, etc:
50
50
```text
@@ -84,7 +84,7 @@ The rock "charmed-postgresql" also ships list of tools used by charm:
84
84
85
85
### Data Integrator
86
86
87
-
[Data Integrator](https://charmhub.io/data-integrator) charm is a solution to request DB credentials for non-native Juju applications. Not all applications implement a data_interfaces relation but allow setting credentials via config. Also, some of the applications are run outside of juju. This integrator charm allows receiving credentials which can be passed into application config directly without implementing juju-native relation.
87
+
[Data Integrator](https://charmhub.io/data-integrator) charm is a solution to request DB credentials for non-native Juju applications. Not all applications implement a data_interfaces relation but allow setting credentials via config. Also, some of the applications are run outside of juju. This integrator charm allows receiving credentials which can be passed into application configuration directly without implementing juju-native relation.
88
88
89
89
### PostgreSQL Test App
90
90
@@ -96,7 +96,7 @@ GLAuth is a secure, easy-to-use and open-sourced LDAP server which provides capa
96
96
97
97
### Grafana
98
98
99
-
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.
99
+
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.
100
100
101
101
### Loki
102
102
@@ -108,33 +108,32 @@ Prometheus is an open-source systems monitoring and alerting toolkit with a dime
108
108
109
109
## LLD (Low Level Design)
110
110
111
-
Please check the charm state machines displayed on [workflow diagrams](/explanation/flowcharts/charm). The low-level logic is mostly common for both VM and K8s charm flavors.
111
+
Please check the charm state machines displayed on [workflow diagrams](/explanation/flowcharts/charm). The low-level logic is mostly common for both VM and K8s charm flavours.
112
112
113
113
<!--- TODO: Describe all possible installations? Cross-model/controller? --->
114
114
115
-
### Juju Events
115
+
### Juju events
116
116
117
-
Accordingly to the [Juju SDK](https://juju.is/docs/sdk/event): “an event is a data structure that encapsulates part of the execution context of a charm”.
117
+
An eventis a data structure that encapsulates part of the execution context of a charm.
118
118
119
119
For this charm, the following events are observed:
120
120
121
-
1.[postgresql_pebble_ready](https://juju.is/docs/sdk/container-name-pebble-ready-event): informs charm about the availability of the rock "charmed-postgresql"-based `workload` K8s container. Also performs basic preparations to bootstrap the cluster on the first leader (or join the already configured cluster).
122
-
2.[leader-elected](https://juju.is/docs/sdk/leader-elected-event): generate all the secrets to bootstrap the cluster.
123
-
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).
124
-
6.[update-status](https://juju.is/docs/sdk/update-status-event): Takes care of workload health checks.
121
+
1.[postgresql_pebble_ready](https://documentation.ubuntu.com/juju/3.6/reference/hook/#container-pebble-ready): informs charm about the availability of the rock "charmed-postgresql"-based `workload` K8s container. Also performs basic preparations to bootstrap the cluster on the first leader (or join the already configured cluster).
122
+
2.[leader-elected](https://documentation.ubuntu.com/juju/3.6/reference/hook/#leader-elected): generate all the secrets to bootstrap the cluster.
123
+
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).
124
+
6.[update-status](https://documentation.ubuntu.com/juju/3.6/reference/hook/#update-status): Takes care of workload health checks.
8. TODO: any other events? relation_joined/changed/created/broken
126
+
1. TODO: any other events? relation_joined/changed/created/broken
127
127
--->
128
128
129
129
### Charm Code Overview
130
130
131
131
The "[src/charm.py](https://github.com/canonical/postgresql-k8s-operator/blob/main/src/charm.py)" is the default entry point for a charm and has the `PostgresqlOperatorCharm` Python class which inherits from CharmBase.
132
132
133
-
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).
134
-
133
+
CharmBase is the base class from which all Charms are formed, defined by [Ops](https://ops.readthedocs.io/en/latest/index.html) (Python framework for developing charms).
135
134
The `__init__` method guarantees that the charm observes all events relevant to its operation and handles them.
136
135
137
-
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!):
136
+
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!):
Copy file name to clipboardExpand all lines: docs/explanation/juju.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ In the context of this documentation, the pertinent changes are as follows:
26
26
|`run`|`exec`|
27
27
|`run-action --wait`|`run`|
28
28
29
-
See the [Juju 3.0 release notes](https://juju.is/docs/juju/roadmap#juju-3-0-0---22-oct-2022) for the comprehensive list of changes.
29
+
See the [Juju 3.0 release notes](https://documentation.ubuntu.com/juju/3.6/reference/juju/juju-roadmap-and-releases/#juju-3-0-0-22-oct-2022) for the comprehensive list of changes.
Copy file name to clipboardExpand all lines: docs/explanation/legacy-charm.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Legacy charm
2
2
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-k8s`:
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-k8s`:
4
4
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 channel `14/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`)
7
7
8
-
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](https://charmhub.io/postgresql-k8s/docs/e-interfaces).
8
+
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).
9
9
10
10
```{note}
11
11
Choose one endpoint to use, rather than relating both simultaneously.
@@ -39,7 +39,7 @@ Note that the `trust` option must be enabled if [Role Based Access Control (RBAC
39
39
40
40
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.
41
41
42
-
Please [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) if you need migration instructions.
42
+
Please [contact us](/reference/contacts) if you need migration instructions.
43
43
```
44
44
45
45
## How to deploy old "legacy" postgresql charm
@@ -62,7 +62,7 @@ A common error message is: `cannot deploy application "postgresql": unknown opti
62
62
63
63
## Config options supported by modern charm
64
64
65
-
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. Feel free to [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) about the DB tuning/config options.
65
+
The legacy charm configuration options were not moved to the modern charm due to no need. The modern charm applies the best possible configuration automatically. Feel free to [contact us](/reference/contacts) about the DB tuning/config options.
66
66
67
67
## Extensions supported by modern charm
68
68
@@ -77,7 +77,7 @@ In the legacy charm, the user could request roles by setting the `roles` field t
77
77
## Supported PostgreSQL versions by modern charm
78
78
79
79
At the moment, the modern charms support PostgreSQL 14 (based on Jammy/22.04 series) only.
80
-
Please [contact us](https://chat.charmhub.io/charmhub/channels/data-platform) if you need different versions/series.
80
+
Please [contact us](/reference/contacts) if you need different versions/series.
81
81
82
82
## Supported architectures: amd64, arm64, ...
83
83
Currently, the charm supports architecture `amd64` (all revisions) and `arm64` (from revision 211+).
@@ -90,5 +90,4 @@ The "legacy charm" (from `latest/stable`) is stored on [Launchpad](https://git.l
90
90
91
91
The "modern charm" (from `14/stable`) is stored on [GitHub](https://github.com/canonical/postgresql-k8s-operator), here is the link to report [modern charm issues](https://github.com/canonical/postgresql-k8s-operator/issues/new/choose).
92
92
93
-
Do you have questions? [Contact us](https://chat.charmhub.io/charmhub/channels/data-platform)!
94
-
93
+
Do you have questions? [Contact us](/reference/contacts)!
Copy file name to clipboardExpand all lines: docs/explanation/logs.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Logs
2
2
3
-
This page summarizes all log types in Charmed PostgreSQL to simplify troubleshooting.
3
+
This page summarises all log types in Charmed PostgreSQL to simplify troubleshooting.
4
4
5
5
For an overview of all charm components, see [](/explanation/architecture).
6
6
@@ -96,5 +96,5 @@ Charmed PostgreSQL is configured to rotate PostgreSQL text logs every minute and
96
96
97
97
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.
98
98
99
-
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.
99
+
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.
0 commit comments