prometheus-server-app/start.sh
Girish Ramakrishnan ca20c3277c typo
2023-05-05 09:24:45 +02:00

26 lines
829 B
Bash
Executable file

#!/bin/bash
set -eu
mkdir -p /app/data/runtime /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
echo "=> Source custom variables"
source /app/data/env.sh
echo "=> Starting Prometheus with retention time of $retention_time"
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}"