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
Copy file name to clipboardExpand all lines: Services/PostgreSQL.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
### Creating the directories to store the PostgreSQL data and the PostgreSQL environment variables
14
14
15
15
*Unless you're okay using the default values, you'll need to specify the database name, database user and database user's password in the docker run command. Needless to say that those information are sensitive... The recommended way to treat sensitive information in a docker run command are [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) but, unfortunately, Docker Secrets can only be used with [Docker Swarm](https://www.sumologic.com/glossary/docker-swarm/) (which I don't use myself).*
16
-
*So, in order to avoid typing those information as plain text in the docker run command, I'm going to create my own (kind of) secret files inside the 'env' directory that contains those information. For security reasons, those files will only be viewable and editable by the root account, obviously.*
16
+
*So, in order to avoid typing those information as plain text in the docker run command, I'm going to create my own (kind of) secret files inside the 'env' directory that contains those information. For security reasons, those files will only be readable and editable by the root account, obviously.*
Upgrading postgres from one major version to another isn't a transparent operation
49
+
Upgrading postgres from one major version to another isn't a straightforward operation
50
50
51
51
New major releases come with structure changes that imply a manual intervention for a seamingless update.
52
52
Also, you want to make sure the application using your postgres database is compatible with the new major postgres release yet before upgrading.
@@ -55,8 +55,11 @@ As such, I advise you to **not** use the `latest` tag but to point to an explici
55
55
56
56
See [Upgrade postgres from one major release to another](#upgrade-postgres-from-one-major-release-to-another) for more details.
57
57
58
+
**Important note:** Since PostgreSQL >= 18, the volume for the databases data is expected to point to `/var/lib/postgresql` within the container (as opposed to `/var/lib/postgresql/data` with < 18). If you're aiming at deploying a container for PostgreSQL < 18, change the mount point accordingly in the below commands. Make sure to also take this path change into account when upgrading from PostgreSQL < 18 to >= 18.
59
+
See https://github.com/docker-library/postgres/pull/1259 for more details.
@@ -125,15 +128,15 @@ Since we use Docker, the update and upgrade procedure is actually the same as it
125
128
(... to check if there's available updates)
126
129
127
130
```bash
128
-
sudo docker pull postgres:15# Adapt the tag to the one you're currently using
131
+
sudo docker pull postgres:18# Adapt the tag to the one you're currently using
129
132
```
130
133
131
134
### Apply the update
132
135
133
136
```bash
134
137
sudo docker stop postgres
135
138
sudo docker rm postgres
136
-
sudo docker run -d --name postgres -p 5432:5432 -e POSTGRES_USER=$(sudo cat /opt/postgres/env/user) -e POSTGRES_PASSWORD=$(sudo cat /opt/postgres/env/password) -e POSTGRES_DB=$(sudo cat /opt/postgres/env/database) -v /opt/postgres/data:/var/lib/postgresql/data --restart=unless-stopped postgres:15 # Adapt the tag to the one you're currently using
139
+
sudo docker run -d --name postgres -p 5432:5432 -e POSTGRES_USER=$(sudo cat /opt/postgres/env/user) -e POSTGRES_PASSWORD=$(sudo cat /opt/postgres/env/password) -e POSTGRES_DB=$(sudo cat /opt/postgres/env/database) -v /opt/postgres/data:/var/lib/postgresql --restart=unless-stopped postgres:15 # Adapt the tag to the one you're currently using
0 commit comments