You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update pg_tde docker topic with proper parameters based on user feedback (#802)
* 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.
* small fix
fixed name of step 5 and a small link fix
* Update docker.md
updated parameters with correct ones and also removed $ signs so users can actually copy paste the commands properly in cli
Copy file name to clipboardExpand all lines: docs/docker.md
+33-37Lines changed: 33 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Docker images of Percona Distribution for PostgreSQL are hosted publicly on [Doc
4
4
5
5
For more information about using Docker, see the [Docker Docs :octicons-link-external-16:](https://docs.docker.com/).
6
6
7
-
!!! note ""
7
+
!!! note
8
8
9
9
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.
10
10
@@ -34,94 +34,90 @@ For more information about using Docker, see the [Docker Docs :octicons-link-ext
34
34
1. Start a Percona Distribution for PostgreSQL container as follows:
35
35
36
36
```{.bash data-prompt="$"}
37
-
$ docker run --name container-name -e POSTGRES_PASSWORD=secret -d percona/percona-distribution-postgresql:{{dockertag}}
38
-
```
37
+
docker run --name container-name -e POSTGRES_PASSWORD=secret -d percona/percona-distribution-postgresql:{{dockertag}}
38
+
```
39
39
40
-
Where:
40
+
Where:
41
41
42
42
*`container-name` is the name you assign to your container
43
43
*`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/).
46
45
47
-
!!! tip
46
+
!!! tip
48
47
49
48
You can secure the password by exporting it to the environment file and using that to start the container.
50
49
51
50
1. Export the password to the environment file:
52
51
53
52
```{.bash data-prompt="$"}
54
-
$ echo"POSTGRES_PASSWORD=secret"> .my-pg.env
53
+
echo"POSTGRES_PASSWORD=secret"> .my-pg.env
55
54
```
56
55
57
56
2. Start the container:
58
57
59
58
```{.bash data-prompt="$"}
60
-
$ docker run --name container-name --env-file ./.my-pg.env -d percona/percona-distribution-postgresql:{{dockertag}}
59
+
docker run --name container-name --env-file ./.my-pg.env -d percona/percona-distribution-postgresql:{{dockertag}}
61
60
```
62
61
63
-
2. Connect to the container's interactive terminal:
62
+
2. Connect to the container's interactive terminal:
64
63
65
64
```{.bash data-prompt="$"}
66
-
$ docker exec -it container-name bash
65
+
docker exec -it container-name bash
67
66
```
68
67
69
68
The `container-name` is the name of the container that you started in the previous step.
70
69
71
-
72
70
## Connect to Percona Distribution for PostgreSQL from an application in another Docker container
73
71
74
72
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:
75
73
76
74
```{.bash data-prompt="$"}
77
-
$ docker run --name app-container-name --network container:container-name -d app-that-uses-postgresql
75
+
docker run --name app-container-name --network container:container-name -d app-that-uses-postgresql
78
76
```
79
77
80
78
where:
81
79
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
84
82
* `app-that-uses-postgresql` is the name of your PostgreSQL client.
85
83
86
84
## Connect to Percona Distribution for PostgreSQL from the `psql` command line client
87
85
88
86
The following command starts another container instance and runs the `psql` command line client against your original container, allowing you to execute SQL statements against your database:
* `db-container-name` is the name of your database container
97
95
* `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.
100
98
101
99
## Enable encryption
102
100
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).
104
102
105
-
Here's how to do this:
106
-
{.power-number}
103
+
Follow these steps to enable `pg_tde`:
107
104
108
105
1. Start the container with the `ENABLE_PG_TDE=1` environment variable:
docker run --name container-name -e ENABLE_PG_TDE=1 -e POSTGRES_PASSWORD=sUpers3cRet -d percona/percona-distribution-postgresql:{{dockertag}}
112
109
```
113
110
114
111
where:
115
-
112
+
116
113
* `container-name` is the name you assign to your container
117
114
* `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
120
116
121
117
2. Connect to the container and start the interactive `psql` session:
122
118
123
119
```{.bash data-prompt="$"}
124
-
$ docker exec -it container-name psql
120
+
docker exec -it container-name psql
125
121
```
126
122
127
123
??? example "Sample output"
@@ -139,23 +135,24 @@ Here's how to do this:
139
135
CREATE EXTENSION pg_tde;
140
136
```
141
137
142
-
4. Configure a key provider. In this sample configuration intended fortesting 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.
143
139
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.
145
142
146
143
<i warning>:material-information: Warning:</i> This example is for testing purposes only:
The key is autogenerated. You are ready to use data encryption.
155
+
The key is auto-generated. You are ready to use data encryption.
159
156
160
157
6. Create a table with encryption enabled. Pass the `USING tde_heap` clause to the `CREATE TABLE` command:
161
158
@@ -167,7 +164,7 @@ Here's how to do this:
167
164
168
165
To enable the `pg_stat_monitor` extension after launching the container, do the following:
169
166
170
-
* connect to the server,
167
+
* connect to the server,
171
168
* select the desired database and enable the `pg_stat_monitor` view for that database:
172
169
173
170
```sql
@@ -180,7 +177,7 @@ To enable the `pg_stat_monitor` extension after launching the container, do the
180
177
\d pg_stat_monitor;
181
178
```
182
179
183
-
??? example "Output"
180
+
??? example "Output"
184
181
185
182
```
186
183
View "public.pg_stat_monitor"
@@ -228,6 +225,5 @@ To enable the `pg_stat_monitor` extension after launching the container, do the
228
225
wait_event_type | text | | |
229
226
```
230
227
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