template.yaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. ---
  2. kind: compose
  3. schema: "1.1"
  4. metadata:
  5. name: Traefik
  6. description: >
  7. Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
  8. This template sets up Traefik with automatic HTTPS using Let's Encrypt and can be integrated with Authentik for SSO.
  9. Project: https://traefik.io/
  10. Documentation: https://doc.traefik.io/traefik/
  11. version: v3.6.0
  12. author: "Christian Lempa"
  13. date: '2025-11-08'
  14. tags:
  15. - traefik
  16. - authentik
  17. - swarm
  18. next_steps: |
  19. {% if swarm_enabled %}
  20. 1. Deploy Traefik to Docker Swarm:
  21. docker stack deploy -c docker-compose.yaml traefik
  22. {% else %}
  23. 1. Start Traefik with Docker Compose:
  24. docker compose up -d
  25. {% endif %}
  26. spec:
  27. general:
  28. title: "General"
  29. required: true
  30. vars:
  31. service_name:
  32. default: "traefik"
  33. container_name:
  34. default: "traefik"
  35. container_hostname:
  36. default: "traefik"
  37. ports:
  38. needs: []
  39. vars:
  40. ports_http:
  41. type: "int"
  42. description: "HTTP port (external)"
  43. default: 80
  44. extra: "Maps to entrypoint 'web'"
  45. ports_https:
  46. type: "int"
  47. description: "HTTPS port (external)"
  48. default: 443
  49. extra: "Maps to entrypoint 'websecure'"
  50. ports_dashboard:
  51. type: "int"
  52. description: "Dashboard port (external)"
  53. default: 8080
  54. extra: "Only used when dashboard is enabled"
  55. traefik:
  56. title: "Settings"
  57. needs: []
  58. vars:
  59. traefik_network:
  60. type: "str"
  61. description: "Traefik network name"
  62. default: "traefik"
  63. extra: "Network that Traefik uses to connect to services"
  64. traefik_network_external:
  65. type: "bool"
  66. description: "Use existing Docker network (external)"
  67. default: false
  68. traefik_entrypoint:
  69. type: "str"
  70. description: "HTTP entrypoint"
  71. default: "web"
  72. dashboard_enabled:
  73. type: "bool"
  74. description: "Enable Traefik dashboard"
  75. default: false
  76. extra: "WARNING: Don't use in production!"
  77. accesslog_enabled:
  78. type: "bool"
  79. description: "Enable Traefik access log"
  80. default: false
  81. prometheus_enabled:
  82. type: "bool"
  83. description: "Enable Prometheus metrics"
  84. default: false
  85. security_enabled:
  86. type: "bool"
  87. description: "Create production-ready security headers middleware"
  88. default: true
  89. extra: "Enables HSTS, XSS protection, frame denial, etc."
  90. traefik_security_middleware_name:
  91. type: "str"
  92. description: "Name of the security headers middleware"
  93. default: "security-headers"
  94. needs: "security_enabled"
  95. extra: "Reference in router labels as '{name}@file'"
  96. traefik_tls:
  97. title: "TLS Settings"
  98. needs: []
  99. vars:
  100. traefik_tls_enabled:
  101. type: "bool"
  102. description: "Enable HTTPS/TLS with ACME"
  103. default: false
  104. traefik_tls_entrypoint:
  105. type: "str"
  106. description: "TLS entrypoint"
  107. default: "websecure"
  108. traefik_tls_certresolver:
  109. type: "str"
  110. description: "Traefik certificate resolver name"
  111. default: "cloudflare"
  112. traefik_tls_acme_provider:
  113. type: "enum"
  114. description: "ACME DNS challenge provider"
  115. default: "cloudflare"
  116. options:
  117. - "cloudflare"
  118. extra: "DNS provider for domain validation"
  119. traefik_tls_acme_token:
  120. type: "str"
  121. description: "DNS provider API token"
  122. sensitive: true
  123. traefik_tls_acme_email:
  124. type: "str"
  125. description: "Email address for ACME (Let's Encrypt) registration"
  126. default: "admin@example.com"
  127. extra: "Required for Let's Encrypt certificate requests"
  128. traefik_tls_redirect:
  129. type: "bool"
  130. description: "Redirect all HTTP traffic to HTTPS"
  131. default: true
  132. traefik_tls_min_version:
  133. type: "enum"
  134. description: "Minimum TLS version"
  135. default: "VersionTLS12"
  136. options:
  137. - "VersionTLS12"
  138. - "VersionTLS13"
  139. extra: "TLS 1.2 is recommended for compatibility, TLS 1.3 for maximum security"
  140. traefik_tls_secure_ciphers:
  141. type: "bool"
  142. description: "Enable strict cipher suites (recommended)"
  143. default: true
  144. extra: "Enforces modern, secure cipher suites"
  145. traefik_tls_skipverify:
  146. type: "bool"
  147. description: "Skip TLS verification for backend servers"
  148. default: false
  149. extra: "WARNING: Only enable for self-signed certificates in trusted environments"
  150. swarm:
  151. needs: []
  152. vars:
  153. traefik_tls_acme_secret_name:
  154. type: "str"
  155. description: "Docker Swarm secret name for API token"
  156. default: "cloudflare_api_token"
  157. authentik:
  158. title: "Authentik Middleware"
  159. description: "Enable Authentik SSO integration for Traefik"
  160. vars:
  161. authentik_enabled:
  162. type: "bool"
  163. description: "Enable Authentik SSO integration"
  164. default: false
  165. authentik_outpost_url:
  166. type: "url"
  167. description: "Authentik outpost URL (e.g., http://authentik-outpost:9000)"
  168. default: "http://authentik-outpost:9000"
  169. needs: "authentik_enabled"
  170. traefik_authentik_middleware_name:
  171. type: "str"
  172. description: "Name of the Authentik middleware"
  173. default: "authentik"
  174. needs: "authentik_enabled"
  175. extra: "Reference in router labels as '{name}@file'"