fix(monitoring): fix Grafana datasource UID to 'Prometheus' and handle metrics-token directory mount issue in deploy script
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 5m28s
CI / Deploy production (on server) (push) Successful in 1m22s

This commit is contained in:
Antigravity
2026-05-30 11:54:30 +00:00
parent cecd8ff27d
commit a8785ed4f1
2 changed files with 13 additions and 19 deletions

View File

@@ -7,3 +7,5 @@ datasources:
url: http://prometheus:9090 url: http://prometheus:9090
isDefault: true isDefault: true
editable: true editable: true
uid: Prometheus

View File

@@ -147,6 +147,13 @@ for i in $(seq 1 "$HEALTH_CHECK_MAX_ITERATIONS"); do
if [ "$ACTUAL" = "$GIT_COMMIT" ]; then if [ "$ACTUAL" = "$GIT_COMMIT" ]; then
echo "OK build-info commit=$ACTUAL" echo "OK build-info commit=$ACTUAL"
echo "=== Updating monitoring stack ===" 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 if [ -f /opt/memento/.env.docker ]; then
export $(cat /opt/memento/.env.docker | grep -v '^#' | xargs) export $(cat /opt/memento/.env.docker | grep -v '^#' | xargs)
fi 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" docker compose -f monitoring/docker-compose.monitoring.yml up -d --remove-orphans 2>&1 || echo "WARN: Failed to bring up monitoring stack"
fi fi
# Force recreation of Grafana to reload physical JSON dashboards mounted from the host # Force recreation of Grafana, Prometheus and Alertmanager to apply config changes and fix mounts
echo "=== Recreating Grafana to load updated dashboards ===" echo "=== Recreating Grafana, Prometheus and Alertmanager containers ==="
docker compose -f monitoring/docker-compose.monitoring.yml up -d --force-recreate grafana 2>&1 || true 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 docker compose ps
telegram_notify "success" "Deployment successful — app is healthy" telegram_notify "success" "Deployment successful — app is healthy"
exit 0 exit 0
fi fi