Skip to content

Commit 53de96e

Browse files
committed
UPGRADING: Document managed-volume and PostgreSQL upgrades.
This returns the manual steps for upgrading PostgreSQL which were removed in cd348fb, and documents the steps required to move a docker-compose deploy to using Docker-managed volumes.
1 parent 86f0556 commit 53de96e

File tree

1 file changed

+105
-13
lines changed

1 file changed

+105
-13
lines changed

UPGRADING.md

Lines changed: 105 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,111 @@ docker-compose exec -u zulip zulip cat /home/zulip/deployments/current/version.p
9797

9898
Then stop and restart the container as described in the previous section.
9999

100-
## Upgrading zulip/zulip-postgresql to 14
101-
102-
The Docker Compose configuration for version 6.0-0 and higher default to using
103-
PostgreSQL 14, as the previously-used PostgreSQL 10 is no longer
104-
supported. Because the data is specific to the version of PostgreSQL which is
105-
running, it must be dumped and re-loaded into a new volume to
106-
upgrade. PostgreSQL 14 will refuse to start if provided with un-migrated data
107-
from PostgreSQL 10.
108-
109-
The provided `upgrade-postgresql` tool will dump the contents of the
110-
`postgresql` image's volume, create a new PostgreSQL 14 volume, perform the
111-
necessary migration, update the `docker-compose.yml` file to match, and re-start
112-
Zulip.
100+
## Upgrading to use Docker volumes (version 6.0-0 and above)
101+
102+
As of Docker Zulip 6.0-0, we have switched the volume storage from being in
103+
directories under `/opt/docker/zulip/` on the Docker host system, to using named
104+
Docker managed volumes. In your `docker-compose.yml`, you should either preserve
105+
the previous `/opt/docker/zulip/` paths for your volumes, or migrate the
106+
contents to individual Docker volumes.
107+
108+
If you elect to switch to managed Docker volumes, you can copy the data out of
109+
`/opt/docker/zulip` and onto managed volumes using the following:
110+
111+
```shell
112+
# Stop the containers
113+
docker-compose stop
114+
115+
# Copy the data into new managed volumes:
116+
zulip_volume_sync() { docker run -it --rm -v "/opt/docker/zulip/$1:/src" -v "$(basename "$(pwd)")_${2:$1}":/dst ubuntu:20.04 sh -c 'cd /src; cp -a . /dst' ; }
117+
zulip_volume_sync postgresql postgresql-10
118+
zulip_volume_sync zulip
119+
zulip_volume_sync rabbitmq
120+
zulip_volume_sync redis
121+
122+
# Edit your `docker-compose.yml` to use, e.g. `postgresql-10:/var/lib/postgresql/data:rw`
123+
# rather than `/opt/docker/zulip/postgresql/data:/var/lib/postgresql/data:rw` as a volume.
124+
$EDITOR docker-compose.yml
125+
126+
# Start the containers again
127+
docker-compose start
128+
```
129+
130+
## Upgrading zulip/zulip-postgresql to 14 (version 6.0-0 and above)
131+
132+
As of Docker Zulip 6.0-0, we have upgraded the version of PostgreSQL which our
133+
docker-compose configuration uses, from PostgreSQL 10 (which is no longer
134+
supported) to PostgreSQL 14. Because the on-disk storage is not compatible
135+
between PostgreSQL versions, this requires more than simply switching which
136+
PostgreSQL docker image is used — the data must be dumped from PostgreSQL 10,
137+
and imported into a running PostgreSQL 14.
138+
139+
You should not adjust the `image` of the database when upgrading to Zulip Server
140+
6.0.
141+
142+
After upgrading the `zulip` service, using the usual steps, to the
143+
`zulip/docker-zulip:6.0-0` tag, you can upgrade the PostgreSQL image version by
144+
running the included `./upgrade-postgresql` tool. This will create a
145+
Docker-managed volume named `postgresql-14` to store its data, and will adjust
146+
the `docker-compose.yml` file to use that.
147+
148+
If the tool does not work, or you would prefer to perform the steps manually,
149+
see the steps below. These instructions assume that you have not changed the
150+
default Postgres data path (`/opt/docker/zulip/postgresql/data`) in your
151+
`docker-compose.yml`. If you have changed it, please replace all occurrences of
152+
`/opt/docker/zulip/postgresql/data` with your path, or volume.
153+
154+
1. Make a backup of your Zulip Postgres data directory.
155+
156+
2. Stop the Zulip container:
157+
158+
```shell
159+
docker-compose stop zulip
160+
```
161+
162+
3. Create a new (upgraded) Postgres container using a different data directory:
163+
164+
```shell
165+
docker run -d \
166+
--name postgresnew \
167+
-e POSTGRES_DB=zulip \
168+
-e POSTGRES_USER=zulip \
169+
-e POSTGRES_PASSWORD=zulip \
170+
-v "$(basename "$(pwd)")_postgresql-14:/var/lib/postgresql/data:rw" \
171+
zulip/zulip-postgresql:14
172+
```
173+
174+
4. Use `pg_dumpall` to dump all data from the existing Postgres container to the
175+
new Postgres container, and reset the password (for SCRAM-SHA-256 auth
176+
upgrade):
177+
178+
```shell
179+
docker-compose exec database pg_dumpall -U zulip | \
180+
docker exec -i postgresnew psql -U zulip
181+
182+
echo "ALTER USER zulip WITH PASSWORD 'REPLACE_WITH_SECURE_POSTGRES_PASSWORD';" |
183+
docker exec -i postgresnew psql -U zulip
184+
```
185+
186+
5. Stop and remove both Postgres containers:
187+
188+
```shell
189+
docker-compose rm --stop database
190+
docker stop postgresnew
191+
docker rm postgresnew
192+
```
193+
194+
6. Edit your `docker-compose.yml` to use the `zulip/zulip-postgresql:14` image
195+
for the `database` container.
196+
197+
7. Edit your `docker-compose.yml` to provide
198+
`postgresql-14:/var/lib/postgresql/data:rw` as the `volume` for the
199+
`database` service.
200+
201+
8. Start Zulip up again:
202+
```shell
203+
docker-compose up
204+
```
113205

114206
## Upgrading from the old galexrt/docker-zulip
115207

0 commit comments

Comments
 (0)