Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
claude/adoring-hopper-5x74bqclaude/affectionate-feynman-ykrf1hclaude/architecture-audit-design-wxprenclaude/build-status-update-3MXsfclaude/charming-meitner-mllb5rclaude/compare-gate-gluecron-s4mFQclaude/confident-faraday-tikcwbclaude/continue-work-XMTlIclaude/crontech-gluecron-deploy-7MIECclaude/crontech-platform-setup-SeKfwclaude/design-2026claude/ecstatic-ptolemy-jMdigclaude/enhance-github-integration-QNHdGclaude/fix-aa-loop-issue-PonMQclaude/fix-actions-and-processclaude/fix-desktop-errors-XqoW8claude/fix-red-workflowsclaude/fix-website-access-6FKJNclaude/gatetest-integration-hardeningclaude/github-audit-improvements-bDFr9claude/gluecron-launch-status-FoMRlclaude/hopeful-lamport-olfCTclaude/issue-to-pr-and-protectionsclaude/jolly-heisenberg-2sg1Qclaude/launch-preparation-QmTb6claude/new-session-xk1l7claude/plan-platform-architecture-kkN4yclaude/platform-analysis-roadmap-1nUGLclaude/platform-launch-assessment-8dWV8claude/polish-platform-release-AeDrUclaude/resume-previous-work-KzyLwclaude/review-crontech-handoff-qYEVqclaude/review-project-completeness-lHhS2claude/review-readme-docs-ulqPKclaude/serene-edison-rj87weclaude/setup-multi-repo-dev-BCwNQclaude/ship-fixes-and-tests-Jvz1cclaude/site-audit-competitive-pctlwgclaude/site-migration-vercel-XstpKclaude/standalone-product-repos-XHFTDcopilot/feat-smart-empty-states-keyboard-first-enhancementcopilot/feat-smart-morning-digest-review-context-restorecopilot/fix-and-process-workflowscopilot/update-ai-powered-code-reviewfeat/debt-mapfeat/push-policy-codeowners-hardeningfeat/smart-digest-contextfeat/stage-impactfeat/t1-secret-migrationfeat/u-polishfeat/w-self-hostfeat/w2-claude-configfix/agent-journey-orphan-sweepgatetest/auto-fix-1776586424172gatetest/auto-fix-1776586534814gatetest/auto-fix-1776590685143gatetest/auto-fix-1776590808199mainops/redeploy-retriggerstyle/dxt-cta-themeworktree-agent-a3377aad30d55da26worktree-agent-a7ef607b7ee1d6c74
BACKUP_RESTORE_DRILL.md3.3 KB · 92 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Backup Restore Drill

Proves the backup pipeline actually works — dumps prod, restores to a
scratch DB, runs a sanity query, reports green/red. Run this BEFORE the
first customer trusts gluecron with their repos. Then run it monthly
from cron so the drill is rehearsed continuously, not theoretically.

## Pre-reqs

- `pg_dump` and `psql` on PATH (`apt-get install -y postgresql-client` on the box)
- `DATABASE_URL` pointing at the prod DB (Neon)
- `SCRATCH_DATABASE_URL` pointing at a writable empty DB (Neon branch is
  ideal; can also be a local Postgres for the drill)
- Disk space for the dump (a few hundred MB once gluecron has real users)

## Run it

```sh
docker compose exec gluecron bash scripts/backup-restore-drill.sh
```

Or manually from anywhere with `psql`:

```sh
DATABASE_URL="postgresql://...prod..." \
SCRATCH_DATABASE_URL="postgresql://...scratch..." \
bash scripts/backup-restore-drill.sh
```

The script:

1. `pg_dump --format=custom` the prod DB into `/tmp/gluecron-drill-<ts>.dump`
2. Drops + recreates `users` (and a few other key tables) in the scratch DB
3. `pg_restore` the dump into scratch
4. Runs verification queries:
   - `SELECT COUNT(*) FROM users;` matches prod
   - `SELECT COUNT(*) FROM repositories;` matches prod
   - `SELECT COUNT(*) FROM site_admins;` matches prod
   - Schema row count from `information_schema.tables` matches prod
5. Reports PASS/FAIL per check and a summary at the end
6. Cleans up the dump file unless `--keep-dump` is passed

A failed drill is a paging-grade alert. The most common cause is a
schema drift between the dump and the restore DB — fix by either
resetting scratch (`DROP DATABASE; CREATE DATABASE`) or by running
`bun run db:migrate` on it before restoring.

## Cron it

Monthly is enough for the v1 user base. Add this to the box's crontab
(remember to keep the env file accessible):

```cron
# At 03:00 on day-of-month 1, run the backup-restore drill, log the result.
0 3 1 * *  cd /opt/gluecron && /usr/bin/env bash scripts/backup-restore-drill.sh >> /var/log/gluecron/drill.log 2>&1
```

Then scrape the log via the existing alerting rule
(`infra/alerts/gluecron.rules.yml`) by adding a once-monthly
`drill_last_success_seconds` metric — the script writes a tiny
`/var/lib/gluecron/drill-last-success` timestamp file when it passes
which you can convert to a metric via node_exporter's textfile collector.

## What "green" looks like

```
[drill 2026-05-13 03:00:01] dumping prod DB ...
[drill 2026-05-13 03:00:08] dump complete: 47 MB at /tmp/gluecron-drill-1715569201.dump
[drill 2026-05-13 03:00:08] restoring into scratch ...
[drill 2026-05-13 03:00:31] restore complete
[drill 2026-05-13 03:00:31] verification:
  PASS  users count        prod=128         scratch=128
  PASS  repositories count prod=412         scratch=412
  PASS  site_admins count  prod=2           scratch=2
  PASS  schema tables      prod=96          scratch=96
[drill 2026-05-13 03:00:32] All checks passed. Took 31s.
```

## What "red" looks like

```
  FAIL  users count        prod=128         scratch=0
```

=> the restore didn't actually populate. Re-run with `--verbose` and check
   `pg_restore` output. Usually a permissions issue on the scratch DB.

```
  FAIL  schema tables      prod=96          scratch=84
```

=> schema drift. Run `bun run db:migrate` against scratch, then re-run.