ansible-role-authentik/templates/docker-compose.yml.j2
Laur Ivan b09f380957 DB directory has user 70 (docker).
Optional install geoip container.
2022-09-17 18:47:53 +02:00

85 lines
2.9 KiB
Django/Jinja

---
version: '3.4'
services:
postgresql:
image: docker.io/library/postgres:12-alpine
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
start_period: 20s
interval: 30s
retries: 5
timeout: 5s
volumes:
- {{ authentik_volume_db }}:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD={{ authentik_db_password }}
- POSTGRES_USER={{ authentik_db_user }}
- POSTGRES_DB={{ authentik_db }}
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
redis:
image: docker.io/library/redis:alpine
command: --save 60 1 --loglevel warning
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
start_period: 20s
interval: 30s
retries: 5
timeout: 3s
volumes:
- {{ authentik_volume_redis }}:/data
server:
image: ghcr.io/goauthentik/server:{{ authentik_image_version }}
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__NAME: "{{ authentik_db }}"
AUTHENTIK_POSTGRESQL__USER: "{{ authentik_db_user }}"
AUTHENTIK_POSTGRESQL__PASSWORD: "{{ authentik_db_password }}"
# AUTHENTIK_ERROR_REPORTING__ENABLED: "true"
# WORKERS: 2
volumes:
- {{ authentik_volume_media }}:/media
- {{ authentik_volume_templates }}:/templates
- {{ authentik_volume_geoip }}:/geoip
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
ports:
- "0.0.0.0:{{ authentik_port_http }}:9000"
- "0.0.0.0:{{ authentik_port_https }}:9443"
worker:
image: ghcr.io/goauthentik/server:{{ authentik_image_version }}
restart: unless-stopped
command: worker
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__NAME: "{{ authentik_db }}"
AUTHENTIK_POSTGRESQL__USER: "{{ authentik_db_user }}"
AUTHENTIK_POSTGRESQL__PASSWORD: "{{ authentik_db_password }}"
# AUTHENTIK_ERROR_REPORTING__ENABLED: "true"
# This is optional, and can be removed. If you remove this, the following will happen
# - The permissions for the /media folders aren't fixed, so make sure they are 1000:1000
# - The docker socket can't be accessed anymore
user: root
volumes:
- {{ authentik_volume_media }}:/media
- {{ authentik_volume_certs }}:/certs
- /var/run/docker.sock:/var/run/docker.sock
- {{ authentik_volume_templates }}:/templates
- {{ authentik_volume_geoip }}:/geoip
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
{% if authentik_geoip_container %}
geoipupdate:
image: "maxmindinc/geoipupdate:latest"
volumes:
- "{{ authentik_volume_geoip }}:/usr/share/GeoIP"
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
{% endif %}