From f3b73bae11a9a004af4228b99a6b690aec338dee Mon Sep 17 00:00:00 2001 From: mr-forust Date: Mon, 8 Dec 2025 01:29:00 +0100 Subject: [PATCH] feat: authentik service+envfile for traefik and authentik --- traefik/.env.example | 22 +++++++++++++ traefik/compose.yaml | 75 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 traefik/.env.example diff --git a/traefik/.env.example b/traefik/.env.example new file mode 100644 index 0000000..45a90cb --- /dev/null +++ b/traefik/.env.example @@ -0,0 +1,22 @@ +# =================================== +# Traefik envs +EMAIL=bobrovod@national.shitposting.agency + +# =================================== +# Authentification app (authentik) + +# PostgresQL conf +PG_PASS=change_this_cuz_its_ur_db_pass +PG_USER=authentik # it's okay + +# Image Settings +AUTHENTIK_IMAGE=ghcr.io/goauthentik/server +AUTHENTIK_TAG=2025.10.2 + +# Networking +PORT_HTTP=9000 +PORT_HTTPS=9443 # btw likely already used by portainer + +AUTHENTIK_SECRET_KEY=super_secret_super_scary_authenik_key + +AUTHENTIK_ERROR_REPORTING__ENABLED=true # Or false to turn off \ No newline at end of file diff --git a/traefik/compose.yaml b/traefik/compose.yaml index 68f57dc..1998e1d 100644 --- a/traefik/compose.yaml +++ b/traefik/compose.yaml @@ -86,6 +86,81 @@ services: environment: - TZ=Europe/Bratislava + postgresql: + image: docker.io/library/postgres:15 + restart: unless-stopped + container_name: authentik-postgresql + env_file: + - .env + environment: + POSTGRES_DB: ${PG_DB:-authentik} + POSTGRES_PASSWORD: ${PG_PASS:?database password required} + POSTGRES_USER: ${PG_USER:-authentik} + volumes: + - auth-database:/var/lib/postgresql/data + healthcheck: + interval: 30s + retries: 5 + start_period: 20s + test: + - CMD-SHELL + - pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER} + timeout: 5s + + server: + image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG:-2025.10.2} + restart: unless-stopped + container_name: authentik-server + command: server + ports: + - ${PORT_HTTP:-9000}:9000 + - ${PORT_HTTPS:-9443}:9443 + env_file: + - .env + environment: + AUTHENTIK_POSTGRESQL__HOST: postgresql + AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} + AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} + AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} + AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required} + volumes: + - ./auth-media:/media + - ./auth-custom-templates:/templates + networks: + - traefik-proxy + depends_on: + postgresql: + condition: service_healthy + + worker: + image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG:-2025.10.2} + restart: unless-stopped + container_name: authentik-worker + command: worker + user: root + env_file: + - .env + environment: + AUTHENTIK_POSTGRESQL__HOST: postgresql + AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} + AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} + AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} + AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required} + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - ./auth-media:/media + - ./certs:/certs + - ./auth-custom-templates:/templates + depends_on: + postgresql: + condition: service_healthy + networks: + - traefik-proxy + +volumes: + auth-database: + driver: local + networks: traefik-proxy: external: true