template.yaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. ---
  2. kind: compose
  3. metadata:
  4. name: Traefik
  5. description: 'Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
  6. This template sets up Traefik with automatic HTTPS using Let''s Encrypt and can be integrated with Authentik for SSO.
  7. ## References
  8. - **Project:** https://traefik.io/
  9. - **Documentation:** https://doc.traefik.io/traefik/
  10. - **GitHub:** https://github.com/traefik/traefik'
  11. version: v3.6.5
  12. author: Christian Lempa
  13. date: '2025-12-17'
  14. tags:
  15. - swarm
  16. - volume
  17. icon:
  18. provider: simpleicons
  19. id: traefikproxy
  20. draft: false
  21. next_steps: "Start the `{{ service_name }}` project\n{% if swarm_enabled %}\n1. Deploy Traefik to Docker Swarm:\n `docker\
  22. \ stack deploy -c compose.yaml {{ service_name }}`\n{% else %}\n1. Copy the project directory for `{{ service_name\
  23. \ }}` to the host.\n2. Start Traefik with Docker Compose from the project directory:\n `docker compose up -d`\n{% endif\
  24. \ %}"
  25. schema: '1.2'
  26. spec:
  27. general:
  28. vars:
  29. service_name:
  30. default: traefik
  31. container_name:
  32. type: str
  33. container_hostname:
  34. type: str
  35. container_timezone:
  36. type: str
  37. container_loglevel:
  38. type: enum
  39. options:
  40. - debug
  41. - info
  42. - warn
  43. - error
  44. restart_policy:
  45. type: enum
  46. options:
  47. - unless-stopped
  48. - always
  49. - on-failure
  50. - 'no'
  51. default: unless-stopped
  52. required: true
  53. ports:
  54. vars:
  55. ports_dashboard:
  56. description: Dashboard port (external)
  57. type: int
  58. default: 8080
  59. required: true
  60. needs:
  61. - dashboard_enabled=true
  62. extra: Only used when dashboard is enabled
  63. ports_http:
  64. default: 80
  65. extra: Maps to entrypoint 'web'
  66. ports_https:
  67. default: 443
  68. extra: Maps to entrypoint 'websecure'
  69. traefik:
  70. title: Settings
  71. vars:
  72. accesslog_enabled:
  73. description: Enable Traefik access log
  74. type: bool
  75. default: false
  76. dashboard_enabled:
  77. description: Enable Traefik dashboard
  78. type: bool
  79. default: false
  80. extra: 'WARNING: Don''t use in production!'
  81. prometheus_enabled:
  82. description: Enable Prometheus metrics
  83. type: bool
  84. default: false
  85. security_enabled:
  86. description: Create production-ready security headers middleware
  87. type: bool
  88. default: true
  89. extra: Enables HSTS, XSS protection, frame denial, etc.
  90. traefik_network:
  91. extra: Network that Traefik uses to connect to services
  92. traefik_network_external:
  93. description: Use existing Docker network (external)
  94. type: bool
  95. default: false
  96. traefik_tls:
  97. title: TLS Settings
  98. vars:
  99. traefik_tls_acme_email:
  100. description: Email address for ACME
  101. type: str
  102. required: true
  103. traefik_tls_acme_region:
  104. description: AWS Region
  105. type: str
  106. default: us-east-1
  107. required: true
  108. needs:
  109. - traefik_tls_certresolver=route53
  110. traefik_tls_acme_resource_group:
  111. description: Azure Resource Group
  112. type: str
  113. required: true
  114. needs:
  115. - traefik_tls_certresolver=azure
  116. traefik_tls_acme_secret_key:
  117. description: DNS provider secret key
  118. type: str
  119. sensitive: true
  120. required: true
  121. needs:
  122. - traefik_tls_certresolver=azure,godaddy,porkbun,route53
  123. extra: AZURE_CLIENT_SECRET, GODADDY_API_SECRET, PORKBUN_SECRET_API_KEY, or AWS_SECRET_ACCESS_KEY
  124. traefik_tls_acme_subscription_id:
  125. description: Azure Subscription ID
  126. type: str
  127. required: true
  128. needs:
  129. - traefik_tls_certresolver=azure
  130. traefik_tls_acme_tenant_id:
  131. description: Azure Tenant ID
  132. type: str
  133. required: true
  134. needs:
  135. - traefik_tls_certresolver=azure
  136. traefik_tls_acme_token:
  137. description: DNS provider API token
  138. type: str
  139. sensitive: true
  140. required: true
  141. needs:
  142. - traefik_tls_certresolver=cloudflare,digitalocean,godaddy,namecheap,porkbun
  143. extra: CF_DNS_API_TOKEN, DO_AUTH_TOKEN, GODADDY_API_KEY, NAMECHEAP_API_KEY, or PORKBUN_API_KEY
  144. traefik_tls_acme_username:
  145. description: Namecheap API username
  146. type: str
  147. required: true
  148. needs:
  149. - traefik_tls_certresolver=namecheap
  150. traefik_tls_certresolver:
  151. description: ACME DNS challenge provider
  152. options:
  153. - cloudflare
  154. - porkbun
  155. - godaddy
  156. - digitalocean
  157. - route53
  158. - azure
  159. - namecheap
  160. extra: DNS provider for domain validation
  161. traefik_tls_enabled:
  162. description: Enable HTTPS/TLS with ACME
  163. default: false
  164. traefik_tls_min_version:
  165. description: Minimum TLS version
  166. type: enum
  167. options:
  168. - VersionTLS12
  169. - VersionTLS13
  170. extra: TLS 1.2 is recommended for compatibility, TLS 1.3 for maximum security
  171. traefik_tls_redirect:
  172. description: Redirect all HTTP traffic to HTTPS
  173. type: bool
  174. default: true
  175. traefik_tls_secure_ciphers:
  176. description: Enable strict cipher suites (recommended)
  177. type: bool
  178. extra: Enforces modern, secure cipher suites
  179. traefik_tls_skipverify:
  180. description: Skip TLS verification for backend servers
  181. type: bool
  182. extra: 'WARNING: Only enable for self-signed certificates in trusted environments'
  183. volume:
  184. vars:
  185. volume_mode:
  186. type: enum
  187. options:
  188. - local
  189. - mount
  190. - nfs
  191. default: local
  192. required: true
  193. volume_mount_path:
  194. type: str
  195. default: /mnt/storage
  196. needs:
  197. - volume_mode=mount
  198. required: true
  199. volume_nfs_server:
  200. type: str
  201. default: 192.168.1.1
  202. needs:
  203. - volume_mode=nfs
  204. required: true
  205. volume_nfs_path:
  206. type: str
  207. default: /export
  208. needs:
  209. - volume_mode=nfs
  210. required: true
  211. volume_nfs_options:
  212. type: str
  213. default: rw,nolock,soft
  214. needs:
  215. - volume_mode=nfs
  216. required: true
  217. swarm:
  218. vars:
  219. swarm_placement_mode:
  220. type: enum
  221. options:
  222. - replicated
  223. - global
  224. default: replicated
  225. required: true
  226. swarm_replicas:
  227. type: int
  228. default: 1
  229. needs:
  230. - swarm_placement_mode=replicated
  231. required: true
  232. swarm_placement_host:
  233. type: str
  234. description: Target hostname for placement constraint
  235. default: ''
  236. needs:
  237. - swarm_placement_mode=replicated
  238. extra: Constrains service to run on specific node by hostname
  239. swarm_enabled:
  240. type: bool
  241. default: false
  242. description: Enable Docker Swarm mode