prometheus-server-app/docker/app/pkg/start.sh

25 lines
855 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
if [ ! -f /app/data/prometheus_variables.sh ]; then
echo "=> Copy default prometheus variable file since it does not exist"
cp /app/code/default_prometheus_variables.sh /app/data/prometheus_variables.sh
fi
echo "=> Source custom variables"
source /app/data/prometheus_variables.sh
echo "=> Starting Prometheus"
echo "=> Starting 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}"