Skip to content

Commit 05b4c6b

Browse files
authored
DPE-4901 Update README.md (#538)
* Update README.md * Small typo
1 parent 78eeb2b commit 05b4c6b

File tree

1 file changed

+62
-46
lines changed

1 file changed

+62
-46
lines changed

README.md

Lines changed: 62 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,84 @@ To deploy on Kubernetes, please use [Charmed PostgreSQL K8s Operator](https://ch
1111

1212
This operator provides a PostgreSQL database with replication enabled: one primary instance and one (or more) hot standby replicas. The Operator in this repository is a Python script which wraps PostgreSQL versions distributed by Ubuntu Jammy series and adding [Patroni](https://github.com/zalando/patroni) on top of it, providing lifecycle management and handling events (install, configure, integrate, remove, etc).
1313

14-
## Usage
15-
14+
## README contents
15+
* [Basic usage](#basic-usage): Deploy and scale Charmerd PostgreSQL
16+
* [Integrations](#integrations-relations): Supported interfaces for integrations
17+
* [Contributing](#contributing)
18+
* [Licensing and trademark](#licensing-and-trademark)
19+
20+
## Basic usage
21+
22+
### Deployment
1623
Bootstrap a [lxd controller](https://juju.is/docs/olm/lxd#heading--create-a-controller) and create a new Juju model:
1724

1825
```shell
19-
juju add-model postgresql
26+
juju add-model sample-model
2027
```
2128

22-
### Basic Usage
23-
To deploy a single unit of PostgreSQL using its default configuration.
29+
To deploy a single unit of PostgreSQL using its [default configuration](config.yaml), run the following command:
2430

2531
```shell
26-
juju deploy postgresql --channel edge
32+
juju deploy postgresql --channel 14/stable
2733
```
2834

29-
It is customary to use PostgreSQL with replication. Hence usually more than one unit (preferably an odd number to prohibit a "split-brain" scenario) is deployed. To deploy PostgreSQL with multiple replicas, specify the number of desired units with the `-n` option.
35+
It is customary to use PostgreSQL with replication to ensure high availability. A replica is equivalent to a juju unit.
36+
37+
To deploy PostgreSQL with multiple replicas, specify the number of desired units with the `-n` option:
3038

3139
```shell
32-
juju deploy postgresql --channel edge -n <number_of_units>
40+
juju deploy postgresql --channel 14/stable -n <number_of_units>
3341
```
3442

35-
To retrieve primary replica one can use the action `get-primary` on any of the units running PostgreSQL.
43+
To add replicas to an existing deployment, see the [Add replicas](#add-replicas) section.
44+
45+
>[!TIP]
46+
>It is generally recommended to have an odd number of units to avoid a "[split-brain](https://en.wikipedia.org/wiki/Split-brain_(computing))" scenario
47+
48+
### Primary replica
49+
To retrieve the primary replica, use the action `get-primary` on any of the units running PostgreSQL.
3650
```shell
37-
juju run-action postgresql/leader get-primary --wait
51+
juju run postgresql/leader get-primary
3852
```
3953

40-
Similarly, the primary replica is displayed as a status message in `juju status`, however one
41-
should note that this hook gets called on regular time intervals and the primary may be outdated if
42-
the status hook has not been called recently.
54+
Similarly, the primary replica is displayed as a status message in `juju status`. Note that this hook gets called at regular time intervals, so the primary may be outdated if the status hook has not been called recently.
4355

4456
### Replication
45-
#### Adding Replicas
57+
58+
#### Add replicas
4659

4760
To add more replicas one can use the `juju add-unit` functionality i.e.
4861
```shell
4962
juju add-unit postgresql -n <number_of_units_to_add>
5063
```
51-
The implementation of `add-unit` allows the operator to add more than one unit, but functions internally by adding one replica at a time, avoiding multiple replicas syncing from the primary at the same time.
64+
The implementation of `add-unit` allows the operator to add more than one unit, but functions internally by adding one replica at a time. This is done to avoid multiple replicas syncing from the primary at the same time.
5265

53-
#### Removing Replicas
66+
#### Remove replicas
5467

55-
Similarly to scale down the number of replicas the `juju remove-unit` functionality may be used i.e.
68+
To scale down the number of replicas the `juju remove-unit` functionality may be used i.e.
5669
```shell
57-
juju remove-unit postgresql <name_of_unit1> <name_of_unit2>
70+
juju remove-unit postgresql <name_of_unit_1> <name_of_unit_2>
5871
```
5972
The implementation of `remove-unit` allows the operator to remove more than one unit. The functionality of `remove-unit` functions by removing one replica at a time to avoid downtime.
6073

6174
### Password rotation
6275

6376
#### Charm users
6477

65-
For users used internally by the Charmed PostgreSQL Operator an action can be used to rotate their passwords.
78+
To rotate the password of users internal to the Charmed PostgreSQL operator, use the `set-password` action as follows:
6679
```shell
67-
juju run-action postgresql/leader set-password username=<username> password=<password> --wait
80+
juju run postgresql/leader set-password username=<user> password=<password>
6881
```
69-
Note: currently, the users used by the operator are `operator`, `replication`, `backup` and `rewind`. Those users should not be used outside the operator.
82+
>[!NOTE]
83+
>Currently, internal users are `operator`, `replication`, `backup` and `rewind`. These users should not be used outside the operator.
7084
71-
#### Related applications users
85+
#### Integrated (related) application users
7286

73-
To rotate the passwords of users created for related applications the relation should be removed and the application should be related again to the Charmed PostgreSQL Operator. That process will generate a new user and password for the application (removing the old user).
87+
To rotate the passwords of users created for integrated applications, the integration to Charmed PostgreSQL should be removed and re-created. This process will generate a new user and password for the application (and remove the old user).
7488

7589
## Integrations (Relations)
7690

77-
Supported [relations](https://juju.is/docs/olm/relations):
91+
Supported [integrations](https://juju.is/docs/olm/relations):
7892

7993
#### New `postgresql_client` interface:
8094

@@ -87,28 +101,28 @@ requires:
87101
interface: postgresql_client
88102
```
89103
90-
Please read usage documentation about
104+
Please read the usage documentation of the
91105
[data_interfaces](https://charmhub.io/data-platform-libs/libraries/data_interfaces) library for
92-
more information about how to enable PostgreSQL interface in your application.
106+
more information about how to enable a PostgreSQL interface in your application.
93107
94108
Relations to new applications are supported via the `postgresql_client` interface. To create a
95-
relation:
109+
relation to another application:
96110

97-
juju v2.x:
111+
juju `v2.x`:
98112

99113
```shell
100-
juju relate postgresql application
114+
juju relate postgresql <application_name>
101115
```
102116

103-
juju v3.x
117+
juju `v3.x`:
104118

105119
```shell
106-
juju integrate postgresql application
120+
juju integrate postgresql <application_name>
107121
```
108122

109123
To remove a relation:
110124
```shell
111-
juju remove-relation postgresql application
125+
juju remove-relation postgresql <application_name>
112126
```
113127

114128
#### Legacy `pgsql` interface:
@@ -120,29 +134,31 @@ juju relate postgresql:db-admin landscape-server
120134

121135
#### `tls-certificates` interface:
122136

123-
The Charmed PostgreSQL Operator also supports TLS encryption on internal and external connections. To enable TLS:
137+
The Charmed PostgreSQL Operator also supports TLS encryption on internal and external connections. Below is an example of enabling TLS with the [self-signed certificates charm](https://charmhub.io/self-signed-certificates).
124138

125139
```shell
126-
# Deploy the TLS Certificates Operator.
127-
juju deploy tls-certificates-operator --channel=edge
128-
# Add the necessary configurations for TLS.
129-
juju config tls-certificates-operator generate-self-signed-certificates="true" ca-common-name="Test CA"
140+
# Deploy the self-signed certificates TLS operator.
141+
juju deploy self-signed-certificates --config ca-common-name="Example CA"
142+
130143
# Enable TLS via relation.
131-
juju relate postgresql tls-certificates-operator
144+
juju integrate postgresql self-signed-certificates
145+
132146
# Disable TLS by removing relation.
133-
juju remove-relation postgresql tls-certificates-operator
147+
juju remove-relation postgresql self-signed-certificates
134148
```
135-
136-
Note: The TLS settings shown here are for self-signed-certificates, which are not recommended for production clusters. The TLS Certificates Operator offers a variety of configurations. Read more on the TLS Certificates Operator [here](https://charmhub.io/tls-certificates-operator).
149+
>[!WARNING]
150+
>The TLS settings shown here are for self-signed-certificates, which are not recommended for production clusters. See the guide [Security with X.509 certificates](https://charmhub.io/topics/security-with-x-509-certificates) for an overview of available certificates charms.
137151

138152
## Security
139-
Security issues in the Charmed PostgreSQL Operator can be reported through [LaunchPad](https://wiki.ubuntu.com/DebuggingSecurity#How%20to%20File). Please do not file GitHub issues about security issues.
153+
Security issues in the Charmed PostgreSQL Operator can be reported through [LaunchPad](https://wiki.ubuntu.com/DebuggingSecurity#How%20to%20File). Please do not use GitHub to submit security issues.
140154

141155
## Contributing
142-
Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines on enhancements to this charm following best practice guidelines, and [CONTRIBUTING.md](https://github.com/canonical/postgresql-operator/blob/main/CONTRIBUTING.md) for developer guidance.
156+
* For best practices on how to write and contribute to charms, see the [Juju SDK docs](https://juju.is/docs/sdk/how-to)
157+
* For more specific developer guidance for contributions to Charmed PostgreSQL, see the file [CONTRIBUTING.md](CONTRIBUTING.md)
158+
* Report security issues for the Charmed PostgreSQL Operator through [LaunchPad](https://wiki.ubuntu.com/DebuggingSecurity#How%20to%20File).
159+
* Report technical issues, bug reports and feature requests through the [GitHub Issues tab](https://github.com/canonical/postgresql-operator/issues).
143160

144-
## License
145-
The Charmed PostgreSQL Operator [is distributed](https://github.com/canonical/postgresql-operator/blob/main/LICENSE) under the Apache Software License, version 2.0. It installs/operates/depends on [PostgreSQL](https://www.postgresql.org/ftp/source/), which [is licensed](https://www.postgresql.org/about/licence/) under PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
161+
## Licensing and trademark
162+
The Charmed PostgreSQL Operator is distributed under the [Apache Software License, version 2.0](https://github.com/canonical/postgresql-operator/blob/main/LICENSE). It installs, operates and depends on [PostgreSQL](https://www.postgresql.org/ftp/source/), which is licensed under the [PostgreSQL License](https://www.postgresql.org/about/licence/), a liberal Open Source license similar to the BSD or MIT licenses.
146163

147-
## Trademark Notice
148164
PostgreSQL is a trademark or registered trademark of PostgreSQL Global Development Group. Other trademarks are property of their respective owners.

0 commit comments

Comments
 (0)