authentik
authentik copied to clipboard
Authentik server and worker : Name or service not known
Describe your question/ Hello, I am trying to install authentik on my homelab. I am following the instruction from Lempa on Youtube. When running Authentik, there is no problem with postgresql and redis but the Server and the Worker have the same error message:
INF event=PostgreSQL connection failed, retrying... ([Errno -2] Name or service not known) logger=authentik.lib.config timestamp=1711447190.004681 INF event=PostgreSQL connection failed, retrying... ([Errno -2] Name or service not known) logger=authentik.lib.config timestamp=1711447195.124615 INF event=PostgreSQL connection failed, retrying... ([Errno -2] Name or service not known) logger=authentik.lib.config timestamp=1711447200.2448711
Relevant info Docker are running on the last version of Proxmox.
Version and Deployment (please complete the following information):
- authentik version: [2024.2.2]
- Deployment: with Portainer
Ideas ?
`services:
postgresql:
image: docker.io/library/postgres:12-alpine
container_name: authentik-demo-1-postgresql
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
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
redis:
image: docker.io/library/redis:alpine
container_name: authentik-demo-1-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:
- redis:/data
server:
image: ghcr.io/goauthentik/server:2024.2.2
container_name: authentik-demo-1-server
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__USER: ${POSTGRES_USER}
AUTHENTIK_POSTGRESQL__NAME: ${POSTGRES_DB}
AUTHENTIK_POSTGRESQL__PASSWORD: ${POSTGRES_PASSWORD}
AUTHENTIK_ERROR_REPORTING__ENABLED: true
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
volumes:
- /mnt/user/appdata/docker/authentik/media:/media
- /mnt/user/appdata/docker/authentik/custom-templates:/templates
#labels:
# - "traefik.enable: true"
#- "traefik.http.routers.authentik-demo-1.rule=Host('authentik-demo-1.domain.tld')"
#- "traefik.http.routers.authentik-demo-1.entrypoints=websecure"
#- "traefik.http.routers.authentik-demo-1.tls=true"
#- "traefik.http.routers.authentik-demo-1.tls.certresolver=cloudflare"
#- "traefik.http.routers.authentik-demo-1.service=authentik-https-1-svc"
#- "traefik.http.services.authentik-demo-1.loadBalancer.server.port=9000"
depends_on:
- postgresql
- redis
networks:
- mynetwork
worker:
image: ghcr.io/goauthentik/server:2024.2.2
container_name: authentik-demo-1-worker
restart: unless-stopped
command: worker
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOSTS: postgresql
AUTHENTIK_POSTGRESQL__USER: ${POSTGRES_USER}
AUTHENTIK_POSTGRESQL__NAME: ${POSTGRES_DB}
AUTHENTIK_POSTGRESQL__PASSWORD: ${POSTGRES_PASSWORD}
AUTHENTIK_ERROR_REPORTING__ENABLED: true
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY}
user: root
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/user/appdata/docker/authentik/media:/media
- /mnt/user/appdata/docker/authentik/certs:/certs
- /mnt/user/appdata/docker/authentik/custom-templates:/templates
depends_on:
- postgresql
- redis
networks:
- mynetwork
volumes:
database:
driver: local
redis:
driver: local
networks:
mynetwork:
external: true`
I have done some test with different version of postgres and authentik ... Same pb. The database is created without any tables on it.
From the docker-compose you provided, the server and worker container are not in the same docker network as the postgresql and redis containers. This is why they can't talk to each other.