Skip to content

Commit a976b48

Browse files
committed
updated docker
updated with up to date information for pg_tde encryption parameters, also, cleaned the document a bit, added a paragraph recommending the user to see the pg_tde docs, added a note bolding the fact that we do not recommend using a local keyring file and we suggest using an external KMS.
1 parent 6c26a5b commit a976b48

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

docs/docker.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Docker images of Percona Distribution for PostgreSQL are hosted publicly on [Doc
44

55
For more information about using Docker, see the [Docker Docs :octicons-link-external-16:](https://docs.docker.com/).
66

7-
!!! note ""
7+
!!! note
88

99
Make sure that you are using [the latest version of Docker :octicons-link-external-16:](https://docs.docker.com/get-docker/). The ones provided via `apt` and `yum` may be outdated and cause errors.
1010

@@ -35,16 +35,15 @@ For more information about using Docker, see the [Docker Docs :octicons-link-ext
3535

3636
```{.bash data-prompt="$"}
3737
$ docker run --name container-name -e POSTGRES_PASSWORD=secret -d percona/percona-distribution-postgresql:{{dockertag}}
38-
```
38+
```
3939

40-
Where:
40+
Where:
4141

4242
* `container-name` is the name you assign to your container
4343
* `POSTGRES_PASSWORD` is the superuser password
44-
* `{{dockertag}}` is the tag specifying the version you need. Docker identifies the architecture (x86_64 or ARM64) and pulls the respective image. See the [full list of tags :octicons-link-external-16:](https://hub.docker.com/r/percona/percona-distribution-postgresql/tags/).
45-
44+
* `{{dockertag}}` is the tag specifying the version you need. Docker identifies the architecture (x86_64 or ARM64) and pulls the respective image. See the [full list of tags :octicons-link-external-16:](https://hub.docker.com/r/percona/percona-distribution-postgresql/tags/).
4645

47-
!!! tip
46+
!!! tip
4847

4948
You can secure the password by exporting it to the environment file and using that to start the container.
5049

@@ -60,15 +59,14 @@ For more information about using Docker, see the [Docker Docs :octicons-link-ext
6059
$ docker run --name container-name --env-file ./.my-pg.env -d percona/percona-distribution-postgresql:{{dockertag}}
6160
```
6261

63-
2. Connect to the container's interactive terminal:
62+
2. Connect to the container's interactive terminal:
6463
6564
```{.bash data-prompt="$"}
6665
$ docker exec -it container-name bash
6766
```
6867
6968
The `container-name` is the name of the container that you started in the previous step.
7069
71-
7270
## Connect to Percona Distribution for PostgreSQL from an application in another Docker container
7371
7472
This image exposes the standard PostgreSQL port (`5432`), so container linking makes the instance available to other containers. Start other containers like this in order to link it to the Percona Distribution for PostgreSQL container:
@@ -79,8 +77,8 @@ $ docker run --name app-container-name --network container:container-name -d app
7977
8078
where:
8179
82-
* `app-container-name` is the name of the container where your application is running,
83-
* `container name` is the name of your Percona Distribution for PostgreSQL container, and
80+
* `app-container-name` is the name of the container where your application is running,
81+
* `container name` is the name of your Percona Distribution for PostgreSQL container, and
8482
* `app-that-uses-postgresql` is the name of your PostgreSQL client.
8583
8684
## Connect to Percona Distribution for PostgreSQL from the `psql` command line client
@@ -95,15 +93,14 @@ Where:
9593
9694
* `db-container-name` is the name of your database container
9795
* `container-name` is the name of your container that you will use to connect to the database container using the `psql` command line client
98-
* `{{dockertag}}` is the tag specifying the version you need. Docker identifies the architecture (x86_64 or ARM64) and pulls the respective image.
99-
* `address` is the network address where your database container is running. Use 127.0.0.1, if the database container is running on the local machine/host.
96+
* `{{dockertag}}` is the tag specifying the version you need. Docker identifies the architecture (x86_64 or ARM64) and pulls the respective image.
97+
* `address` is the network address where your database container is running. Use 127.0.0.1, if the database container is running on the local machine/host.
10098
10199
## Enable encryption
102100
103-
Percona Distribution for PostgreSQL Docker image includes the `pg_tde` extension to provide data encryption. You must explicitly enable it when you start the container.
101+
Percona Distribution for PostgreSQL Docker image includes the `pg_tde` extension to provide data encryption. You must explicitly enable it when you start the container. For more information, see the [`pg_tde` documentation](https://docs.percona.com/pg-tde/index.html).
104102
105-
Here's how to do this:
106-
{.power-number}
103+
Follow these steps to enable `pg_tde`:
107104
108105
1. Start the container with the `ENABLE_PG_TDE=1` environment variable:
109106
@@ -112,11 +109,10 @@ Here's how to do this:
112109
```
113110
114111
where:
115-
112+
116113
* `container-name` is the name you assign to your container
117114
* `ENABLE_PG_TDE=1` adds the `pg_tde` to the `shared_preload_libraries` and enables the custom storage manager
118-
* `POSTGRES_PASSWORD` is the superuser password
119-
115+
* `POSTGRES_PASSWORD` is the superuser password
120116
121117
2. Connect to the container and start the interactive `psql` session:
122118
@@ -139,20 +135,21 @@ Here's how to do this:
139135
CREATE EXTENSION pg_tde;
140136
```
141137
142-
4. Configure a key provider. In this sample configuration intended for testing and development purpose, we use a local keyring provider.
138+
4. Configure a key provider with a keyring file. This setup is intended for development and stores the keys unencrypted in the specified data file. The below sample configuration is intended for testing and development purposes.
143139
144-
For production use, set up an external key management store and configure an external key provider. Refer to the [Setup :octicons-link-external-16:](https://docs.percona.com/pg-tde/setup.html#key-provider-configuration) chapter in the `pg_tde` documentation.
140+
!!! note
141+
For production use, we **strongly recommend** setting up an external key management store and configure an external key provider. Refer to the [Setup :octicons-link-external-16:](https://docs.percona.com/pg-tde/setup.html#key-provider-configuration) topic in the `pg_tde` documentation.
145142
146143
<i warning>:material-information: Warning:</i> This example is for testing purposes only:
147144
148145
```sql
149-
SELECT pg_tde_add_key_provider_file('file-keyring','/tmp/pg_tde_test_local_keyring.per');
146+
SELECT pg_tde_add_database_key_provider_file('provider-name','/path/to/the/keyring/data.file');
150147
```
151148
152149
5. Add a principal key
153150
154151
```sql
155-
SELECT pg_tde_set_principal_key('test-db-master-key','file-keyring');
152+
SELECT pg_tde_set_key_using_database_key_provider('name-of-the-key', 'provider-name','ensure_new_key');
156153
```
157154
158155
The key is autogenerated. You are ready to use data encryption.
@@ -180,7 +177,7 @@ To enable the `pg_stat_monitor` extension after launching the container, do the
180177
\d pg_stat_monitor;
181178
```
182179
183-
??? example "Output"
180+
??? example "Output"
184181
185182
```
186183
View "public.pg_stat_monitor"
@@ -228,6 +225,5 @@ To enable the `pg_stat_monitor` extension after launching the container, do the
228225
wait_event_type | text | | |
229226
```
230227
231-
Note that the `pg_stat_monitor` view is available only for the databases where you enabled it. If you create a new database, make sure to create the view for it to see its statistics data.
232-
233-
228+
!!! note
229+
The `pg_stat_monitor` view is available only for the databases where you enabled it. If you create a new database, make sure to create the view for it to see its statistics data.

0 commit comments

Comments
 (0)