Skip to content

Commit 74aea02

Browse files
adarshpkalexmv
andcommitted
docker-compose: Switch to docker managed volumes.
Docker-managed volumes[^1] are more cross-platform compatible than hard-coded paths, and will work even if the Docker user cannot write to the arbitrary path of `/opt/docker/zulip` on the Docker host. [^1]: https://docs.docker.com/storage/volumes/ Co-authored-by: Alex Vandiver <[email protected]>
1 parent 24678b6 commit 74aea02

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,14 @@ written to the image's filesystem is lost). To handle persistent
5555
state that needs to persist after the Docker equivalent of a reboot or
5656
upgrades (like uploaded files or the Zulip database), container
5757
systems let you configure certain directories inside the container
58-
from the host system's filesystem.
59-
60-
For example, this project's `docker-compose.yml` configuration file
61-
specifies a set of volumes where
62-
[persistent Zulip data][persistent-data] should be stored under
63-
`/opt/docker/zulip/` in the container host's file system:
64-
65-
* `/opt/docker/zulip/postgresql/data/` has the postgres container's
66-
persistent storage (i.e. the database).
67-
* `/opt/docker/zulip/zulip/` has the application server container's
68-
persistent storage, including the secrets file, uploaded files,
69-
etc.
70-
71-
This approach of mounting `/opt/docker` into the container is the
72-
right model if you're hosting your containers from a single host
73-
server, which is how `docker-compose` is intended to be used. If
74-
you're using Kubernetes, Docker Swarm, or another cloud container
75-
service, then these persistent storage volumes are typically
76-
configured to be network block storage volumes (e.g. an Amazon EBS
77-
volume) so that they can be mounted from any server within the
78-
cluster.
79-
80-
What this means is that if you're using `docker-zulip` in production
81-
with `docker-compose`, you'll want to configure your backup system to
82-
do backups on the `/opt/docker/zulip` directory, in order to ensure
83-
you don't lose data.
58+
from the host.
8459

60+
This project's `docker-compose.yml` configuration file uses [Docker managed
61+
volumes][volumes] to store [persistent Zulip data][persistent-data]. If you use
62+
the Docker Compose deployment, you should make sure that Zulip's volumes are
63+
backed up, to ensure that Zulip's data is backed up.
64+
65+
[volumes]: https://docs.docker.com/storage/volumes/
8566
[persistent-data]: https://zulip.readthedocs.io/en/latest/production/maintain-secure-upgrade.html#backups
8667

8768
## Prerequisites

docker-compose.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
# the first time on a host. Instructions are available in README.md.
1212
POSTGRES_PASSWORD: "REPLACE_WITH_SECURE_POSTGRES_PASSWORD"
1313
volumes:
14-
- "/opt/docker/zulip/postgresql/data:/var/lib/postgresql/data:rw"
14+
- "postgresql-10:/var/lib/postgresql/data:rw"
1515
memcached:
1616
image: "memcached:alpine"
1717
restart: unless-stopped
@@ -34,7 +34,7 @@ services:
3434
RABBITMQ_DEFAULT_USER: "zulip"
3535
RABBITMQ_DEFAULT_PASS: "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD"
3636
volumes:
37-
- "/opt/docker/zulip/rabbitmq:/var/lib/rabbitmq:rw"
37+
- "rabbitmq:/var/lib/rabbitmq:rw"
3838
redis:
3939
image: "redis:alpine"
4040
restart: unless-stopped
@@ -47,7 +47,7 @@ services:
4747
environment:
4848
REDIS_PASSWORD: "REPLACE_WITH_SECURE_REDIS_PASSWORD"
4949
volumes:
50-
- "/opt/docker/zulip/redis:/data:rw"
50+
- "redis:/data:rw"
5151
zulip:
5252
image: "zulip/docker-zulip:5.7-0"
5353
restart: unless-stopped
@@ -90,8 +90,13 @@ services:
9090
# Uncomment this when configuring the mobile push notifications service
9191
# SETTING_PUSH_NOTIFICATION_BOUNCER_URL: 'https://push.zulipchat.com'
9292
volumes:
93-
- "/opt/docker/zulip/zulip:/data:rw"
93+
- "zulip:/data:rw"
9494
ulimits:
9595
nofile:
9696
soft: 1000000
9797
hard: 1048576
98+
volumes:
99+
zulip:
100+
postgresql-10:
101+
rabbitmq:
102+
redis:

0 commit comments

Comments
 (0)