From bddc3d7620fb58ac7ead2cbeebf5aa2ef1066e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Fri, 24 Apr 2026 18:47:18 +0200 Subject: [PATCH] Copy init-grafana-user.sql on every cd-infra deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The postgres init script grants read permissions to `grafana_reader` on `public`, `planner`, `journal`, and `pgboss` schemas. It's mounted into the postgres container via bind mount from `/opt/trails-cool/postgres/init-grafana-user.sql`, and cd-infra re-runs it with `psql -f` after postgres comes up. But `cd-infra.yml` only scp's `infrastructure/postgres/queries.yml` to the flagship — not `init-grafana-user.sql`. The file on the server was the pre-pg-boss-upgrade March version with no pgboss grants. After pg-boss v12 landed and (re)created the `pgboss` schema, the grafana_reader lost schema-level USAGE, the "Background job failures" alert query started erroring with `permission denied for schema pgboss`, and the alert fired as "Alerting (Error)" for hours. Fix: add the init SQL to the scp source list so changes to it actually reach the flagship. I also manually re-granted on the live postgres to clear the firing alert; the next cd-infra deploy will now pick up future edits to the init file too. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/cd-infra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-infra.yml b/.github/workflows/cd-infra.yml index e76dcf3..3ac4b65 100644 --- a/.github/workflows/cd-infra.yml +++ b/.github/workflows/cd-infra.yml @@ -39,7 +39,7 @@ jobs: host: ${{ secrets.DEPLOY_HOST }} username: root key: ${{ secrets.DEPLOY_SSH_KEY }} - source: "infrastructure/docker-compose.yml,infrastructure/Caddyfile,infrastructure/prometheus/prometheus.yml,infrastructure/loki/loki-config.yml,infrastructure/promtail/promtail-config.yml,infrastructure/postgres/queries.yml,infrastructure/grafana/provisioning,infrastructure/grafana/dashboards" + source: "infrastructure/docker-compose.yml,infrastructure/Caddyfile,infrastructure/prometheus/prometheus.yml,infrastructure/loki/loki-config.yml,infrastructure/promtail/promtail-config.yml,infrastructure/postgres/queries.yml,infrastructure/postgres/init-grafana-user.sql,infrastructure/grafana/provisioning,infrastructure/grafana/dashboards" target: /opt/trails-cool strip_components: 1