compose.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ---
  2. services:
  3. server:
  4. image: ghcr.io/goauthentik/server:2025.6.3
  5. container_name: authentik-server
  6. command: server
  7. environment:
  8. - AUTHENTIK_REDIS__HOST=authentik-redis
  9. - AUTHENTIK_POSTGRESQL__HOST=authentik-db
  10. - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER:-authentik}
  11. - AUTHENTIK_POSTGRESQL__NAME=${POSTGRES_DB:-authentik}
  12. - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD:?error}
  13. # (Required) To generate a secret key run the following command:
  14. # echo $(openssl rand -base64 32)
  15. - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY:?error}
  16. # (Optional) Enable Error Reporting
  17. - AUTHENTIK_ERROR_REPORTING__ENABLED=${AUTHENTIK_ERROR_REPORTING:-false}
  18. # (Optional) Enable Email Sending
  19. # Highly recommended to notify you about alerts and configuration issues.
  20. - AUTHENTIK_EMAIL__HOST=${EMAIL_HOST:?error}
  21. - AUTHENTIK_EMAIL__PORT=${EMAIL_PORT:-25}
  22. - AUTHENTIK_EMAIL__USERNAME=${EMAIL_USERNAME:?error}
  23. - AUTHENTIK_EMAIL__PASSWORD=${EMAIL_PASSWORD:?error}
  24. - AUTHENTIK_EMAIL__USE_TLS=${EMAIL_USE_TLS:-false}
  25. - AUTHENTIK_EMAIL__USE_SSL=${EMAIL_USE_SSL:-false}
  26. - AUTHENTIK_EMAIL__TIMEOUT=${EMAIL_TIMEOUT:-10}
  27. - AUTHENTIK_EMAIL__FROM=${EMAIL_FROM:?error}
  28. ports:
  29. # (Optional) Remove these, if you're using a reverse proxy like Traefik.
  30. - 9000:9000
  31. - 9443:9443
  32. labels:
  33. # (Optional) Enable Traefik integration for the Authentik Web UI. For more information
  34. # about integrating other services with Traefik and Authentik, see the
  35. # documentation at https://goauthentik.io/docs/outposts/integrations/traefik
  36. # and the middleware example files in `docker-compose/traefik/config`.
  37. - traefik.enable=true
  38. - traefik.http.services.authentik.loadbalancer.server.port=9000
  39. - traefik.http.services.authentik.loadbalancer.server.scheme=http
  40. - traefik.http.routers.authentik.entrypoints=websecure
  41. - traefik.http.routers.authentik.rule=Host(`your-authentik-fqdn`)
  42. - traefik.http.routers.authentik.tls=true
  43. - traefik.http.routers.authentik.tls.certresolver=cloudflare
  44. volumes:
  45. - ./media:/media
  46. - ./custom-templates:/templates
  47. depends_on:
  48. - postgres
  49. - redis
  50. restart: unless-stopped
  51. worker:
  52. image: ghcr.io/goauthentik/server:2025.6.3
  53. container_name: authentik-worker
  54. command: worker
  55. environment:
  56. - AUTHENTIK_REDIS__HOST=authentik-redis
  57. - AUTHENTIK_POSTGRESQL__HOST=authentik-db
  58. - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER:-authentik}
  59. - AUTHENTIK_POSTGRESQL__NAME=${POSTGRES_DB:-authentik}
  60. - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD:?error}
  61. # (Required) To generate a secret key run the following command:
  62. # echo $(openssl rand -base64 32)
  63. - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY:?error}
  64. # (Optional) Enable Error Reporting
  65. - AUTHENTIK_ERROR_REPORTING__ENABLED=${AUTHENTIK_ERROR_REPORTING:-false}
  66. # (Optional) Enable Email Sending
  67. # Highly recommended to notify you about alerts and configuration issues.
  68. - AUTHENTIK_EMAIL__HOST=${EMAIL_HOST:?error}
  69. - AUTHENTIK_EMAIL__PORT=${EMAIL_PORT:-25}
  70. - AUTHENTIK_EMAIL__USERNAME=${EMAIL_USERNAME:?error}
  71. - AUTHENTIK_EMAIL__PASSWORD=${EMAIL_PASSWORD:?error}
  72. - AUTHENTIK_EMAIL__USE_TLS=${EMAIL_USE_TLS:-false}
  73. - AUTHENTIK_EMAIL__USE_SSL=${EMAIL_USE_SSL:-false}
  74. - AUTHENTIK_EMAIL__TIMEOUT=${EMAIL_TIMEOUT:-10}
  75. - AUTHENTIK_EMAIL__FROM=${EMAIL_FROM:?error}
  76. # (Optional) See more for the docker socket integration here:
  77. # https://goauthentik.io/docs/outposts/integrations/docker
  78. user: root
  79. volumes:
  80. - /run/docker.sock:/run/docker.sock
  81. - ./media:/media
  82. - ./certs:/certs
  83. - ./custom-templates:/templates
  84. depends_on:
  85. - postgres
  86. - redis
  87. restart: unless-stopped
  88. redis:
  89. image: docker.io/library/redis:8.2.1
  90. container_name: authentik-redis
  91. command: --save 60 1 --loglevel warning
  92. healthcheck:
  93. test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
  94. start_period: 20s
  95. interval: 30s
  96. retries: 5
  97. timeout: 3s
  98. volumes:
  99. - redis_data:/data
  100. restart: unless-stopped
  101. postgres:
  102. # (Optional) Add a PostgreSQL Database for Authentik
  103. # Alternatively, you can host your PostgreSQL database externally, and
  104. # change the connection settings in the `authentik-server` and
  105. # `authentik-worker`.
  106. image: docker.io/library/postgres:17.6
  107. container_name: authentik-db
  108. environment:
  109. - POSTGRES_USER=${POSTGRES_USER:-authentik}
  110. - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?error}
  111. - POSTGRES_DB=${POSTGRES_DB:-authentik}
  112. - TZ=${TZ:-UTC}
  113. healthcheck:
  114. test: ['CMD-SHELL', 'pg_isready -U "${POSTGRES_USER:-authentik}"']
  115. start_period: 30s
  116. interval: 10s
  117. timeout: 10s
  118. retries: 5
  119. volumes:
  120. - postgres_data:/var/lib/postgresql/data
  121. restart: unless-stopped
  122. volumes:
  123. postgres_data:
  124. driver: local
  125. redis_data:
  126. driver: local