template.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ---
  2. kind: compose
  3. metadata:
  4. icon:
  5. provider: selfh
  6. id: prometheus
  7. name: Prometheus
  8. description: 'Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud.
  9. It is designed for reliability and scalability, making it suitable for monitoring dynamic cloud environments.
  10. Prometheus collects and stores metrics as time series data, providing powerful querying capabilities and integration with
  11. various visualization tools.
  12. ## Swarm Deployment Warning
  13. Prometheus uses local TSDB storage and does NOT support running multiple replicas.
  14. This template enforces a single replica with node placement constraints. For true HA, consider remote storage solutions
  15. (Thanos, Cortex, VictoriaMetrics).
  16. Project: https://prometheus.io/
  17. Documentation: https://prometheus.io/docs/
  18. GitHub: https://github.com/prometheus/prometheus
  19. '
  20. version: v3.8.1
  21. author: Christian Lempa
  22. date: '2025-12-16'
  23. tags:
  24. - traefik
  25. - swarm
  26. - authentik
  27. next_steps: "{% if swarm_enabled -%}\n1. Deploy to Docker Swarm:\n docker stack deploy -c compose.yaml {{ service_name\
  28. \ }}\n2. Access Prometheus:\n {%- if traefik_enabled %} https://{{ traefik_host }}\n {%- else %} http://<swarm-node-ip>:{{\
  29. \ ports_http }}{%- endif %}\n{% else -%}\n1. Start Prometheus with Docker Compose:\n docker compose up -d\n2. Access\
  30. \ Prometheus:\n {%- if traefik_enabled %} https://{{ traefik_host }}\n {%- else %} http://localhost:{{ ports_http\
  31. \ }}{%- endif %}\n{% endif -%}\n3. Edit config/prometheus.yaml to add scrape targets\n4. Reload configuration: docker\
  32. \ exec {{ container_name if not swarm_enabled else service_name }} kill -HUP 1\n"
  33. schema: '1.2'
  34. spec:
  35. general:
  36. vars:
  37. service_name:
  38. default: prometheus
  39. restart_policy:
  40. type: enum
  41. options:
  42. - unless-stopped
  43. - always
  44. - on-failure
  45. - 'no'
  46. default: unless-stopped
  47. required: true
  48. metrics:
  49. title: Metrics & Storage
  50. description: Configure data retention and storage settings
  51. vars:
  52. metrics_retention_time:
  53. type: str
  54. description: How long to retain samples (e.g., 15d, 30d, 1y)
  55. default: 15d
  56. extra: Older data will be deleted. Use 'h', 'd', 'w', 'y' for time units.
  57. metrics_retention_size:
  58. type: str
  59. description: Maximum storage size (e.g., 5GB, 10GB, 1TB)
  60. default: '0'
  61. extra: Set to 0 for unlimited. Triggers deletion when exceeded.
  62. metrics_enable_remote_write:
  63. type: bool
  64. description: Enable remote write receiver (allows pushing metrics via /api/v1/write)
  65. default: false
  66. extra: 'Caution: Intended for low-volume use cases only. Not efficient for general ingestion.'
  67. ports:
  68. vars:
  69. ports_http:
  70. default: 9090
  71. traefik:
  72. vars:
  73. traefik_host:
  74. default: prometheus
  75. traefik_network:
  76. default: traefik
  77. type: str
  78. required: true
  79. traefik_domain:
  80. default: home.arpa
  81. type: str
  82. required: true
  83. traefik_enabled:
  84. type: bool
  85. default: false
  86. description: Enable Traefik integration
  87. traefik_tls:
  88. vars:
  89. traefik_tls_certresolver:
  90. type: str
  91. default: cloudflare
  92. required: true
  93. traefik_tls_enabled:
  94. type: bool
  95. default: false
  96. description: Enable Traefik TLS