Skip to content

Commit

Permalink
feat: enforce env vars with run.sh to start prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
apham0001 committed Jan 30, 2025
1 parent 04d2113 commit 5b17632
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions prometheus/run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5b17632

Please sign in to comment.