bramw_baserow/plugin-boilerplate/{{ cookiecutter.project_slu.../docker-compose.multi-servic...

133 lines
3.6 KiB
YAML

version: "3.4"
# MAKE SURE YOU HAVE SET THE REQUIRED VARIABLES IN the .env FILE.configs:
# This compose file starts up a prodish version of the plugin using a caddy reverse
# proxy to route requests between the backend and web-frontend services.
# It is accessible at http://localhost:80 by default.
services:
# A caddy reverse proxy sitting in-front of all the services.
caddy:
image: caddy:2
restart: unless-stopped
env_file:
- .env
ports:
- "${HOST_PUBLISH_IP:-0.0.0.0}:${WEB_FRONTEND_PORT:-80}:80"
- "${HOST_PUBLISH_IP:-0.0.0.0}:${WEB_FRONTEND_SSL_PORT:-443}:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- media:/baserow/media
- caddy_config:/config
- caddy_data:/data
backend:
image: {{ cookiecutter.project_slug }}_backend
build:
dockerfile: ./backend.Dockerfile
context: .
restart: unless-stopped
env_file:
- .env
depends_on:
- db
- redis
volumes:
- media:/baserow/media
web-frontend:
image: {{ cookiecutter.project_slug }}_web-frontend
build:
dockerfile: ./web-frontend.Dockerfile
context: .
restart: unless-stopped
env_file:
- .env
depends_on:
- backend
celery:
image: {{ cookiecutter.project_slug }}_backend
restart: unless-stopped
env_file:
.env
command: celery-worker
# The backend image's baked in healthcheck defaults to the django healthcheck
# override it to the celery one here.
healthcheck:
test: [ "CMD-SHELL", "/baserow/backend/docker/docker-entrypoint.sh celery-worker-healthcheck" ]
depends_on:
- backend
volumes:
- media:/baserow/media
celery-export-worker:
image: {{ cookiecutter.project_slug }}_backend
restart: unless-stopped
command: celery-exportworker
# The backend image's baked in healthcheck defaults to the django healthcheck
# override it to the celery one here.
healthcheck:
test: [ "CMD-SHELL", "/baserow/backend/docker/docker-entrypoint.sh celery-exportworker-healthcheck" ]
depends_on:
- backend
env_file:
.env
volumes:
- media:/baserow/media
celery-beat-worker:
image: {{ cookiecutter.project_slug }}_backend
restart: unless-stopped
command: celery-beat
# See https://github.com/sibson/redbeat/issues/129#issuecomment-1057478237
stop_signal: SIGQUIT
env_file:
- .env
depends_on:
- backend
volumes:
- media:/baserow/media
db:
# Please ensure the postgres-client's major version in the backend image is kept in
# sync with this major version so pg_dump remains compatible.
image: postgres:11
restart: unless-stopped
env_file:
- .env
environment:
- POSTGRES_USER=${DATABASE_USER:-baserow}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD:?}
- POSTGRES_DB=${DATABASE_NAME:-baserow}
healthcheck:
test: [ "CMD-SHELL", "su postgres -c \"pg_isready -U ${DATABASE_USER:-baserow}\"" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:6
command: redis-server --requirepass ${REDIS_PASSWORD:?}
env_file:
- .env
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
# By default, the media volume will be owned by root on startup. Ensure it is owned by
# the same user that django is running as, so it can write user files.
volume-permissions-fixer:
image: bash:4.4
command: chown 9999:9999 -R /baserow/media
volumes:
- media:/baserow/media
volumes:
pgdata:
media:
caddy_data:
caddy_config: