template.yaml 2.7 KB

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