Skip to content

Commit 6fe46d1

Browse files
cognusiontimabbott
authored andcommitted
Add a section on updating postgresql to 14.
Tweaked and confirmed version of the galexrt section below it.
1 parent b1661d1 commit 6fe46d1

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,71 @@ repository, and `ZULIP_GIT_REF` to be any ref name in that repository
464464

465465
Then stop and restart the container as described in the previous section.
466466

467+
### Upgrading zulip/zulip-postgresql to 14
468+
469+
These instructions assume that you have not changed the default
470+
Postgres data path (`/opt/docker/zulip/postgresql/data`) in your
471+
`docker-compose.yml`. If you have changed it, please replace all
472+
occurences of `/opt/docker/zulip/postgresql/data` with your path.
473+
474+
1. Make a backup of your Zulip Postgres data dir.
475+
476+
2. Stop the Zulip container:
477+
478+
```
479+
docker-compose stop zulip
480+
```
481+
482+
3. Create a new (upgraded) Postgres container using a different data directory:
483+
484+
```
485+
docker run -d \
486+
--name postgresnew \
487+
-e POSTGRES_DB=zulip \
488+
-e POSTGRES_USER=zulip \
489+
-e POSTGRES_PASSWORD=zulip \
490+
-v /opt/docker/zulip/postgresql/new:/var/lib/postgresql/data:rw \
491+
zulip/zulip-postgresql:14
492+
```
493+
494+
4. Use `pg_dumpall` to dump all data from the existing Postgres container to the
495+
new Postgres container, and reset the password (for SCRAM-SHA-256 auth upgrade):
496+
497+
```
498+
docker-compose exec database pg_dumpall -U zulip | \
499+
docker exec -i postgresnew psql -U zulip
500+
501+
echo "ALTER USER zulip WITH PASSWORD 'REPLACE_WITH_SECURE_POSTGRES_PASSWORD';" |
502+
docker exec -i postgresnew psql -U zulip
503+
```
504+
505+
5. Stop and remove both Postgres containers:
506+
507+
```
508+
docker-compose rm --stop database
509+
docker stop postgresnew
510+
docker rm postgresnew
511+
```
512+
513+
6. Edit your `docker-compose.yml` to use the `zulip/zulip-postgresql:14` image
514+
for the `database` container.
515+
516+
7. Replace the old Postgres data directory with upgraded data directory:
517+
518+
```
519+
sudo mv /opt/docker/zulip/postgresql/data /opt/docker/zulip/postgresql/old
520+
sudo mv /opt/docker/zulip/postgresql/new /opt/docker/zulip/postgresql/data
521+
```
522+
523+
8. Start Zulip up again:
524+
525+
```
526+
docker-compose up
527+
```
528+
529+
That should be it. Your Postgres data has now been updated to use the
530+
`zulip/zulip-postgresql` image.
531+
467532
### Upgrading from the old galexrt/docker-zulip
468533

469534
If you are using an earlier version of `galexrt/docker-zulip` which

0 commit comments

Comments
 (0)