Skip to content

Commit 7545b42

Browse files
Sync docs from Discourse
1 parent 6677560 commit 7545b42

File tree

8 files changed

+202
-16
lines changed

8 files changed

+202
-16
lines changed

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/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/overview.md

+1
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) |

Diff for: docs/tutorial/t-enable-tls.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Machine State Address Inst id Series AZ Message
5555

5656
To enable TLS on Charmed PostgreSQL VM, integrate the two applications:
5757
```shell
58-
juju integrate postgresql self-signed-certificates
58+
juju integrate postgresql:certificates self-signed-certificates:certificates
5959
```
6060
PostgreSQL is now using TLS certificate generated by the `self-signed-certificates` charm.
6161

@@ -72,7 +72,7 @@ verify error:num=19:self-signed certificate in certificate chain
7272
<a href="#heading--remove-tls"><h2 id="heading--remove-tls"> Remove TLS certificate</h2></a>
7373
To remove the external TLS, remove the integration:
7474
```shell
75-
juju remove-relation postgresql self-signed-certificates
75+
juju remove-relation postgresql:certificates self-signed-certificates:certificates
7676
```
7777

7878
If you once again check the TLS certificates in use via the OpenSSL client, you will see something similar to the output below:

Diff for: docs/tutorial/t-set-up.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> [Charmed PostgreSQL K8s Tutorial](/t/9707) > 1. Set up the environment
1+
> [Charmed PostgreSQL VM Tutorial](/t/9707) > 1. Set up the environment
22
33
# Set up the environment
44

0 commit comments

Comments
 (0)