diff --git a/docker-compose.yml b/docker-compose.yml index 079db67..7bfef0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -152,9 +152,12 @@ services: image: prom/prometheus:${PROMETHEUS_VERSION:-v2.46.0} user: ":" networks: [dvnode] + environment: + PROM_REMOTE_WRITE_TOKEN: ${PROM_REMOTE_WRITE_TOKEN:-"obol-monitoring-token-needed"} volumes: - - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + - ./prometheus:/etc/prometheus - ./data/prometheus:/prometheus + entrypoint: /etc/prometheus/run.sh restart: unless-stopped grafana: diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml.example similarity index 100% rename from prometheus/prometheus.yml rename to prometheus/prometheus.yml.example diff --git a/prometheus/run.sh b/prometheus/run.sh new file mode 100755 index 0000000..4fcc981 --- /dev/null +++ b/prometheus/run.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ -z "$PROM_REMOTE_WRITE_TOKEN" ] +then + echo "\$PROM_REMOTE_WRITE_TOKEN variable is empty" >&2 + exit 1 +fi + +sed "s|\$PROM_REMOTE_WRITE_TOKEN|${PROM_REMOTE_WRITE_TOKEN}|g" \ + /etc/prometheus/prometheus.yml.example > /etc/prometheus/prometheus.yml + +/bin/prometheus \ + --config.file=/etc/prometheus/prometheus.yml