Skip to content

Commit df08976

Browse files
committed
Update for modern docker-compose.
1 parent 5ffcac8 commit df08976

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ sample configuration to run that Zulip server with each of the major
9595
[volumes]: https://docs.docker.com/storage/volumes/
9696
[persistent-data]: https://zulip.readthedocs.io/en/latest/production/export-and-import.html#backups
9797

98-
## Running a Zulip server with docker-compose
98+
## Running a Zulip server with `docker compose`
9999

100100
To use this project, we recommend starting by cloning the repository (since
101101
you'll want to edit the `docker-compose.yml` file in this project):
@@ -112,7 +112,7 @@ generate secrets and do some configuration.
112112

113113
### Configuration
114114

115-
With `docker-compose`, it is traditional to configure a service by
115+
With `docker compose`, it is traditional to configure a service by
116116
setting environment variables declared in the `zulip -> environment`
117117
section of the `docker-compose.yml` file; this image follows that
118118
convention.
@@ -251,12 +251,12 @@ can provide a `settings.py` file and a `zulip-secrets.conf` file in
251251
You can boot your Zulip installation with:
252252

253253
```
254-
docker-compose pull
255-
docker-compose up
254+
docker compose pull
255+
docker compose up
256256
```
257257

258258
This will boot the 5 containers declared in `docker-compose.yml`. The
259-
`docker-compose` command will print a bunch of output, and then
259+
`docker compose` command will print a bunch of output, and then
260260
eventually hang once everything is happily booted, usually ending with
261261
a bunch of lines like this:
262262

@@ -267,15 +267,15 @@ rabbitmq_1 | accepting AMQP connection <0.534.0> (172.18.0.3:49504
267267
```
268268

269269
You can inspect what containers are running in another shell with
270-
`docker-compose ps` (remember to `cd` into the `docker-zulip`
270+
`docker compose ps` (remember to `cd` into the `docker-zulip`
271271
directory first).
272272

273273
If you hit `Ctrl-C`, that will stop your Zulip server cluster. If
274274
you'd prefer to have the containers run in the background, you can use
275-
`docker-compose up -d`.
275+
`docker compose up -d`.
276276

277277
If you want to build the Zulip image yourself, you can do that by
278-
running `docker-compose build`; see also
278+
running `docker compose build`; see also
279279
[the documentation on building a custom Git version version](UPGRADING.md#upgrading-from-a-git-repository).
280280

281281
### Connecting to your Zulip server
@@ -296,8 +296,8 @@ You can now follow the normal Zulip installer instructions for how to
296296
new Zulip server. You'll generate the realm creation link as follows:
297297

298298
```bash
299-
docker-compose exec -u zulip zulip \
300-
"/home/zulip/deployments/current/manage.py generate_realm_creation_link"
299+
docker compose exec -u zulip zulip \
300+
/home/zulip/deployments/current/manage.py generate_realm_creation_link
301301
```
302302

303303
But don't forget to review the [getting started][next-steps] links at
@@ -313,10 +313,10 @@ The following are helpful examples:
313313

314314
```bash
315315
# Get a (root) shell in the container so you can access logs
316-
docker-compose exec zulip bash
316+
docker compose exec zulip bash
317317
# Run a Zulip management command
318-
docker-compose exec -u zulip zulip \
319-
"/home/zulip/deployments/current/manage.py list_realms"
318+
docker compose exec -u zulip zulip \
319+
/home/zulip/deployments/current/manage.py list_realms
320320
```
321321

322322
Since that process for running management commands is a pain, we recommend
@@ -353,7 +353,7 @@ instructions.
353353
A Kubernetes pod file is in the `kubernetes/` folder; you can run it
354354
with `kubectl create -f ./kubernetes/`.
355355

356-
You should read the `docker-compose` section above to understand how
356+
You should read the `docker compose` section above to understand how
357357
this works, since it's a very similar setup. You'll want to clone
358358
this repository, edit the `zulip-rc.yml` to configure the image, etc.
359359

@@ -405,7 +405,7 @@ in the Docker environment (`docker-compose.yml`).
405405
Common issues include:
406406

407407
- Invalid configuration resulting in the `zulip` container not
408-
starting; check `docker-compose ps` to see if it started, and then
408+
starting; check `docker compose ps` to see if it started, and then
409409
read the logs for the Zulip container to see why it failed.
410410
- A new Zulip setting not being passed through the Docker
411411
[entrypoint.sh script](/entrypoint.sh) properly. If you

UPGRADING.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Upgrading instructions for `docker-compose`
1+
# Upgrading instructions for `docker compose`
22

33
You can upgrade your Zulip installation to any newer version of Zulip with the
44
following instructions. At a high level, the strategy is to download a new
@@ -58,18 +58,18 @@ All of the instructions below assume you are using the provided
5858
5959
```shell
6060
# Stops the old zulip container; this begins your downtime
61-
docker-compose stop
61+
docker compose stop
6262
# Boots the new zulip container; this ends your downtime
63-
docker-compose up
63+
docker compose up
6464
# Deletes the old container images
65-
docker-compose rm
65+
docker compose rm
6666
```
6767

6868
That's it! Zulip is now running the updated version.
6969
You can confirm you're running the latest version by running:
7070

7171
```shell
72-
docker-compose exec -u zulip zulip cat /home/zulip/deployments/current/version.py
72+
docker compose exec -u zulip zulip cat /home/zulip/deployments/current/version.py
7373
```
7474

7575
## Upgrading from a Git repository
@@ -92,7 +92,7 @@ docker-compose exec -u zulip zulip cat /home/zulip/deployments/current/version.p
9292
and `ZULIP_GIT_REF` to be any ref name in that repository (e.g. `main` or
9393
`1.9.0` or `445932cc8613c77ced023125248c8b966b3b7528`).
9494

95-
2. Run `docker-compose build zulip` to build a Zulip Docker image from the
95+
2. Run `docker compose build zulip` to build a Zulip Docker image from the
9696
specified Git version.
9797

9898
Then stop and restart the container as described in the previous section.
@@ -110,7 +110,7 @@ If you elect to switch to managed Docker volumes, you can copy the data out of
110110

111111
```shell
112112
# Stop the containers
113-
docker-compose stop
113+
docker compose stop
114114
115115
# Copy the data into new managed volumes:
116116
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' ; }
@@ -124,13 +124,13 @@ zulip_volume_sync redis
124124
$EDITOR docker-compose.yml
125125

126126
# Start the containers again
127-
docker-compose start
127+
docker compose start
128128
```
129129

130130
## Upgrading zulip/zulip-postgresql to 14 (version 6.0-0 and above)
131131

132132
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
133+
`docker compose.yml` configuration uses, from PostgreSQL 10 (which is no longer
134134
supported) to PostgreSQL 14. Because the on-disk storage is not compatible
135135
between PostgreSQL versions, this requires more than simply switching which
136136
PostgreSQL docker image is used — the data must be dumped from PostgreSQL 10,
@@ -149,9 +149,9 @@ You can perform this step either before or after updating to use Docker volumes
149149
(above). In either case, the updated `docker-compose.yml` will use a new Docker
150150
volume for the upgraded PostgreSQL 14 data.
151151

152-
The `upgrade-postgresql` tool requires `docker-compose` 2.1.1 or higher.
152+
The `upgrade-postgresql` tool requires `docker compose` 2.1.1 or higher.
153153

154-
If the tool does not work, you have too old a `docker-compose`, or you would
154+
If the tool does not work, you have too old a `docker compose`, or you would
155155
prefer to perform the steps manually, see the steps below. These instructions
156156
assume that you have not changed the default Postgres data path
157157
(`/opt/docker/zulip/postgresql/data`) in your `docker-compose.yml`. If you have
@@ -163,7 +163,7 @@ changed it, please replace all occurrences of
163163
2. Stop the Zulip container:
164164

165165
```shell
166-
docker-compose stop zulip
166+
docker compose stop zulip
167167
```
168168

169169
3. Create a new (upgraded) Postgres container using a different data directory:
@@ -183,7 +183,7 @@ changed it, please replace all occurrences of
183183
upgrade):
184184

185185
```shell
186-
docker-compose exec database pg_dumpall -U zulip | \
186+
docker compose exec database pg_dumpall -U zulip | \
187187
docker exec -i postgresnew psql -U zulip
188188

189189
echo "ALTER USER zulip WITH PASSWORD 'REPLACE_WITH_SECURE_POSTGRES_PASSWORD';" |
@@ -193,7 +193,7 @@ changed it, please replace all occurrences of
193193
5. Stop and remove both Postgres containers:
194194

195195
```shell
196-
docker-compose rm --stop database
196+
docker compose rm --stop database
197197
docker stop postgresnew
198198
docker rm postgresnew
199199
```
@@ -207,7 +207,7 @@ changed it, please replace all occurrences of
207207

208208
8. Start Zulip up again:
209209
```shell
210-
docker-compose up
210+
docker compose up
211211
```
212212

213213
## Upgrading from the old galexrt/docker-zulip
@@ -225,7 +225,7 @@ have changed it, please replace all occurences of
225225
1. Make a backup of your Zulip PostgreSQL data directory.
226226

227227
2. Stop all Zulip containers, except the postgres one (e.g. use `docker stop`
228-
and not `docker-compose stop`).
228+
and not `docker compose stop`).
229229

230230
3. Create a new (upgraded) PostgreSQL container using a different data
231231
directory:
@@ -244,14 +244,14 @@ have changed it, please replace all occurences of
244244
the new PostgreSQL container:
245245

246246
```shell
247-
docker-compose exec database pg_dumpall -U postgres | \
247+
docker compose exec database pg_dumpall -U postgres | \
248248
docker exec -i postgresnew psql -U postgres
249249
```
250250

251251
5. Stop and remove both PostgreSQL containers:
252252

253253
```shell
254-
docker-compose rm --stop database
254+
docker compose rm --stop database
255255
docker rm --stop postgresnew
256256
```
257257

@@ -269,11 +269,11 @@ have changed it, please replace all occurences of
269269
8. Delete the old existing containers:
270270

271271
```shell
272-
docker-compose rm
272+
docker compose rm
273273
```
274274

275275
9. Start Zulip up again:
276276

277277
```shell
278-
docker-compose up
278+
docker compose up
279279
```

custom_zulip_files/README.custom_zulip_files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ As an example, if you want to test a change to
77
`scripts/setup/generate-self-signed-cert`, you would grab a copy of
88
the script from zulip/zulip, place it at
99
`custom_zulip_files/scripts/setup/generate-self-signed-cert`, make
10-
your local edits, and then run `docker-compose build`.
10+
your local edits, and then run `docker compose build`.

upgrade-postgresql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ if ! command -v yq >/dev/null; then
99
exit 1
1010
fi
1111

12-
# Require docker-compose 2.1.1 or higher, for `docker-compose up --wait`
13-
docker_compose_version=$(docker-compose --version --short)
12+
# Require docker compose 2.1.1 or higher, for `docker compose up --wait`
13+
docker_compose_version=$(docker compose --version --short)
1414
if [ "${docker_compose_version}" = "$(echo -e "2.1.0\n${docker_compose_version}" | sort -V | head -n1)" ]; then
15-
echo "Your docker-compose is too old (${docker_compose_version}); upgrade to at least 2.1.1."
15+
echo "Your docker compose is too old (${docker_compose_version}); upgrade to at least 2.1.1."
1616
exit 1
1717
fi
1818

@@ -38,7 +38,7 @@ if [ "$new_version" -eq "$old_version" ]; then
3838
fi
3939

4040
# Create a new volume for the data; scope it with the current
41-
# directory, like docker-compose
41+
# directory, like docker compose
4242
docker_compose_project="$(basename "$(pwd)")"
4343
new_volume="postgresql-$new_version"
4444
full_new_volume="${docker_compose_project}_${new_volume}"
@@ -71,16 +71,16 @@ while [ "$(docker inspect --format='{{json .State.Health.Status}}' "$temp_contai
7171
done
7272

7373
# Ensure database is running
74-
docker-compose up --wait database
74+
docker compose up --wait database
7575

7676
# Stop the zulip processes which talk to the database
77-
zulip_is_running=$(docker-compose ps --filter status=running --services | grep zulip || true)
77+
zulip_is_running=$(docker compose ps --filter status=running --services | grep zulip || true)
7878
if [ -n "$zulip_is_running" ]; then
79-
docker-compose stop zulip
79+
docker compose stop zulip
8080
fi
8181

8282
# Transfer the data to the new container
83-
docker-compose exec database pg_dumpall -U zulip |
83+
docker compose exec database pg_dumpall -U zulip |
8484
docker exec -i "$temp_container" psql -U zulip
8585

8686
if [ "$old_version" -eq "10" ]; then
@@ -92,7 +92,7 @@ if [ "$old_version" -eq "10" ]; then
9292
fi
9393

9494
# Stop the running database
95-
docker-compose rm --force --stop database
95+
docker compose rm --force --stop database
9696

9797
# Stop the temporary PostgreSQL container
9898
docker stop "$temp_container"
@@ -105,6 +105,6 @@ VOLUME="$new_volume:/var/lib/postgresql/data:rw" yq -i '.services.database.volum
105105
VOLUME="$new_volume" yq -i 'with(.volumes.[strenv(VOLUME)]; . = "" | . tag="!!null")' docker-compose.yml
106106

107107
# Restart zulip, and the new database container
108-
docker-compose up --wait
108+
docker compose up --wait
109109

110110
echo "Old data from PostgreSQL $old_version is available in $old_mountpoint"

0 commit comments

Comments
 (0)