Skip to content

Commit ddb0fcc

Browse files
Sync docs from Discourse
1 parent d35b18d commit ddb0fcc

12 files changed

+336
-29
lines changed

Diff for: docs/explanation.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
# Explanation
22

3-
This section contains pages with more detailed explanations that provide additional context about some of the key concepts behind the PostgreSQL charm:
3+
This section contains pages with more detailed explanations that provide additional context about key concepts behind the PostgreSQL charm.
44

5+
## Core concepts and design
56
* [Architecture]
67
* [Interfaces and endpoints]
8+
* [Juju]
9+
* [Legacy charm]
10+
11+
## Operational concepts
712
* [Connection pooling]
813
* [Users]
914
* [Logs]
10-
* [Juju]
11-
* [Legacy charm]
15+
16+
## Security and hardening
17+
* [Security] (hardening guide)
18+
* [Cryptography]
19+
1220

1321
<!-- Links -->
1422

@@ -18,4 +26,6 @@ This section contains pages with more detailed explanations that provide additio
1826
[Logs]: /t/12099
1927
[Juju]: /t/11985
2028
[Legacy charm]: /t/10690
21-
[Connection pooling]: /t/15777
29+
[Connection pooling]: /t/15777
30+
[Security]: /t/16852
31+
[Cryptography]: /t/16853

Diff for: docs/explanation/e-architecture.md

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ The snap "charmed-postgresql" also ships list of tools used by charm:
7575

7676
The charm "[PostgreSQL Test App](https://charmhub.io/postgresql-test-app)" is a Canonical test application to validate the charm installation / functionality and perform the basic performance tests.
7777

78+
### GLAuth
79+
80+
GLAuth is a secure, easy-to-use and open-sourced LDAP server which provides capabilities to centrally manage accounts across infrastructures. The charm is only available for Kubernetes clouds, under the [GLAuth-K8s operator](https://charmhub.io/glauth-k8s) page, so a cross-controller relation is needed in order to integrate both charms.
81+
7882
### Grafana
7983

8084
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](/t/10600) setup.

Diff for: docs/explanation/e-users.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Charm Users explanations
22

3-
There are two types of users in PostgreSQL:
3+
There are three types of users in PostgreSQL:
44
* Internal users (used by charm operator)
5-
* Relation/integration users (used by related applications)
5+
* Relation users (used by related applications)
66
* Extra user roles (if default permissions are not enough)
7+
* Identity users (used when LDAP is enabled)
78

