Files
infrastructure/ansible/roles/wger/templates/docker-compose.yml

133 lines
3.4 KiB
YAML

networks:
traefik:
external: true
services:
web:
image: wger/server:latest
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
networks:
- default
env_file:
- {{ data_dir }}/{{ role_name }}/config/prod.env
volumes:
- {{ data_dir }}/{{ role_name }}/static:/home/wger/static
- {{ data_dir }}/{{ role_name }}/media:/home/wger/media
expose:
- 8000
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8000
interval: 10s
timeout: 5s
start_period: 300s
retries: 5
restart: unless-stopped
nginx:
image: nginx:stable
depends_on:
- web
networks:
- traefik
- default
volumes:
- {{ data_dir }}/{{ role_name }}/config/nginx.conf:/etc/nginx/conf.d/default.conf
- {{ data_dir }}/{{ role_name }}/static:/wger/static:ro
- {{ data_dir }}/{{ role_name }}/media:/wger/media:ro
healthcheck:
test: service nginx status
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
labels:
traefik.enable: true
traefik.http.routers.wger.rule: "Host(`wger.{{ personal_domain }}`)"
#traefik.http.services.wger.loadbalancer.server.port: 8000
#traefik.http.routers.wger.middlewares: lan-whitelist@file
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=wger
- POSTGRES_PASSWORD=wger
- POSTGRES_DB=wger
- "TZ={{ timezone }}"
networks:
- default
volumes:
- {{ data_dir }}/postgres/{{ role_name }}:/var/lib/postgresql/data/
expose:
- 5432
healthcheck:
test: pg_isready -U wger
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
cache:
image: redis
expose:
- 6379
networks:
- default
volumes:
- {{ data_dir }}/{{ role_name }}/config/redis.conf:/usr/local/etc/redis/redis.conf
- {{ data_dir }}/redis/{{ role_name }}/data:/data
command: [ "redis-server", "/usr/local/etc/redis/redis.conf"]
healthcheck:
test: redis-cli ping
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
# You probably want to limit the memory usage of the cache, otherwise it might
# hog all the available memory. Remove or change according to your needs.
#mem_limit: 2gb
celery_worker:
image: wger/server:latest
command: /start-worker
networks:
- default
env_file:
- {{ data_dir }}/{{ role_name }}/config/prod.env
volumes:
- {{ data_dir }}/{{ role_name }}/media:/home/wger/media
depends_on:
web:
condition: service_healthy
healthcheck:
test: celery -A wger inspect ping
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
celery_beat:
image: wger/server:latest
command: /start-beat
networks:
- default
volumes:
- {{ data_dir }}/{{ role_name }}/celery-beat:/home/wger/beat/
env_file:
- {{ data_dir }}/{{ role_name }}/config/prod.env
depends_on:
celery_worker:
condition: service_healthy
# Heads up, if you remove these volumes and use folders directly you need to chown them
# to the UID and GID 1000 even if it doesn't exist on your system. Also, they should
# be readable by everyone.