template.yaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ---
  2. kind: compose
  3. metadata:
  4. name: Traefik
  5. description: |-
  6. Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
  7. This template sets up Traefik with automatic HTTPS using Let's Encrypt and can be integrated with Authentik for SSO.
  8. ## References
  9. - **Project:** https://traefik.io/
  10. - **Documentation:** https://doc.traefik.io/traefik/
  11. - **GitHub:** https://github.com/traefik/traefik
  12. version: v3.6.4
  13. author: Christian Lempa
  14. date: "2025-11-05"
  15. tags:
  16. - swarm
  17. - volume
  18. icon:
  19. provider: simpleicons
  20. id: traefikproxy
  21. draft: false
  22. next_steps: |-
  23. Start the `{{ service_name }}` project
  24. {% if swarm_enabled %}
  25. 1. Deploy Traefik to Docker Swarm:
  26. `docker stack deploy -c docker-compose.yaml {{ service_name }}`
  27. {% else %}
  28. 1. Copy the project directory for `{{ service_name }}` to the host.
  29. 2. Start Traefik with Docker Compose from the project directory:
  30. `docker compose up -d`
  31. {% endif %}
  32. schema: "1.2"
  33. spec:
  34. general:
  35. vars:
  36. service_name:
  37. default: traefik
  38. ports:
  39. vars:
  40. ports_dashboard:
  41. description: Dashboard port (external)
  42. type: int
  43. default: 8080
  44. required: true
  45. needs: [dashboard_enabled=true]
  46. extra: Only used when dashboard is enabled
  47. ports_http:
  48. default: 80
  49. extra: Maps to entrypoint 'web'
  50. ports_https:
  51. default: 443
  52. extra: Maps to entrypoint 'websecure'
  53. traefik:
  54. title: Settings
  55. vars:
  56. accesslog_enabled:
  57. description: Enable Traefik access log
  58. type: bool
  59. default: false
  60. dashboard_enabled:
  61. description: Enable Traefik dashboard
  62. type: bool
  63. default: false
  64. extra: 'WARNING: Don''t use in production!'
  65. prometheus_enabled:
  66. description: Enable Prometheus metrics
  67. type: bool
  68. default: false
  69. security_enabled:
  70. description: Create production-ready security headers middleware
  71. type: bool
  72. default: true
  73. extra: Enables HSTS, XSS protection, frame denial, etc.
  74. traefik_network:
  75. extra: Network that Traefik uses to connect to services
  76. traefik_network_external:
  77. description: Use existing Docker network (external)
  78. type: bool
  79. default: false
  80. traefik_tls:
  81. title: TLS Settings
  82. vars:
  83. traefik_tls_acme_email:
  84. description: Email address for ACME
  85. type: str
  86. required: true
  87. traefik_tls_acme_region:
  88. description: AWS Region
  89. type: str
  90. default: us-east-1
  91. required: true
  92. needs: [traefik_tls_certresolver=route53]
  93. traefik_tls_acme_resource_group:
  94. description: Azure Resource Group
  95. type: str
  96. required: true
  97. needs: [traefik_tls_certresolver=azure]
  98. traefik_tls_acme_secret_key:
  99. description: DNS provider secret key
  100. type: str
  101. sensitive: true
  102. required: true
  103. needs: ['traefik_tls_certresolver=azure,godaddy,porkbun,route53']
  104. extra: AZURE_CLIENT_SECRET, GODADDY_API_SECRET, PORKBUN_SECRET_API_KEY, or AWS_SECRET_ACCESS_KEY
  105. traefik_tls_acme_subscription_id:
  106. description: Azure Subscription ID
  107. type: str
  108. required: true
  109. needs: [traefik_tls_certresolver=azure]
  110. traefik_tls_acme_tenant_id:
  111. description: Azure Tenant ID
  112. type: str
  113. required: true
  114. needs: [traefik_tls_certresolver=azure]
  115. traefik_tls_acme_token:
  116. description: DNS provider API token
  117. type: str
  118. sensitive: true
  119. required: true
  120. needs: ['traefik_tls_certresolver=cloudflare,digitalocean,godaddy,namecheap,porkbun']
  121. extra: CF_DNS_API_TOKEN, DO_AUTH_TOKEN, GODADDY_API_KEY, NAMECHEAP_API_KEY, or PORKBUN_API_KEY
  122. traefik_tls_acme_username:
  123. description: Namecheap API username
  124. type: str
  125. required: true
  126. needs: [traefik_tls_certresolver=namecheap]
  127. traefik_tls_certresolver:
  128. description: ACME DNS challenge provider
  129. options: [cloudflare, porkbun, godaddy, digitalocean, route53, azure, namecheap]
  130. extra: DNS provider for domain validation
  131. traefik_tls_enabled:
  132. description: Enable HTTPS/TLS with ACME
  133. default: false
  134. traefik_tls_min_version:
  135. description: Minimum TLS version
  136. type: enum
  137. options: [VersionTLS12, VersionTLS13]
  138. extra: TLS 1.2 is recommended for compatibility, TLS 1.3 for maximum security
  139. traefik_tls_redirect:
  140. description: Redirect all HTTP traffic to HTTPS
  141. type: bool
  142. default: true
  143. traefik_tls_secure_ciphers:
  144. description: Enable strict cipher suites (recommended)
  145. type: bool
  146. extra: Enforces modern, secure cipher suites
  147. traefik_tls_skipverify:
  148. description: Skip TLS verification for backend servers
  149. type: bool
  150. extra: 'WARNING: Only enable for self-signed certificates in trusted environments'