Skip to content

Commit f61567e

Browse files
Sync docs from Discourse
1 parent 7686dd0 commit f61567e

File tree

7 files changed

+145
-15
lines changed

7 files changed

+145
-15
lines changed

docs/explanation/e-architecture.md

Lines changed: 4 additions & 0 deletions
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.

docs/explanation/e-users.md

Lines changed: 11 additions & 4 deletions
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.

docs/how-to/h-enable-profiling.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
Please read this doc in its entirety before deploying anything. In particular, please decide what Parca backend you would like to use. You can either deploy Charmed Parca K8s or use Polar Signals Cloud.
8+
9+
# Enable Profiling
10+
11+
This guide contains the steps to enable profiling with [Parca](https://www.parca.dev/docs/overview/) for your PostgreSQL application.
12+
13+
To summarize:
14+
* [Deploy Charmed PostgreSQL](#heading--deploy)
15+
* [Optional: Deploy the COS-lite bundle and Charmed Parca K8s + Offer interfaces for cross-model integrations](#heading--cos)
16+
* [Deploy Charmed Parca Agent and integrate with Charmed PostgreSQL](#heading--parcaagent)
17+
* [Integrate Charmed Parca Agent with the Parca Backend](#heading--parcabackend)
18+
* [View PostgreSQL machine profiles](#heading--view)
19+
20+
<a href="#heading--deploy"><h2 id="heading--deploy"> Deploy Charmed PostgreSQL </h2></a>
21+
22+
See [How to scale units](https://discourse.charmhub.io/t/charmed-postgresql-how-to-scale-units/9689) for reference of how you can deploy Charmed PostgreSQL in a machine model.
23+
24+
[note]
25+
**Note**: 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. 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.
26+
27+
To ensure that a virtual machine is used instead of a system container, you would need to add constraints, e.g. `juju deploy postgresql --constraints="virt-type=virtual-machine"`.
28+
[/note]
29+
30+
[note]
31+
**Note:** Please note the base of the Charmed PostgreSQL application.
32+
33+
Nothing needs to be done if the base is `ubuntu@24.04` which already loads the kernel symbol table for debugging by default.
34+
35+
If your base is `ubuntu@22.04`, you will need to ensure that your are using the `generic` flavor (see output of `uname -r` to confirm) of Linux. If you do not have the `generic` flavor, you can enable it on a unit to be profiled as follows:
36+
37+
```
38+
juju ssh postgresql/0 bash
39+
sudo apt-get update && sudo apt-get install linux-image-virtual
40+
sudo apt-get autopurge linux-image-kvm
41+
# only run the following if your application is deployed in an LXD model
42+
# rm /etc/default/grub.d/40-force-partuuid.cfg
43+
44+
# Then open the /etc/default/grub file and replace the line that starts with GRUB_DEFAULT= with:
45+
release=$(linux-version list | grep -e '-generic$' | sort -V | tail -n1)
46+
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux $release"
47+
# Exit out of the /etc/default/grub file
48+
49+
sudo update-grub
50+
sudo reboot
51+
```
52+
[/note]
53+
54+
<a href="#heading--cos"><h2 id="heading--cos"> Optional: Deploy the COS-lite bundle and Charmed Parca K8s + Offer interfaces for cross-model integrations </h2></a>
55+
56+
Please 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.
57+
58+
Then, please 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.
59+
60+
Next, offer interfaces for cross-model integrations from the model where Charmed PostgreSQL is deployed.
61+
62+
```
63+
juju offer <parca_k8s_application_name>:parca-store-endpoint
64+
```
65+
66+
<a href="#heading--parcaagent"><h2 id="heading--parcaagent"> Deploy Charmed Parca Agent and Integrate with Charmed PostgreSQL </h2></a>
67+
68+
Switch to the Charmed PostgreSQL model, then deploy Charmed Parca Agent and relate with Charmed PostgreSQL:
69+
70+
```
71+
juju switch <machine_controller_name>:<postgresql_model_name>
72+
73+
juju deploy parca-agent --channel latest/edge
74+
juju integrate postgresql parca-agent
75+
```
76+
77+
<a href="#heading--parcabackend"><h2 id="heading--parcabackend"> Integrate Charmed Parca Agent with the Parca backend </h2></a>
78+
79+
### Integrating with Parca K8s in a K8s model
80+
81+
If you deployed Charmed Parca K8s in a Kubernetes model, consume the parca offer from a previous section and integrate with them:
82+
83+
```
84+
juju switch <machine_controller_name>:<postgresql_model_name>
85+
86+
juju find-offers <k8s_controller_name>:
87+
```
88+
89+
> :exclamatin: Do not miss the ":" in the command above.
90+
91+
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:
92+
93+
```
94+
Store URL Access Interfaces
95+
k8s admin/cos.parca admin parca_store:parca-store-endpoint
96+
```
97+
98+
Next, consume this offer so that is reachable from the current model. Then relate Charmed Parca Agent with the consumed offer endpoint:
99+
100+
```
101+
juju consume k8s:admin/cos.parca
102+
103+
juju integrate parca-agent parca
104+
```
105+
106+
### Integrating with Polar Signals Cloud
107+
108+
Please refer to [How to integrate with Polar Signals Cloud](https://discourse.charmhub.io/t/charmed-parca-docs-how-to-integrate-with-polar-signals-cloud/16559). We recommend configuring `parca-agent` to forward profiles to the cloud instance instead of configuring `parca-k8s` server to forward profiles to the cloud instance. This would entail deploying the `polar-signals-cloud-integrator` in the same model as Charmed PostgreSQL.
109+
110+
<a href="#heading--view"><h2 id="heading--view"> View Profiles </h2></a>
111+
112+
After this is complete, the profiles for the machines where the PostgreSQL units are running will be accessible from the Parca web interface. 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).
113+
114+
![Example profile with Parca Web UI690x753](upload://zFOOKY8nokrg2Q4xUVTbD8UGjD3.png)
115+
116+
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.
117+
118+
![Example profile with Grafana's Parca plugin|690x383](upload://w3G5STYOxMZHCpIA48gEJHUniLi.jpeg)

docs/how-to/h-enable-tls.md

Lines changed: 8 additions & 8 deletions
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
```

docs/overview.md

Lines changed: 1 addition & 0 deletions
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) |

docs/tutorial/t-enable-tls.md

Lines changed: 2 additions & 2 deletions
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:

docs/tutorial/t-set-up.md

Lines changed: 1 addition & 1 deletion
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)