compose.yaml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. name: "Traefik"
  3. description: "An open-source edge router for microservices"
  4. version: "0.0.1"
  5. date: "2023-10-01"
  6. author: "Christian Lempa"
  7. tags:
  8. - traefik
  9. - reverse-proxy
  10. - load-balancer
  11. files:
  12. - config/traefik.yaml
  13. variables:
  14. acme_email:
  15. display: "ACME Email"
  16. description: "Email address for ACME (Let's Encrypt) registration"
  17. type: "str"
  18. traefik.host:
  19. display: "Traefik Host"
  20. description: "Domain name for Traefik dashboard"
  21. type: "str"
  22. database.name:
  23. display: "Database Name"
  24. description: "Name of the database"
  25. type: "str"
  26. ---
  27. services:
  28. traefik:
  29. image: docker.io/library/traefik:v3.5.1
  30. container_name: traefik
  31. ports:
  32. - 80:80
  33. - 443:443
  34. # --> (Optional) Enable Dashboard, don't do in production
  35. # - 8080:8080
  36. # <--
  37. volumes:
  38. - /run/docker.sock:/run/docker.sock:ro
  39. - ./config/:/etc/traefik/:ro
  40. - ./certs/:/var/traefik/certs/:rw
  41. environment:
  42. - CF_DNS_API_TOKEN={{ acme_email }} # Using template variable
  43. {% if traefik.host -%}
  44. - TRAEFIK_HOST={{ traefik.host }}
  45. {% endif %}
  46. {% if database.name -%}
  47. - DB_NAME={{ database.name }}
  48. {% endif %}
  49. networks:
  50. - frontend
  51. restart: unless-stopped
  52. networks:
  53. frontend:
  54. external: true # <-- (Optional) Change this to false if you want to create a new network