ansible-role-authentik/templates/docker-compose.yml.j2
Laur Ivan 35dcd22825 Clean up molecule configuration.
Allow PostgreSQL to be exposed for backup.
Create network.
2022-09-19 17:08:23 +02:00

112 lines
3.6 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
{% if authentik_db_container_public_port %}
ports:
- "{{ authentik_db_container_public_port }}:5432"
{% endif %}
networks:
- authentik
volumes:
- {{ authentik_volume_db }}:/var/lib/postgresql/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
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
networks:
- authentik
volumes:
- {{ authentik_volume_redis }}:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
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
networks:
- authentik
volumes:
- {{ authentik_volume_media }}:/media
- {{ authentik_volume_templates }}:/templates
- {{ authentik_volume_geoip }}:/geoip
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
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
networks:
- authentik
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
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
{% if authentik_geoip_container %}
geoipupdate:
image: "maxmindinc/geoipupdate:latest"
volumes:
- "{{ authentik_volume_geoip }}:/usr/share/GeoIP"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
env_file:
- {{ authentik_volume_config }}/env.authentik.conf
{% endif %}
# Custom network
networks:
authentik:
name: authentik