Skip to content

Commit 5b17632

Browse files
committed
feat: enforce env vars with run.sh to start prometheus
1 parent 04d2113 commit 5b17632

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ services:
152152
image: prom/prometheus:${PROMETHEUS_VERSION:-v2.46.0}
153153
user: ":"
154154
networks: [dvnode]
155+
environment:
156+
PROM_REMOTE_WRITE_TOKEN: ${PROM_REMOTE_WRITE_TOKEN:-"obol-monitoring-token-needed"}
155157
volumes:
156-
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
158+
- ./prometheus:/etc/prometheus
157159
- ./data/prometheus:/prometheus
160+
entrypoint: /etc/prometheus/run.sh
158161
restart: unless-stopped
159162

160163
grafana:
File renamed without changes.

prometheus/run.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
if [ -z "$PROM_REMOTE_WRITE_TOKEN" ]
4+
then
5+
echo "\$PROM_REMOTE_WRITE_TOKEN variable is empty" >&2
6+
exit 1
7+
fi
8+
9+
sed "s|\$PROM_REMOTE_WRITE_TOKEN|${PROM_REMOTE_WRITE_TOKEN}|g" \
10+
/etc/prometheus/prometheus.yml.example > /etc/prometheus/prometheus.yml
11+
12+
/bin/prometheus \
13+
--config.file=/etc/prometheus/prometheus.yml

0 commit comments

Comments
 (0)