89
<a name="internal-users"></a>
910
## Internal users explanations:
@@ -72,7 +73,7 @@ unit-postgresql-1:
7273
**Note**: the action `set-password` must be executed on juju leader unit (to update peer relation data with new value).
7374
7475
<a name="relation-users"></a>
75-
## Relation/integration users explanations:
76+
## Relation users explanations:
7677
7778
The operator created a dedicated user for every application related/integrated with database. Those users are removed on the juju relation/integration removal request. However, DB data stays in place and can be reused on re-created relations (using new user credentials):
7879
@@ -99,4 +100,10 @@ postgres=# \du
99100
100101
When an application charm requests a new user through the relation/integration it can specify that the user should have the `admin` role in the `extra-user-roles` field. The `admin` role enables the new user to read and write to all databases (for the `postgres` system database it can only read data) and also to create and delete non-system databases.
101102
102-
**Note**: `extra-user-roles` is supported by modern interface `postgresql_client` only and missing for legacy `pgsql` interface. Read more about the supported charm interfaces [here](/t/10251).
103+
**Note**: `extra-user-roles` is supported by modern interface `postgresql_client` only and missing for legacy `pgsql` interface. Read more about the supported charm interfaces [here](/t/10251).
104+
105+
<a name="identity-users"></a>
106+
## Identity users explanations:
107+
The operator considers Identity users all those that are automatically created when the LDAP integration is enabled, or in other words, the [GLAuth](https://charmhub.io/glauth-k8s) charm is related/integrated.
108+
109+
When synchronized from the LDAP server, these users do not have any permissions by default, so the LDAP group they belonged to must be mapped to a PostgreSQL pre-defined authorization role by using the `ldap_map` configuration option.

Diff for: docs/how-to.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following guides cover key processes and common tasks for managing and using
44

55
## Deployment and setup
66

7-
The following guides walk you through the details of how to install different cloud services and bootstrap them to Juju:
7+
Installation of different cloud services with Juju:
88
* [Sunbeam]
99
* [LXD]
1010
* [MAAS]
@@ -13,7 +13,7 @@ The following guides walk you through the details of how to install different cl
1313
* [Azure]
1414
* [Multi-availability zones (AZ)][Multi-AZ]
1515

16-
The following guides cover some specific deployment scenarios and architectures:
16+
Specific deployment scenarios and architectures:
1717
* [Terraform]
1818
* [Air-gapped]
1919
* [TLS VIP access]
@@ -54,7 +54,7 @@ The following guides cover some specific deployment scenarios and architectures:
5454

5555
## Development
5656

57-
This section is aimed at charm developers looking to support PostgreSQL integrations with their charm.
57+
This section is for charm developers looking to support PostgreSQL integrations with their charm.
5858

5959
* [Integrate with your charm]
6060
* [Migrate data via pg_dump]

Diff for: docs/how-to/h-deploy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Then, either continue with the `juju` client **or** use the `terraform juju` cli
2121

2222
To deploy with the `juju` client:
2323
```shell
24-
juju deploy postgresql
24+
juju deploy postgresql -n <number_of_replicas>
2525
```
2626
> See also: [`juju deploy` command](https://canonical-juju.readthedocs-hosted.com/en/latest/user/reference/juju-cli/list-of-juju-cli-commands/deploy/)
2727

Diff for: docs/how-to/h-enable-profiling.md

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
[note]
2+
**Note**: All commands are written for `juju >= v3.1`
3+
4+
If you're using `juju 2.9`, check the [`juju 3.0` Release Notes](https://juju.is/docs/juju/roadmap#heading--juju-3-0-0---22-oct-2022).
5+
[/note]
6+
7+
# Enable profiling with Parca
8+
9+
This guide contains the steps to enable profiling with [Parca](https://www.parca.dev/docs/overview/) for your PostgreSQL application.
10+
11+
## Summary
12+
* [Prerequisites](#prerequisites)
13+
* [Set up the Parca backend](#set-up-the-parca-backend)
14+
* [Charmed Parca K8s](#charmed-parca-k8s)
15+
* [Polar Signals Cloud](#polar-signals-cloud)
16+
* [View profiles](#view-profiles)
17+
18+
---
19+
20+
## Prerequisites
21+
22+
[note type=caution]
23+
**Do not skip this section** if you are deploying PostgreSQL in an LXD model or if your base is `[email protected]`.
24+
[/note]
25+
26+
27+
This guide assumes you already have a juju model with Charmed PostgreSQL deployed.
28+
29+
> See: [How to deploy PostgreSQL](/t/16811)
30+
31+
In order for your Charmed PostgreSQL deployment to be correctly set up for integration with Parca, there are two important considerations:
32+
* [LXD virtualization type](#lxd-virtualization-type)
33+
* [Base (Ubuntu version)](#base-ubuntu-version)
34+
35+
### LXD virtualization type
36+
37+
**If you are deploying Charmed PostgreSQL in a LXD model, you will need to ensure that LXD's virtualization type is set to `virtual-machine` for the Juju application.**
38+
39+
This is because LXD does not allow `/sys/kernel/tracing` to be mounted in a system container (even in privileged mode) due to security isolation concerns.
40+
41+
To ensure that a virtual machine is used instead of a system container, you would need to add constraints, for example:
42+
```
43+
juju deploy postgresql --constraints="virt-type=virtual-machine"`.
44+
```
45+
46+
### Base (Ubuntu version)
47+
**If your base is `[email protected]`, you will need to ensure that your are using the `generic` flavor of Linux.**
48+
> See the output of `uname -r` to confirm.
49+
50+
If you do not have the `generic` flavor, you can enable it on a unit to be profiled as follows:
51+
52+
```
53+
juju ssh postgresql/0 bash
54+
sudo apt-get update && sudo apt-get install linux-image-virtual
55+
sudo apt-get autopurge linux-image-kvm
56+
```
57+
58+
If your application is deployed in an LXD model, run the following command:
59+
```
60+
rm /etc/default/grub.d/40-force-partuuid.cfg
61+
```
62+
63+
Open the `/etc/default/grub` file with your editor of choice and replace the line that starts with `GRUB_DEFAULT=` with:
64+
```
65+
release=$(linux-version list | grep -e '-generic$' | sort -V | tail -n1)
66+
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux $release"
67+
```
68+
69+
Exit out of the `/etc/default/grub file`, update GRUB, and reboot:
70+
```
71+
sudo update-grub
72+
sudo reboot
73+
```
74+
75+
Nothing needs to be done if the base is `[email protected]`, which already loads the kernel symbol table for debugging by default.
76+
77+
## Set up the Parca backend
78+
79+
There are two potential backends:
80+
* [Charmed Parca K8s](#charmed-parca-k8s) (requires COS and cross-model integrations)
81+
* [Polar Signals Cloud](#polar-signals-cloud) (COS is optional)
82+
83+
### Charmed Parca K8s
84+
85+
This section goes through the steps for enabling profiling with Charmed Parca K8s as the backend.
86+
87+
#### 1. Deploy `cos-lite` and `parca-k8s`
88+
89+
Refer to [Getting started on MicroK8s](https://charmhub.io/topics/canonical-observability-stack/tutorials/install-microk8s) and deploy the `cos-lite` bundle from the `latest/edge` track in a Kubernetes environment.
90+
91+
Then, refer to [Deploy Charmed Parca on top of COS-lite](https://discourse.charmhub.io/t/how-to-deploy-charmed-parca-on-top-of-cos-lite/16579) to deploy Charmed Parca K8s in the same model as the `cos-lite` bundle.
92+
93+
#### 2. Offer interfaces
94+
95+
Offer interfaces for cross-model integrations:
96+
97+
```
98+
juju offer <parca_k8s_application_name>:parca-store-endpoint
99+
```
100+
101+
#### 3. Deploy and integrate `parca-agent` with `postgresql`
102+
103+
Switch to the model containing the Charmed PostgreSQL deployment, deploy Charmed Parca Agent, and integrate it with Charmed PostgreSQL:
104+
105+
```
106+
juju switch <machine_controller_name>:<postgresql_model_name>
107+
108+
juju deploy parca-agent --channel latest/edge
109+
juju integrate postgresql parca-agent
110+
```
111+
112+
#### 4. Integrate `parca-agent` with `parca-k8s`
113+
114+
Consume the parca offer from [Step 2](#2-offer-interfaces) and integrate with them:
115+
116+
```
117+
juju find-offers <k8s_controller_name>:
118+
```
119+
120+
> :exclamation: Do not miss the colon "`:`" in the command above.
121+
122+
Below is a sample output where `k8s` is the K8s controller name and `cos` is the model where `cos-lite` and `parca-k8s` are deployed:
123+
124+
```
125+
Store URL Access Interfaces
126+
k8s admin/cos.parca admin parca_store:parca-store-endpoint
127+
```
128+
129+
Next, consume this offer so that is reachable from the current machine model:
130+
131+
```
132+
juju consume k8s:admin/cos.parca
133+
```
134+
135+
Finally, relate Charmed Parca Agent with the consumed offer endpoint:
136+
```
137+
juju integrate parca-agent parca
138+
```
139+
140+
### Polar Signals Cloud
141+
142+
This section goes through the steps for enabling profiling with Polar Signals Cloud (PSC) as the backend.
143+
144+
[note]
145+
With PSC, `cos-lite` and `parca-k8s` are not required. This section goes through the recommended setup, where `polar-signals-cloud-integrator` is deployed in the same model as `postgresql`, and `parca-agent` is used to relay traffic to PSC.
146+
147+
If you would like to use `parca-k8s` to relay traffic to PSC instead, refer to [Steps 1 and 2](#1-deploy-cos-lite-and-parca-k8s) in the Charmed Parca K8s section.
148+
[/note]
149+
150+
#### 1. Deploy and integrate `parca-agent` with `postgresql`
151+
152+
In the machine model where PostgreSQL is deployed, deploy `parca-agent` and integrate it with `postgresql`:
153+
154+
```
155+
juju deploy parca-agent --channel latest/edge
156+
juju integrate postgresql parca-agent
157+
```
158+
159+
#### 2. Integrate `parca-agent` with `polar-signals-cloud-integrator`
160+
161+
Follow the guide [How to integrate with Polar Signals Cloud](https://discourse.charmhub.io/t/charmed-parca-docs-how-to-integrate-with-polar-signals-cloud/16559).
162+
163+
164+
## View profiles
165+
166+
After the backend setup is complete, the profiles for the machines where the PostgreSQL units are running will be accessible from the Parca web interface.
167+
168+
If you are running Charmed Parca K8s, you can also access the link for Parca's web interface from COS catalogue (`juju run traefik/0 show-proxied-endpoints` in the K8s model where `cos-lite` is deployed).
169+
170+
![Example profile with Parca Web UI690x753](upload://zFOOKY8nokrg2Q4xUVTbD8UGjD3.png)
171+
172+
Furthermore, if you have `cos-lite` deployed, you can use Grafana to explore profiles under the `Explore` section with `parca-k8s` as the data source.
173+
174+
![Example profile with Grafana's Parca plugin|690x383](upload://w3G5STYOxMZHCpIA48gEJHUniLi.jpeg)

Diff for: docs/how-to/h-enable-tls.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,9 @@ First, deploy the TLS charm:
3232
juju deploy self-signed-certificates
3333
```
3434

35-
To enable TLS on `postgresql`, integrate the two applications:
35+
To enable TLS integrate (formerly known as “relate”) the two applications:
3636
```shell
37-
juju integrate self-signed-certificates postgresql
38-
```
39-
40-
## Disable TLS
41-
Disable TLS by removing the integration.
42-
```shell
43-
juju remove-relation self-signed-certificates postgresql
37+
juju integrate postgresql:certificates self-signed-certificates:certificates
4438
```
4539

4640
## Check certificates in use
@@ -79,4 +73,10 @@ Updates can also be done with auto-generated keys:
7973
juju run postgresql/0 set-tls-private-key
8074
juju run postgresql/1 set-tls-private-key
8175
juju run postgresql/2 set-tls-private-key
76+
```
77+
78+
## Disable TLS
79+
Disable TLS by removing the integration.
80+
```shell
81+
juju remove-relation postgresql:certificates self-signed-certificates:certificates
8282
```

Diff for: docs/how-to/h-integrate.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ This guide shows how to integrate Charmed PostgreSQL with both charmed and non-c
2525

2626
Integrations with charmed applications are supported via the modern [`postgresql_client`](https://github.com/canonical/charm-relation-interfaces/blob/main/interfaces/postgresql_client/v0/README.md) interface, and the legacy `psql` interface from the [original version](https://launchpad.net/postgresql-charm) of the charm.
2727

28-
> You can see which existing charms are compatible with PostgreSQL in the [Integrations](https://charmhub.io/postgresql/integrations) tab.
28+
[note]
29+
You can see which existing charms are compatible with PostgreSQL in the [Integrations](https://charmhub.io/postgresql/integrations) tab.
30+
[/note]
2931

3032
### Modern `postgresql_client` interface
3133
To integrate with a charmed application that supports the `postgresql_client` interface, run
@@ -41,7 +43,7 @@ juju remove-relation postgresql <charm>
4143
### Legacy `pgsql` interface
4244
[note type="caution"]
4345
Note that this interface is **deprecated**.
44-
See more information in [Explanation > Legacy charm](/t/10690).
46+
See the [legacy charm explanation page](/t/10690).
4547
[/note]
4648

4749
To integrate via the legacy interface, run

Diff for: docs/overview.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ PostgreSQL is a trademark or registered trademark of PostgreSQL Global Developme
7777
| 3 | h-enable-monitoring | [Enable monitoring](/t/10600) |
7878
| 3 | h-enable-alert-rules | [Enable alert rules](/t/13084) |
7979
| 3 | h-enable-tracing | [Enable tracing](/t/14521) |
80+
| 3 | h-enable-profiling | [Enable profiling](/t/17172) |
8081
| 2 | h-upgrade | [Upgrade](/t/12086) |
8182
| 3 | h-upgrade-minor | [Perform a minor upgrade](/t/12089) |
8283
| 3 | h-rollback-minor | [Perform a minor rollback](/t/12090) |
@@ -94,20 +95,21 @@ PostgreSQL is a trademark or registered trademark of PostgreSQL Global Developme
9495
| 2 | r-software-testing | [Software testing](/t/11773) |
9596
| 2 | r-performance | [Performance and resources](/t/11974) |
9697
| 2 | r-troubleshooting | [Troubleshooting](/t/11864) |
98+
| 3 | r-sos-report | [SOS report](/t/17228) |
9799
| 2 | r-plugins-extensions | [Plugins/extensions](/t/10946) |
98100
| 2 | r-alert-rules | [Alert rules](/t/15841) |
99101
| 2 | r-statuses | [Statuses](/t/10844) |
100102
| 2 | r-contacts | [Contacts](/t/11863) |
101103
| 1 | explanation | [Explanation](/t/16768) |
102104
| 2 | e-architecture | [Architecture](/t/11857) |
103-
| 2 | e-security | [Security](/t/16852) |
104-
| 2 | e-cryptography | [Cryptography](/t/16853) |
105105
| 2 | e-interfaces-endpoints | [Interfaces and endpoints](/t/10251) |
106+
| 2 | e-juju-details | [Juju](/t/11985) |
107+
| 2 | e-legacy-charm | [Legacy charm](/t/10690) |
106108
| 2 | e-connection-pooling| [Connection pooling](/t/15777) |
107109
| 2 | e-users | [Users](/t/10798) |
108110
| 2 | e-logs | [Logs](/t/12099) |
109-
| 2 | e-juju-details | [Juju](/t/11985) |
110-
| 2 | e-legacy-charm | [Legacy charm](/t/10690) |
111+
| 2 | e-security | [Security](/t/16852) |
112+
| 3 | e-cryptography | [Cryptography](/t/16853) |
111113
| 1 | search | [Search](https://canonical.com/data/docs/postgresql/iaas) |
112114

113115
[/details]

0 commit comments

Comments
 (0)