Skip to content

feat(deploy): Railway volume snapshots declared in platform.yaml - #122

Merged
jayleaton merged 1 commit into
mainfrom
feat/deploy-volume-snapshots
Oct 23, 2026
Merged

jayleaton merged 1 commit into
mainfrom
feat/deploy-volume-snapshots

Conversation

@jayleaton

Copy link
Copy Markdown
Owner

Stacked on #121 (← #111 ← #109). Builds on #99 (JJ's fix of the docs sentence). #99 edits README.md, but since #107 that paragraph lives in docs/backups.md. This PR rewrites it there, because setup now sets the schedule itself. Once #99 lands I rebase over it.

Summary

Railway's own Postgres volume snapshots (Pro plan) could only be turned on in the dashboard. Now they are declared next to the rest of the project and applied idempotently. Source: jayleaton/auto-visuals#46 (snapshot part only; the template already has the nightly encrypted backups).

 deploy/platform.yaml
 backups:
+  # volume_snapshots: [daily, weekly, monthly]   # absent: dashboard's; []: none
 per_environment:
+  staging: { volume_snapshots: [daily] }         # optional override
 cmd/railway-setup/snapshots.go   (per environment, after the IaC apply)
+  for each Postgres volume:
+    have := volumeInstanceBackupScheduleList(volume)
+    if have != want: volumeInstanceBackupScheduleUpdate(volume, kinds: want)   # no redeploy
+    refused (Hobby): warning + next step, apply continues
 docs/railway-go-iac-issues.md    + #19: volume backup schedules cannot be declared

Evidence

Throwaway project gfs-deploy-261023, backups.volume_snapshots: [daily, weekly, monthly] with per_environment.staging.volume_snapshots: [daily]:

  • Before (API, both volumes): volumeInstanceBackupScheduleList → [].
  • Plan: + staging/postgres Railway volume snapshots none -> daily, + production/postgres Railway volume snapshots none -> daily,monthly,weekly, exit 2. In the same run, railway config plan says already up to date in both environments: IaC cannot see the schedule.
  • Apply: ✓ staging/postgres … none -> daily, ✓ production/postgres … none -> daily,monthly,weekly, exit 0, no deployments.
  • Plan again: Up to date., exit 0 (idempotent).
  • After (API): production ["DAILY 6d","WEEKLY 27d","MONTHLY 89d"], staging ["DAILY 6d"] (retentionSeconds / 86400).
  • Validation: volume_snapshots: [daily, hourly] → backups.volume_snapshots: "hourly" must be one of [daily weekly monthly].
  • make deploy-vars ok; make check-fast ok in 4.1s.

Not exercised: the Hobby refusal path. The proof workspace accepts the mutation, so the next-step branch is untested.

Merge Danger

Door: two-way. Removing the key stops managing the schedule, and [] stops new snapshots. Existing snapshots are never deleted by setup.

Blast Radius: deploys

Only projects that add volume_snapshots are affected. It stays commented out in the template, so Hobby projects see no change.

🤖 Generated with Claude Code

backups.volume_snapshots ([daily, weekly, monthly]; per_environment.<env>
overrides it) sets Railway's own backup schedule on every Postgres volume
through the public API (volumeInstanceBackupScheduleUpdate). It is read
first and changed only when it differs, without a redeploy; absent leaves
the dashboard's schedule alone, [] stops new snapshots. A plan that refuses
it (Hobby) becomes a next step. IaC cannot express it: iac issues #19.

Source: jayleaton/auto-visuals#46 (snapshot part). Builds on #99's docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jayleaton
jayleaton changed the base branch from feat/deploy-doppler-staged to main October 23, 2026 09:54
@jayleaton
jayleaton force-pushed the feat/deploy-volume-snapshots branch from 934a33a to 5fe4823 Compare October 23, 2026 09:54
@jayleaton
jayleaton marked this pull request as ready for review October 23, 2026 09:54
@jayleaton jayleaton closed this Oct 23, 2026
@jayleaton jayleaton reopened this Oct 23, 2026
@jayleaton
jayleaton merged commit e80a772 into main Oct 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant