Compose-Examples/examples/authentik/docker-compose.yml

109 lines
3.8 KiB
YAML
Raw Normal View History

2023-09-27 15:50:33 +00:00
services:
postgresql:
image: docker.io/library/postgres:16-alpine
2023-09-27 15:50:33 +00:00
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
2023-09-27 15:50:33 +00:00
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:
2024-09-11 07:44:28 +00:00
image: ghcr.io/goauthentik/server:${AUTHENTIK_VERSION:-2024.8}
2023-09-27 15:50:33 +00:00
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}
2023-09-27 15:50:33 +00:00
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/media:/media
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/authentik/custom-templates:/templates
ports:
2024-10-24 18:24:13 +00:00
- 9000:9000/tcp # http
- 9443:9443/tcp # https
2023-09-27 15:50:33 +00:00
expose:
- 9000
- 9443
env_file:
- .env
2023-09-27 15:50:33 +00:00
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
2023-09-27 15:50:33 +00:00
worker:
2024-09-11 07:44:28 +00:00
image: ghcr.io/goauthentik/server:${AUTHENTIK_VERSION:-2024.8}
2023-09-27 15:50:33 +00:00
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}
2023-09-27 15:50:33 +00:00
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
2024-09-11 07:45:33 +00:00
- redis
2023-09-27 15:50:33 +00:00
networks:
- proxy
2023-09-27 15:50:33 +00:00
- authentik-internal
networks:
proxy:
external: true
authentik-internal:
2024-09-26 07:52:28 +00:00
internal: true