feat(override): Add bind mount overrides for docker volumes
This commit is contained in:
parent
2bb68a7880
commit
9194626bcd
|
|
@ -47,6 +47,26 @@ Then edit `.env` and set variables according to your needs.
|
|||
|
||||
---
|
||||
|
||||
## Volume Bind Mounts
|
||||
|
||||
| Variable | Purpose | Default | When to Set |
|
||||
| --------------------------- | -------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------- |
|
||||
| `SITES_DATA_LOCATION` | Host directory for the `sites` volume; must be an absolute path and already exist | - | Required for `compose.bind-mount-sites.yaml` |
|
||||
| `DB_DATA_LOCATION` | Host directory for the `db-data` volume; must be an absolute path and already exist | - | Required for `compose.bind-mount-db-data.yaml` |
|
||||
| `REDIS_QUEUE_DATA_LOCATION` | Host directory for the `redis-queue-data` volume; must be an absolute path and already exist | - | Required for `compose.bind-mount-redis-queue.yaml` |
|
||||
|
||||
> Warning: with a bind mount, the data lives on the host, not inside the Docker volume. Removing the volume (for example with `docker compose down -v`) will **not** delete the data. To actually erase the data, delete the host directory manually with `rm -r <data path>`.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
SITES_DATA_LOCATION=/srv/frappe/sites
|
||||
DB_DATA_LOCATION=/srv/frappe/db-data
|
||||
REDIS_QUEUE_DATA_LOCATION=/srv/frappe/redis-queue-data
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reverse Proxy and SSL (HTTPS) Configuration
|
||||
|
||||
### Traefik (compose.proxy.yaml / compose.https.yaml)
|
||||
|
|
|
|||
|
|
@ -8,28 +8,32 @@ Overrides extend the base compose.yaml with additional services or modify existi
|
|||
docker compose -f compose.yaml -f overrides/compose.mariadb.yaml -f overrides/compose.redis.yaml config > compose.custom.yaml
|
||||
```
|
||||
|
||||
| Overrider | Purpose | Additional Info |
|
||||
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Database** | | |
|
||||
| compose.mariadb.yaml | Adds MariaDB database service | set `DB_PASSWORD` or default Password will be used |
|
||||
| compose.mariadb-secrets.yaml | Adds MariaDB with password from a secret file instead of environment variable | Set `DB_PASSWORD_SECRETS_FILE` to the path of your secret file |
|
||||
| compose.mariadb-shared.yaml | Makes MariaDB available on a shared network (mariadb-network) for other services | set `DB_PASSWORD` |
|
||||
| compose.postgres.yaml | Uses PostgreSQL instead of MariaDB as the database | set `DB_PASSWORD` |
|
||||
| **Proxy** | | |
|
||||
| compose.noproxy.yaml | Exposes the application directly on port `:8080` without a reverse proxy | |
|
||||
| compose.proxy.yaml | Uses Traefik as HTTP reverse proxy on port `:80` | You can change the published port by setting `HTTP_PUBLISH_PORT` |
|
||||
| compose.https.yaml | Uses Traefik as HTTPS reverse proxy on Port `:443` with automatic HTTP-to-HTTPS redirect | `SITES_RULE` and `LETSENCRYPT_EMAIL` must be set. `HTTP_PUBLISH_PORT` and `HTTPS_PUBLISH_PORT` can be set. |
|
||||
| compose.traefik.yaml | Runs a standalone Traefik proxy with dashboard (HTTP) on a shared `traefik-public` network | Use for multi-stack setups. Requires `TRAEFIK_DOMAIN` and `HASHED_PASSWORD`. |
|
||||
| compose.traefik-ssl.yaml | Adds HTTPS and Let's Encrypt for the Traefik dashboard | Use with `compose.traefik.yaml`. Requires `EMAIL` and `TRAEFIK_DOMAIN`. Publishes `HTTPS_PUBLISH_PORT`. |
|
||||
| compose.nginxproxy.yaml | Uses nginx-proxy as HTTP reverse proxy on port `:80` | Set `NGINX_PROXY_HOSTS`. Use with `compose.nginxproxy-ssl.yaml` for HTTPS. You can change the published port by setting `HTTP_PUBLISH_PORT` |
|
||||
| compose.nginxproxy-ssl.yaml | Adds acme-companion for HTTPS on port `:443` with automatic certificates | Requires `compose.nginxproxy.yaml`. Set `NGINX_PROXY_HOSTS` and `LETSENCRYPT_EMAIL`. `HTTP_PUBLISH_PORT` and `HTTPS_PUBLISH_PORT` can be set. |
|
||||
| **Redis** | | |
|
||||
| compose.redis.yaml | Adds Redis service for caching and background job queuing | |
|
||||
| **Services** | | |
|
||||
| compose.migrator.yaml | Runs a dedicated migration container performing `bench --site all migrate` on all sites at every start | Control migration intent with `MIGRATE_SITES` - defaults to true |
|
||||
| **TBD** | **The following overrides are available but lack documentation. If you use them and understand their purpose, please consider contributing to this documentation.** | |
|
||||
| compose.backup-cron.yaml | | |
|
||||
| compose.custom-domain-ssl.yaml | | |
|
||||
| compose.custom-domain.yaml | | |
|
||||
| compose.multi-bench-ssl.yaml | | |
|
||||
| compose.multi-bench.yaml | | |
|
||||
| Overrider | Purpose | Additional Info |
|
||||
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Database** | | |
|
||||
| compose.mariadb.yaml | Adds MariaDB database service | set `DB_PASSWORD` or default Password will be used |
|
||||
| compose.mariadb-secrets.yaml | Adds MariaDB with password from a secret file instead of environment variable | Set `DB_PASSWORD_SECRETS_FILE` to the path of your secret file |
|
||||
| compose.mariadb-shared.yaml | Makes MariaDB available on a shared network (mariadb-network) for other services | set `DB_PASSWORD` |
|
||||
| compose.postgres.yaml | Uses PostgreSQL instead of MariaDB as the database | set `DB_PASSWORD` |
|
||||
| **Proxy** | | |
|
||||
| compose.noproxy.yaml | Exposes the application directly on port `:8080` without a reverse proxy | |
|
||||
| compose.proxy.yaml | Uses Traefik as HTTP reverse proxy on port `:80` | You can change the published port by setting `HTTP_PUBLISH_PORT` |
|
||||
| compose.https.yaml | Uses Traefik as HTTPS reverse proxy on Port `:443` with automatic HTTP-to-HTTPS redirect | `SITES_RULE` and `LETSENCRYPT_EMAIL` must be set. `HTTP_PUBLISH_PORT` and `HTTPS_PUBLISH_PORT` can be set. |
|
||||
| compose.traefik.yaml | Runs a standalone Traefik proxy with dashboard (HTTP) on a shared `traefik-public` network | Use for multi-stack setups. Requires `TRAEFIK_DOMAIN` and `HASHED_PASSWORD`. |
|
||||
| compose.traefik-ssl.yaml | Adds HTTPS and Let's Encrypt for the Traefik dashboard | Use with `compose.traefik.yaml`. Requires `EMAIL` and `TRAEFIK_DOMAIN`. Publishes `HTTPS_PUBLISH_PORT`. |
|
||||
| compose.nginxproxy.yaml | Uses nginx-proxy as HTTP reverse proxy on port `:80` | Set `NGINX_PROXY_HOSTS`. Use with `compose.nginxproxy-ssl.yaml` for HTTPS. You can change the published port by setting `HTTP_PUBLISH_PORT` |
|
||||
| compose.nginxproxy-ssl.yaml | Adds acme-companion for HTTPS on port `:443` with automatic certificates | Requires `compose.nginxproxy.yaml`. Set `NGINX_PROXY_HOSTS` and `LETSENCRYPT_EMAIL`. `HTTP_PUBLISH_PORT` and `HTTPS_PUBLISH_PORT` can be set. |
|
||||
| **Redis** | | |
|
||||
| compose.redis.yaml | Adds Redis service for caching and background job queuing | |
|
||||
| **Services** | | |
|
||||
| compose.migrator.yaml | Runs a dedicated migration container performing `bench --site all migrate` on all sites at every start | Control migration intent with `MIGRATE_SITES` - defaults to true |
|
||||
| **Volumes** | | |
|
||||
| compose.bind-mount-sites.yaml | Bind mounts the `sites` volume to a host directory instead of a Docker-managed volume | Set `SITES_DATA_LOCATION`. The directory must exist before `docker compose up -d`. |
|
||||
| compose.bind-mount-db-data.yaml | Bind mounts the `db-data` volume to a host directory instead of a Docker-managed volume | Use with `compose.mariadb.yaml` or `compose.postgres.yaml`. Set `DB_DATA_LOCATION`. The directory must exist before `docker compose up -d`. |
|
||||
| compose.bind-mount-redis-queue.yaml | Bind mounts the `redis-queue-data` volume to a host directory instead of a Docker-managed volume | Use with `compose.redis.yaml`. Set `REDIS_QUEUE_DATA_LOCATION`. The directory must exist before `docker compose up -d`. |
|
||||
| **TBD** | **The following overrides are available but lack documentation. If you use them and understand their purpose, please consider contributing to this documentation.** | |
|
||||
| compose.backup-cron.yaml | | |
|
||||
| compose.custom-domain-ssl.yaml | | |
|
||||
| compose.custom-domain.yaml | | |
|
||||
| compose.multi-bench-ssl.yaml | | |
|
||||
| compose.multi-bench.yaml | | |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
# Bind mount the `db-data` volume to a host directory instead of letting Docker manage it.
|
||||
# Use together with overrides/compose.mariadb.yaml or overrides/compose.postgres.yaml.
|
||||
#
|
||||
# NOTE:
|
||||
# - `DB_DATA_LOCATION` (required): absolute path to the host directory to bind mount.
|
||||
# - The directory must exist before running `docker compose up -d`, otherwise Docker fails
|
||||
# when populating the volume.
|
||||
volumes:
|
||||
db-data:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
device: ${DB_DATA_LOCATION}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Bind mount the `redis-queue-data` volume to a host directory instead of letting Docker manage it.
|
||||
# Use together with overrides/compose.redis.yaml.
|
||||
#
|
||||
# NOTE:
|
||||
# - `REDIS_QUEUE_DATA_LOCATION` (required): absolute path to the host directory to bind mount.
|
||||
# - The directory must exist before running `docker compose up -d`, otherwise Docker fails
|
||||
# when populating the volume.
|
||||
volumes:
|
||||
redis-queue-data:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
device: ${REDIS_QUEUE_DATA_LOCATION}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Bind mount the `sites` volume to a host directory instead of letting Docker manage it.
|
||||
#
|
||||
# NOTE:
|
||||
# - `SITES_DATA_LOCATION` (required): absolute path to the host directory to bind mount.
|
||||
# - The directory must exist before running `docker compose up -d`, otherwise Docker fails
|
||||
# when populating the volume.
|
||||
volumes:
|
||||
sites:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
device: ${SITES_DATA_LOCATION}
|
||||
Loading…
Reference in New Issue