version: "3.4" services: postgresql: image: docker.io/library/postgres:16-alpine container_name: authentik-psql 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: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/psql:/var/lib/postgresql/data environment: POSTGRES_PASSWORD: ${PG_PASS:-authentik} POSTGRES_USER: ${PG_USER:-authentik} POSTGRES_DB: ${PG_DB:-authentik} env_file: - .env networks: - authentik-internal redis: image: docker.io/library/redis:alpine container_name: authentik-redis 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: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/redis:/data networks: - authentik-internal authentik-proxy: image: ghcr.io/goauthentik/server:${AUTHENTIK_VERSION:-2024.8} container_name: authentik restart: unless-stopped command: server environment: AUTHENTIK_REDIS__HOST: redis AUTHENTIK_POSTGRESQL__HOST: postgresql AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS:-authentik} AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:-authentiksupersecretkey} volumes: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/media:/media - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/custom-templates:/templates expose: - 9000 - 9443 env_file: - .env depends_on: - postgresql - redis networks: - proxy - authentik-internal labels: - traefik.enable=true - traefik.http.routers.authentik.rule=Host(`authentik.example.com`) || HostRegexp(`{subdomain:[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?}.example.com`) && PathPrefix(`/outpost.goauthentik.io/`) - traefik.http.services.authentik.loadbalancer.server.port=9000 - traefik.docker.network=proxy - traefik.http.middlewares.authentik.forwardauth.address=http://authentik-proxy:9000/outpost.goauthentik.io/auth/traefik - traefik.http.middlewares.authentik.forwardauth.trustForwardHeader=true - traefik.http.middlewares.authentik.forwardauth.authResponseHeaders=X-authentik-username,X-authentik-groups,X-authentik-email,X-authentik-name,X-authentik-uid,X-authentik-jwt,X-authentik-meta-jwks,X-authentik-meta-outpost,X-authentik-meta-provider,X-authentik-meta-app,X-authentik-meta-version worker: image: ghcr.io/goauthentik/server:${AUTHENTIK_VERSION:-2024.8} container_name: authentik-worker restart: unless-stopped command: worker user: root environment: AUTHENTIK_REDIS__HOST: redis AUTHENTIK_POSTGRESQL__HOST: postgresql AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS:-authentik} AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:-authentiksupersecretkey} volumes: - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/certs:/certs - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/media:/media - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/custom-templates:/templates env_file: - .env depends_on: - postgresql - redis networks: - authentik-internal networks: proxy: external: true authentik-internal: external: true