template.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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.5.3
  12. author: "Christian Lempa"
  13. date: "2025-10-02"
  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' (port 80)"
  45. ports_https:
  46. type: "int"
  47. description: "HTTPS port (external)"
  48. default: 443
  49. extra: "Maps to entrypoint 'websecure' (port 443)"
  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 (non-TLS)"
  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. extra: "Exposes metrics on internal port 9090 (not publicly exposed)"
  86. traefik_tls:
  87. title: "TLS Settings"
  88. needs: []
  89. vars:
  90. traefik_tls_enabled:
  91. type: "bool"
  92. description: "Enable HTTPS/TLS with ACME"
  93. default: false
  94. traefik_tls_entrypoint:
  95. type: "str"
  96. description: "TLS entrypoint"
  97. default: "websecure"
  98. traefik_tls_certresolver:
  99. type: "str"
  100. description: "Traefik certificate resolver name"
  101. default: "cloudflare"
  102. traefik_tls_acme_provider:
  103. type: "enum"
  104. description: "ACME DNS challenge provider"
  105. default: "cloudflare"
  106. options:
  107. - "cloudflare"
  108. extra: "DNS provider for domain validation"
  109. traefik_tls_acme_token:
  110. type: "str"
  111. description: "DNS provider API token"
  112. sensitive: true
  113. traefik_tls_acme_email:
  114. type: "str"
  115. description: "Email address for ACME (Let's Encrypt) registration"
  116. default: "admin@example.com"
  117. extra: "Required for Let's Encrypt certificate requests"
  118. traefik_tls_redirect:
  119. type: "bool"
  120. description: "Redirect all HTTP traffic to HTTPS"
  121. default: true
  122. traefik_tls_min_version:
  123. type: "enum"
  124. description: "Minimum TLS version"
  125. default: "VersionTLS12"
  126. options:
  127. - "VersionTLS12"
  128. - "VersionTLS13"
  129. extra: "TLS 1.2 is recommended for compatibility, TLS 1.3 for maximum security"
  130. traefik_tls_secure_ciphers:
  131. type: "bool"
  132. description: "Enable strict cipher suites (recommended)"
  133. default: true
  134. extra: "Enforces modern, secure cipher suites"
  135. traefik_tls_skipverify:
  136. type: "bool"
  137. description: "Skip TLS verification for backend servers"
  138. default: false
  139. extra: "WARNING: Only enable for self-signed certificates in trusted environments"
  140. swarm:
  141. needs: []
  142. vars:
  143. traefik_tls_acme_secret_name:
  144. type: "str"
  145. description: "Docker Swarm secret name for API token"
  146. default: "cloudflare_api_token"
  147. authentik:
  148. title: Authentik Middleware
  149. description: Enable Authentik SSO integration for Traefik
  150. vars:
  151. authentik_outpost_url:
  152. type: "url"
  153. description: "Authentik outpost URL (e.g., http://authentik-outpost:9000)"
  154. default: "http://authentik-outpost:9000"
  155. traefik_authentik_middleware_name:
  156. type: "str"
  157. description: "Name of the Authentik middleware"
  158. default: "authentik"
  159. extra: "Reference this in router labels as '{name}@file'"