fix(selfhost): mount observability/backup scripts as directories, not single files#5238
Merged
Merged
Conversation
… single files Found while verifying the Reviews & PRs dashboard fix: the reporting-exporter service bind-mounted export-grafana-reporting-db.sh as a single file. Docker pins a single-file bind mount to that file's inode at container-creation time -- `git pull` replaces a file by writing a new blob then renaming it over the old path, so the running container kept reading the pre-pull script indefinitely with no error, confirmed live (a script edit had zero effect across several git pulls until the container was force-recreated). The same shape existed on the backup and backup-exporter services for backup.sh, verify-backup.sh, selfhost-pg-url.sh, and backup-metrics.sh. Switched all of these to directory bind mounts (./scripts:/scripts:ro), which resolve paths fresh on every access instead of pinning an inode -- the same pattern grafana/dashboards already used, which is why the dashboard JSON itself always updated correctly while the exporter script silently didn't. Updated the doc/usage comments and the one test asserting the old mount shape to match.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | b4a795c | Commit Preview URL Branch Preview URL |
Jul 12 2026, 10:35 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5238 +/- ##
=======================================
Coverage 94.34% 94.34%
=======================================
Files 473 473
Lines 39982 39982
Branches 14576 14576
=======================================
Hits 37722 37722
Misses 1585 1585
Partials 675 675
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while verifying the Reviews & PRs dashboard fix (#5234): the
reporting-exporterservice bind-mountedexport-grafana-reporting-db.shas a single file. Docker pins a single-file bind mount to that file's inode at container-creation time —git pullreplaces a file by writing a new blob then renaming it over the old path, so the running container kept reading the pre-pull script indefinitely with no error. Confirmed live: a script edit had zero effect across severalgit pulls on the deployment server until the container was force-recreated (docker compose up -d --force-recreate --no-deps reporting-exporter) — verified viamd5summismatch between the host file and what the running container actually saw.The same mount shape existed on the
backupandbackup-exporterservices, forbackup.sh,verify-backup.sh,selfhost-pg-url.sh, andbackup-metrics.sh— meaning a backup-script fix would silently never take effect either, without anyone noticing until a real restore was needed.Fix
Switched all of these to directory bind mounts (
./scripts:/scripts:ro), which resolve paths fresh on every access instead of pinning an inode — the same patterngrafana/dashboardsalready used (a directory mount), which is exactly why the dashboard JSON itself always updated correctly on this same deployment while the exporter script silently didn't.Bonus: the directory mount also naturally satisfies
backup.sh/verify-backup.sh's existing. "$(dirname "$0")/selfhost-pg-url.sh"dirname-relative sourcing (invoked as/scripts/backup.sh,dirnameresolves to/scripts, finding/scripts/selfhost-pg-url.shright alongside it) — removing the need for the old comment explaining why that file had to be mounted at container root.Scope
CONTRIBUTING.md.Validation
git diff --checkdocker compose -f docker-compose.yml config --quietnode scripts/validate-observability-configs.mjssh -n scripts/backup.sh/sh -n scripts/verify-backup.shnpx vitest run test/unit/selfhost-observability-config.test.ts— 4/4 pass (updated the one assertion on the old mount/command shape)npm run ui:typecheck/ui:lint(for the one docs page's usage-comment update)npm run docs:drift-checkreporting-exporter, confirmed viamd5sumthat the container now sees the current script, confirmed a fresh export completes successfully and the newissuestable populates correctly.If any required check was skipped, explain why:
src/**production logic changed — this is entirelydocker-compose.yml, shell-script comments, one doc page's code-block text, and one test's fixture expectations.Safety
docs.self-hosting-backup-scaling.tsx's usage examples).UI Evidence
Not applicable — a docs-page code-sample text change only, no visual/layout difference.
Notes
This is a real, previously-unnoticed operational gap: any self-hoster who edited
export-grafana-reporting-db.sh,backup.sh,verify-backup.sh, orbackup-metrics.shand expectedgit pullalone to pick it up would have been silently running stale logic indefinitely, with the container reporting healthy the whole time.