compose.yaml 5.3 KB

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