allianceauth/docker/docker-compose.yml
2025-07-07 03:52:08 +00:00

156 lines
4.5 KiB
YAML

x-allianceauth-base: &allianceauth-base
image: ${AA_DOCKER_TAG?err}
# build:
# context: .
# dockerfile: custom.dockerfile
# args:
# AA_DOCKER_TAG: ${AA_DOCKER_TAG?err}
restart: always
env_file:
- ./.env
volumes:
- ./conf/local.py:/home/allianceauth/myauth/myauth/settings/local.py
- ./conf/celery.py:/home/allianceauth/myauth/myauth/celery.py
- ./conf/urls.py:/home/allianceauth/myauth/myauth/urls.py
- ./conf/memory_check.sh:/memory_check.sh
- ./templates:/home/allianceauth/myauth/myauth/templates/
- static-volume:/var/www/myauth/static
depends_on:
- redis
- auth_mysql
working_dir: /home/allianceauth/myauth/
stop_grace_period: 10m
logging:
driver: "json-file"
options:
max-size: "50Mb"
max-file: "5"
x-allianceauth-health-check: &allianceauth-health-checks
healthcheck:
test: ["CMD", "/memory_check.sh", "500000000"]
interval: 60s
timeout: 10s
retries: 3
start_period: 5m
labels:
- "autoheal=true"
services:
auth_mysql:
image: mariadb:lts
command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --default-authentication-plugin=mysql_native_password]
volumes:
- ./mysql-data:/var/lib/mysql
- ./setup.sql:/docker-entrypoint-initdb.d/setup.sql
- ./conf/aa_mariadb.cnf:/etc/mysql/conf.d/aa_mariadb.cnf
environment:
- MYSQL_ROOT_PASSWORD=${AA_DB_ROOT_PASSWORD?err}
- MARIADB_MYSQL_LOCALHOST_USER=1
healthcheck:
test: ["CMD", "healthcheck.sh", "--su=mysql", "--connect", "--innodb_initialized"]
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
nginx:
image: nginx:stable
restart: always
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- static-volume:/var/www/myauth/static
depends_on:
- allianceauth_gunicorn
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
redis:
image: redis:7
command: redis-server
restart: always
volumes:
- "redis-data:/data"
- ./conf/redis_healthcheck.sh:/usr/local/bin/redis_healthcheck.sh
healthcheck:
test: ["CMD", "/usr/local/bin/redis_healthcheck.sh"]
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
allianceauth_gunicorn:
container_name: allianceauth_gunicorn
<<: [*allianceauth-base]
entrypoint: ["gunicorn", "myauth.wsgi", "--bind=0.0.0.0:8000", "--workers=3", "--timeout=120", "--max-requests=500", "--max-requests-jitter=50"]
expose:
- 8000
allianceauth_beat:
container_name: allianceauth_worker_beat
<<: [*allianceauth-base]
entrypoint: ["celery", "-A", "myauth", "beat"]
allianceauth_worker:
<<: [*allianceauth-base, *allianceauth-health-checks]
entrypoint: ["celery", "-A", "myauth", "worker", "--pool=threads", "--concurrency=5", "-n", "worker_%n"]
deploy:
replicas: 2
allianceauth_worker_services:
<<: [*allianceauth-base, *allianceauth-health-checks]
entrypoint: ["celery", "-A", "myauth", "worker", "--pool=threads", "--concurrency=1", "-Q" , "services" , "-n", "worker_services_%n"]
grafana:
image: grafana/grafana-oss:latest
restart: always
depends_on:
- auth_mysql
volumes:
- ./grafana-datasource.yml:/etc/grafana/provisioning/datasources/datasource.yaml
- ./grafana-dashboards.yml:/etc/grafana/provisioning/dashboards/datasource.yaml
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
environment:
GF_INSTALL_PLUGINS: grafana-piechart-panel,grafana-clock-panel,grafana-simple-json-datasource
GF_SECURITY_ADMIN_USERNAME: ${GF_SECURITY_ADMIN_USERNAME}
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
GF_AUTH_DATABASE_PASSWORD: ${GRAFANA_DB_PASSWORD}
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
proxy:
image: jc21/nginx-proxy-manager:latest
restart: always
ports:
- ${PROXY_HTTP_PORT:-80}:80
- ${PROXY_DASH_PORT:-81}:81
- ${PROXY_HTTPS_PORT:-443}:443
volumes:
- proxy-data:/data
- proxy-le:/etc/letsencrypt
healthcheck:
test: ["CMD", "/bin/check-health"]
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
volumes:
redis-data:
static-volume:
grafana-data:
proxy-data:
proxy-le:
proxy-db: