prometheus-server-app/start.sh
2023-07-11 19:19:24 +05:30

33 lines
1 KiB
Bash
Executable file

#!/bin/bash
set -eu
# migration remove in next release
[[ -d /app/data/runtime ]] && mv /app/data/runtime /app/data/storage
mkdir -p /app/data/storage /app/data/config
if [[ ! -f /app/data/config/prometheus.yml ]]; then
echo "=> Creating config file on first run"
cp /app/code/prometheus.yml /app/data/config/prometheus.yml
fi
chown -R cloudron:cloudron /app/data
[[ -f /app/data/prometheus_variables.sh ]] && mv /app/data/prometheus_variables.sh /app/data/env.sh
if [[ ! -f /app/data/env.sh ]]; then
echo "=> Copy default env.sh"
cp /app/pkg/env.sh.template /app/data/env.sh
fi
# 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
fi
echo "=> Source custom variables for cli args"
source /app/data/env.sh
echo "=> Starting Prometheus"
exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml ${cli_options}