fix(monitoring): fix Grafana datasource UID to 'Prometheus' and handle metrics-token directory mount issue in deploy script
This commit is contained in:
@@ -147,6 +147,13 @@ for i in $(seq 1 "$HEALTH_CHECK_MAX_ITERATIONS"); do
|
||||
if [ "$ACTUAL" = "$GIT_COMMIT" ]; then
|
||||
echo "OK build-info commit=$ACTUAL"
|
||||
echo "=== Updating monitoring stack ==="
|
||||
# Fix potential Docker directory/file mount corruption for metrics-token
|
||||
if [ -d monitoring/metrics-token ]; then
|
||||
echo "WARN: monitoring/metrics-token is a directory on host, removing it"
|
||||
rm -rf monitoring/metrics-token
|
||||
git checkout monitoring/metrics-token || echo "default-token-value" > monitoring/metrics-token
|
||||
fi
|
||||
|
||||
if [ -f /opt/memento/.env.docker ]; then
|
||||
export $(cat /opt/memento/.env.docker | grep -v '^#' | xargs)
|
||||
fi
|
||||
@@ -158,27 +165,12 @@ for i in $(seq 1 "$HEALTH_CHECK_MAX_ITERATIONS"); do
|
||||
docker compose -f monitoring/docker-compose.monitoring.yml up -d --remove-orphans 2>&1 || echo "WARN: Failed to bring up monitoring stack"
|
||||
fi
|
||||
|
||||
# Force recreation of Grafana to reload physical JSON dashboards mounted from the host
|
||||
echo "=== Recreating Grafana to load updated dashboards ==="
|
||||
docker compose -f monitoring/docker-compose.monitoring.yml up -d --force-recreate grafana 2>&1 || true
|
||||
# Force recreation of Grafana, Prometheus and Alertmanager to apply config changes and fix mounts
|
||||
echo "=== Recreating Grafana, Prometheus and Alertmanager containers ==="
|
||||
docker compose -f monitoring/docker-compose.monitoring.yml up -d --force-recreate grafana prometheus alertmanager 2>&1 || true
|
||||
|
||||
# Diagnostics for Grafana dashboard loading
|
||||
echo "=== Waiting for Grafana initialization ==="
|
||||
sleep 4
|
||||
echo "=== Grafana Mounted Dashboards ==="
|
||||
docker exec memento-grafana ls -la /etc/grafana/dashboards || true
|
||||
echo "=== Grafana Container Logs (Provisioning/Errors) ==="
|
||||
docker logs memento-grafana --tail=100 || true
|
||||
|
||||
if docker ps --format '{{.Names}}' | grep -q "^memento-prometheus$"; then
|
||||
echo "=== Reloading Prometheus configuration ==="
|
||||
docker compose -f monitoring/docker-compose.monitoring.yml exec -T prometheus kill -SIGHUP 1 2>/dev/null || true
|
||||
fi
|
||||
if docker ps --format '{{.Names}}' | grep -q "^memento-alertmanager$"; then
|
||||
echo "=== Reloading Alertmanager configuration ==="
|
||||
docker compose -f monitoring/docker-compose.monitoring.yml exec -T alertmanager kill -SIGHUP 1 2>/dev/null || true
|
||||
fi
|
||||
docker compose ps
|
||||
|
||||
telegram_notify "success" "Deployment successful — app is healthy"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user