2020-11-07 14:21:18 +00:00
|
|
|
#!/bin/bash
|
2020-11-05 12:54:41 +00:00
|
|
|
|
2020-11-07 14:21:18 +00:00
|
|
|
set -eu
|
2020-11-05 12:54:41 +00:00
|
|
|
|
2020-11-11 00:13:46 +00:00
|
|
|
mkdir -p /app/data/runtime /app/data/config
|
|
|
|
|
2020-11-11 00:15:41 +00:00
|
|
|
if [[ ! -f /app/data/config/prometheus.yml ]]; then
|
|
|
|
echo "=> Creating config file on first run"
|
2020-12-11 05:27:08 +00:00
|
|
|
cp /app/code/prometheus.yml /app/data/config/prometheus.yml
|
2020-11-11 00:15:41 +00:00
|
|
|
fi
|
|
|
|
|
2020-12-11 05:27:08 +00:00
|
|
|
chown -R cloudron:cloudron /app/data
|
|
|
|
|
2022-03-08 17:32:22 +00:00
|
|
|
if [[ ! -f /app/data/prometheus_variables.sh ]]; then
|
2021-10-12 11:34:07 +00:00
|
|
|
echo "=> Copy default prometheus variable file since it does not exist"
|
2022-03-08 17:32:22 +00:00
|
|
|
cp /app/pkg/default_prometheus_variables.sh /app/data/prometheus_variables.sh
|
2021-10-12 11:34:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "=> Source custom variables"
|
|
|
|
source /app/data/prometheus_variables.sh
|
|
|
|
|
2022-03-08 17:32:22 +00:00
|
|
|
echo "=> Starting Prometheus with retention time of $retention_time"
|
2021-10-12 11:34:07 +00:00
|
|
|
exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime --storage.tsdb.retention.time="${retention_time:-15d}"
|