mirror of
https://github.com/zulip/docker-zulip.git
synced 2025-11-03 21:43:26 +00:00
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 <alexmv@zulip.com>
This commit is contained in:
31
README.md
31
README.md
@@ -55,33 +55,14 @@ written to the image's filesystem is lost). To handle persistent
|
|||||||
state that needs to persist after the Docker equivalent of a reboot or
|
state that needs to persist after the Docker equivalent of a reboot or
|
||||||
upgrades (like uploaded files or the Zulip database), container
|
upgrades (like uploaded files or the Zulip database), container
|
||||||
systems let you configure certain directories inside the container
|
systems let you configure certain directories inside the container
|
||||||
from the host system's filesystem.
|
from the host.
|
||||||
|
|
||||||
For example, this project's `docker-compose.yml` configuration file
|
This project's `docker-compose.yml` configuration file uses [Docker managed
|
||||||
specifies a set of volumes where
|
volumes][volumes] to store [persistent Zulip data][persistent-data]. If you use
|
||||||
[persistent Zulip data][persistent-data] should be stored under
|
the Docker Compose deployment, you should make sure that Zulip's volumes are
|
||||||
`/opt/docker/zulip/` in the container host's file system:
|
backed up, to ensure that Zulip's data is backed up.
|
||||||
|
|
||||||
* `/opt/docker/zulip/postgresql/data/` has the postgres container's
|
|
||||||
persistent storage (i.e. the database).
|
|
||||||
* `/opt/docker/zulip/zulip/` has the application server container's
|
|
||||||
persistent storage, including the secrets file, uploaded files,
|
|
||||||
etc.
|
|
||||||
|
|
||||||
This approach of mounting `/opt/docker` into the container is the
|
|
||||||
right model if you're hosting your containers from a single host
|
|
||||||
server, which is how `docker-compose` is intended to be used. If
|
|
||||||
you're using Kubernetes, Docker Swarm, or another cloud container
|
|
||||||
service, then these persistent storage volumes are typically
|
|
||||||
configured to be network block storage volumes (e.g. an Amazon EBS
|
|
||||||
volume) so that they can be mounted from any server within the
|
|
||||||
cluster.
|
|
||||||
|
|
||||||
What this means is that if you're using `docker-zulip` in production
|
|
||||||
with `docker-compose`, you'll want to configure your backup system to
|
|
||||||
do backups on the `/opt/docker/zulip` directory, in order to ensure
|
|
||||||
you don't lose data.
|
|
||||||
|
|
||||||
|
[volumes]: https://docs.docker.com/storage/volumes/
|
||||||
[persistent-data]: https://zulip.readthedocs.io/en/latest/production/maintain-secure-upgrade.html#backups
|
[persistent-data]: https://zulip.readthedocs.io/en/latest/production/maintain-secure-upgrade.html#backups
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ services:
|
|||||||
# the first time on a host. Instructions are available in README.md.
|
# the first time on a host. Instructions are available in README.md.
|
||||||
POSTGRES_PASSWORD: "REPLACE_WITH_SECURE_POSTGRES_PASSWORD"
|
POSTGRES_PASSWORD: "REPLACE_WITH_SECURE_POSTGRES_PASSWORD"
|
||||||
volumes:
|
volumes:
|
||||||
- "/opt/docker/zulip/postgresql/data:/var/lib/postgresql/data:rw"
|
- "postgresql-10:/var/lib/postgresql/data:rw"
|
||||||
memcached:
|
memcached:
|
||||||
image: "memcached:alpine"
|
image: "memcached:alpine"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -34,7 +34,7 @@ services:
|
|||||||
RABBITMQ_DEFAULT_USER: "zulip"
|
RABBITMQ_DEFAULT_USER: "zulip"
|
||||||
RABBITMQ_DEFAULT_PASS: "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD"
|
RABBITMQ_DEFAULT_PASS: "REPLACE_WITH_SECURE_RABBITMQ_PASSWORD"
|
||||||
volumes:
|
volumes:
|
||||||
- "/opt/docker/zulip/rabbitmq:/var/lib/rabbitmq:rw"
|
- "rabbitmq:/var/lib/rabbitmq:rw"
|
||||||
redis:
|
redis:
|
||||||
image: "redis:alpine"
|
image: "redis:alpine"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -47,7 +47,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
REDIS_PASSWORD: "REPLACE_WITH_SECURE_REDIS_PASSWORD"
|
REDIS_PASSWORD: "REPLACE_WITH_SECURE_REDIS_PASSWORD"
|
||||||
volumes:
|
volumes:
|
||||||
- "/opt/docker/zulip/redis:/data:rw"
|
- "redis:/data:rw"
|
||||||
zulip:
|
zulip:
|
||||||
image: "zulip/docker-zulip:5.7-0"
|
image: "zulip/docker-zulip:5.7-0"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -90,8 +90,13 @@ services:
|
|||||||
# Uncomment this when configuring the mobile push notifications service
|
# Uncomment this when configuring the mobile push notifications service
|
||||||
# SETTING_PUSH_NOTIFICATION_BOUNCER_URL: 'https://push.zulipchat.com'
|
# SETTING_PUSH_NOTIFICATION_BOUNCER_URL: 'https://push.zulipchat.com'
|
||||||
volumes:
|
volumes:
|
||||||
- "/opt/docker/zulip/zulip:/data:rw"
|
- "zulip:/data:rw"
|
||||||
ulimits:
|
ulimits:
|
||||||
nofile:
|
nofile:
|
||||||
soft: 1000000
|
soft: 1000000
|
||||||
hard: 1048576
|
hard: 1048576
|
||||||
|
volumes:
|
||||||
|
zulip:
|
||||||
|
postgresql-10:
|
||||||
|
rabbitmq:
|
||||||
|
redis:
|
||||||
|
|||||||
Reference in New Issue
Block a user