173 lines
6.1 KiB
YAML
173 lines
6.1 KiB
YAML
---
|
|
|
|
services:
|
|
geoipupdate:
|
|
image: "maxmindinc/geoipupdate:latest"
|
|
volumes:
|
|
- "geoip:/usr/share/GeoIP"
|
|
environment:
|
|
GEOIPUPDATE_EDITION_IDS: "GeoLite2-City GeoLite2-ASN"
|
|
GEOIPUPDATE_FREQUENCY: "8"
|
|
GEOIPUPDATE_ACCOUNT_ID: "${GEOIPUPDATE_ACCOUNT_ID:?MaxMind GeoIP account ID required}"
|
|
GEOIPUPDATE_LICENSE_KEY: "${GEOIPUPDATE_LICENSE_KEY:?MaxMind GeoIP license key required}"
|
|
|
|
postgresql:
|
|
image: docker.io/library/postgres:16-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:
|
|
- database:/var/lib/postgresql/data
|
|
- backups_db:/var/lib/postgresql/backups
|
|
environment:
|
|
POSTGRES_PASSWORD: ${PG_PASS:?database password required}
|
|
POSTGRES_USER: ${PG_USER:-authentik}
|
|
POSTGRES_DB: ${PG_DB:-authentik}
|
|
env_file:
|
|
- .env
|
|
networks:
|
|
- backend
|
|
|
|
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:
|
|
- redis:/data
|
|
networks:
|
|
- backend
|
|
|
|
server:
|
|
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2024.10.0}
|
|
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:?PG_PASS is required. - Password for authentik's postgresql database}
|
|
volumes:
|
|
- ./data/authentik/media:/media
|
|
- ./data/authentik/custom-templates:/templates
|
|
- geoip:/geoip
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
- postgresql
|
|
- redis
|
|
networks:
|
|
- backend
|
|
- web
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.sso.entrypoints=websecure"
|
|
- "traefik.http.routers.sso.rule=Host(`${PUBLIC_DOMAIN}`)" # change hostname!
|
|
- "traefik.http.routers.sso.tls=true"
|
|
- "traefik.http.routers.sso.tls.certresolver=pdns"
|
|
- "traefik.http.routers.sso.tls.domains[0].main=*.test.base23.de"
|
|
- "traefik.http.routers.sso.middlewares=secHeaders@file,hsts-header@file"
|
|
- "traefik.http.services.sso.loadbalancer.server.port=9443" # set port the container listenes to
|
|
- "traefik.http.services.sso.loadbalancer.server.scheme=https"
|
|
|
|
worker:
|
|
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2024.10.0}
|
|
restart: unless-stopped
|
|
command: worker
|
|
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:?PG_PASS is required. - Password for authentik's postgresql database}
|
|
# `user: root` and the docker socket volume are optional.
|
|
# See more for the docker socket integration here:
|
|
# https://goauthentik.io/docs/outposts/integrations/docker
|
|
# Removing `user: root` also prevents the worker from fixing the permissions
|
|
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID
|
|
# (1000:1000 by default)
|
|
user: root
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- ./data/authentik/media:/media
|
|
- ./data/authentik/certs:/certs
|
|
- ./data/authentik/custom-templates:/templates
|
|
- geoip:/geoip
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
- postgresql
|
|
- redis
|
|
networks:
|
|
- backend
|
|
|
|
backup:
|
|
image: registry.git.base23.de/base23/backup/resticker:0.17.0
|
|
environment:
|
|
PRE_COMMANDS: |-
|
|
cd /compose-project/
|
|
[[ $($(docker compose &>/dev/null); echo "$?") -eq 0 ]] || apk add --no-cache docker-cli-compose
|
|
docker compose exec -T postgresql pg_dump -U ${PG_USER:-authentik} -d ${PG_DB:-authentik} -f /var/lib/postgresql/backups/${PG_DB:-authentik}.sql
|
|
RUN_ON_STARTUP: "false"
|
|
BACKUP_CRON: "32 2 * * *"
|
|
RESTIC_REPOSITORY: sftp://${RESTIC_REPO_USER:?Restic repository user is required}@${RESTIC_REPO_ADDRESS:?Restic repository address is requried}:${RESTIC_REPO_PORT:?Restic repository port is required}//backup
|
|
RESTIC_PASSWORD: '${RESTIC_REPO_PASSWORD:?Restic repository password is required}'
|
|
RESTIC_BACKUP_SOURCES: /var/lib/postgresql/backups /var/lib/authentik/backups /var/lib/lego/backups
|
|
RESTIC_BACKUP_ARGS: >-
|
|
--tag ${RESTIC_TAG:?Restic tag is required}
|
|
--verbose
|
|
RESTIC_FORGET_ARGS: >-
|
|
--keep-last 10
|
|
--keep-daily 7
|
|
--keep-weekly 5
|
|
--keep-monthly 12
|
|
TZ: Europe/Berlin
|
|
volumes:
|
|
- ./data/restic/ssh/:/run/secrets/.ssh:ro
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- ./docker-compose.yml:/compose-project/docker-compose.yml:ro
|
|
- ./.env:/compose-project/.env:ro
|
|
- backups_db:/var/lib/postgresql/backups:ro
|
|
- ./data/authentik/certs:/var/lib/authentik/backups/certs:ro
|
|
- ./data/authentik/custom-templates:/var/lib/authentik/backups/templates:ro
|
|
- ./data/authentik/media:/var/lib/authentik/backups/media:ro
|
|
- ./data/.lego:/var/lib/lego/backups:ro
|
|
|
|
prune-backup:
|
|
image: registry.git.base23.de/base23/backup/resticker:0.17.0
|
|
environment:
|
|
SKIP_INIT: "true"
|
|
RUN_ON_STARTUP: "false"
|
|
PRUNE_CRON: "47 3 * * *"
|
|
RESTIC_REPOSITORY: sftp://${RESTIC_REPO_USER:?Restic repository user is required}@${RESTIC_REPO_ADDRESS:?Restic repository address is requried}:${RESTIC_REPO_PORT:?Restic repository port is required}//backup
|
|
RESTIC_PASSWORD: '${RESTIC_REPO_PASSWORD:?Restic repository password is required}'
|
|
TZ: Europe/Berlin
|
|
volumes:
|
|
- ./data/restic/ssh/:/run/secrets/.ssh:ro
|
|
|
|
|
|
volumes:
|
|
backups_db:
|
|
driver: local
|
|
database:
|
|
driver: local
|
|
redis:
|
|
driver: local
|
|
geoip:
|
|
driver: local
|
|
|
|
|
|
networks:
|
|
backend:
|
|
web:
|
|
external: true
|