mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-02 18:17:11 +09:00
The metrics endpoint only accepted a PROMETHEUS_TOKEN env var that almost no install sets, and the Prometheus template's config never reached its container. The panel now keeps its own scrape token in an internal vault, hands it to templates as SERVERKIT_METRICS_TOKEN, and the template ships a prometheus.yml with a serverkit job.
97 lines
2.6 KiB
YAML
97 lines
2.6 KiB
YAML
id: prometheus
|
|
name: Prometheus
|
|
version: "2.48"
|
|
description: Open-source monitoring and alerting toolkit designed for reliability and scalability
|
|
icon: https://serverkit.ai/imgs/template-icons/prometheus.svg
|
|
website: https://prometheus.io
|
|
documentation: https://prometheus.io/docs/
|
|
categories:
|
|
- monitoring
|
|
- metrics
|
|
- alerting
|
|
|
|
variables:
|
|
- name: HTTP_PORT
|
|
description: HTTP port
|
|
type: port
|
|
default: "9090"
|
|
hidden: true
|
|
- name: RETENTION_TIME
|
|
description: Data retention period
|
|
default: 15d
|
|
- name: PANEL_TARGET
|
|
description: Where Prometheus reaches this panel (host:port, from inside the container)
|
|
default: host.docker.internal:80
|
|
hidden: true
|
|
- name: PANEL_SCHEME
|
|
description: http, or https if the panel only answers on HTTPS
|
|
default: http
|
|
hidden: true
|
|
|
|
# What an app (Grafana) gets through `fromService`, over the shared network.
|
|
connection:
|
|
port: 9090
|
|
properties:
|
|
url: "http://{host}:{port}"
|
|
|
|
files:
|
|
- path: /etc/prometheus/prometheus.yml
|
|
content: |
|
|
# Written by ServerKit at install. The serverkit job scrapes this panel
|
|
# (/api/v1/fleet-monitor/prometheus) with the panel's own scrape token.
|
|
global:
|
|
scrape_interval: 15s
|
|
evaluation_interval: 15s
|
|
|
|
scrape_configs:
|
|
- job_name: prometheus
|
|
static_configs:
|
|
- targets: ['localhost:9090']
|
|
|
|
- job_name: serverkit
|
|
scheme: ${PANEL_SCHEME}
|
|
metrics_path: /api/v1/fleet-monitor/prometheus
|
|
params:
|
|
token: ['${SERVERKIT_METRICS_TOKEN}']
|
|
static_configs:
|
|
- targets: ['${PANEL_TARGET}']
|
|
|
|
ports:
|
|
- port: 9090
|
|
protocol: tcp
|
|
description: Web interface and API
|
|
|
|
volumes:
|
|
- name: data
|
|
path: /prometheus
|
|
description: Prometheus data storage
|
|
|
|
requirements:
|
|
memory: 2GB
|
|
storage: 20GB
|
|
|
|
compose:
|
|
services:
|
|
prometheus:
|
|
image: prom/prometheus:v${VERSION:-2.48.0}
|
|
container_name: ${APP_NAME}
|
|
restart: unless-stopped
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
- '--storage.tsdb.retention.time=${RETENTION_TIME}'
|
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
- '--web.console.templates=/etc/prometheus/consoles'
|
|
- '--web.enable-lifecycle'
|
|
# Lets the container reach the panel on the host (Linux has no
|
|
# host.docker.internal otherwise).
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
volumes:
|
|
- prometheus_data:/prometheus
|
|
ports:
|
|
- "${HTTP_PORT}:9090"
|
|
|
|
volumes:
|
|
prometheus_data:
|