prometheus-server-app/start.sh

34 lines
1 KiB
Bash
Raw Normal View History

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
# migration remove in next release
[[ -d /app/data/runtime ]] && mv /app/data/runtime /app/data/storage
mkdir -p /app/data/storage /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
2023-05-05 07:24:45 +00:00
[[ -f /app/data/prometheus_variables.sh ]] && mv /app/data/prometheus_variables.sh /app/data/env.sh
2023-05-05 07:08:49 +00:00
if [[ ! -f /app/data/env.sh ]]; then
echo "=> Copy default env.sh"
cp /app/pkg/env.sh.template /app/data/env.sh
fi
2023-07-11 13:41:15 +00:00
# migration remove in next release
if ! grep -q cli_option /app/data/env.sh; then
echo -e '\nexport cli_options="--storage.tsdb.retention.time=$retention_time --storage.tsdb.path=/app/data/storage"' >> /app/data/env.sh
2023-07-11 13:41:15 +00:00
fi
echo "=> Source custom variables for cli args"
2023-05-05 07:08:49 +00:00
source /app/data/env.sh
2023-07-11 13:41:15 +00:00
echo "=> Starting Prometheus"
exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml ${cli_options}