Backups, Restore Drills, and Serverless vs Homelab
Moving HTTP traffic to a Worker was only half the migration. The homelab also ran a daily Firestore backup, a restore drill and a five-minute monitor, and uploads need cleanup when a browser disappears halfway through. A Worker answering 200 proves nothing about whether the data is recoverable.
This chapter closes the Ślubne Chwile case: how recovery was staged, where it runs now, and an honest comparison of the two setups.
Staging the Recovery Jobs
The backup story took four ADRs, each adding one thing only after the last was proven:
| ADR | Date | Added |
|---|---|---|
| 001 | 29 Oct | Where: a dedicated private R2 bucket, separate from the photos, with its own scoped credential. Explicitly not provisioned or tested by the decision |
| 004 | 30 Oct | Policy: daily logical archive, keep 30, targets of 24 h data loss and 8 h to restore, as targets, not guarantees |
| 006 | 31 Oct | Activate only the daily backup (02:00 UTC) and the 5-minute check. Pruning, reminders and deletion stay off |
| 008 | 31 Oct | Guarded pruning after each verified backup, and restore drills on the 1st and 15th |
ADR-006 states the reasoning: activating every lifecycle job at once “would conflate these separate gates”. If backups, reminders and deletion all start on the same day and something breaks, you don’t know which one to trust.
Two design details worth stealing:
- Firestore’s managed export writes to Google Cloud Storage, not R2. ADR-001 caught that before anything was built, and the MVP used a tested logical export instead, explicitly not labelled a native backup.
- Pruning is guarded. It requires a recent verified backup, always keeps that exact recovery point, and ignores keys it doesn’t recognise. Pruning old archives is permanent deletion, so it gets the same care as deleting photos.
Restore Drills Into an Empty Emulator
A backup you haven’t restored is a file. The drill:
- Loads the latest archive into a disposable, empty Firestore emulator, never into production.
- Runs in a container that has backup access but no production Firebase credential.
- Compares document counts, then records evidence of a successful drill.
The first hosted run archived and read back 29 documents; the restore loaded them into the emulator and the count matched. Cleanup found no stale uploads. Pruning removed zero archives, which is the correct answer when there aren’t 30 yet.
One local drill failed for a mundane reason: Docker’s --env-file didn’t
read quoted values the way Node’s loader did. Running Node’s own
--env-file inside a Node 24 + Java 21 container fixed it. A
configuration-parser mismatch, not a bad backup, and you only find that out
by running the drill.
Moving the Schedules Off the Homelab
On the Worker version, backup, restore and cleanup run as scheduled GitHub Actions, with credentials in repository secrets. Schedule variables let each job run manually first, then switch on.
Then the Worker’s protected readiness check requires fresh evidence: if the latest verified backup or restore is stale or malformed, readiness fails. Recovery became part of “is the app healthy?”, not a separate hope.
Once the hosted jobs passed, the matching homelab timers were disabled, so the same job doesn’t run twice. Turning them back on means disabling the GitHub schedules first. The monitor stayed on the homelab, checking the production domain from outside the Worker.
The scope didn’t change: these are Firestore archives. Auth users and photo originals still have no independent backup, as accepted in ADR-007 (chapter 12).
Serverless vs Homelab, for This Project
Firebase, R2, the email provider and Stripe are the same in both versions. The real question was narrower: where does the application code run, and who operates that runtime?
| Concern | Homelab Node app | Workers Free app |
|---|---|---|
| Availability | Depends on my machine, power, home network and the Tunnel. I can restart everything myself | Requests no longer need the home machine. They do need Cloudflare, Firebase and R2 |
| Running cost | Hardware I already own, plus power, network, replacement. Never measured | No upfront plan upgrade. Each service has its own allowance. “Free to start” isn’t “free as it grows” |
| Operational work | Patch the OS and Node, keep Docker and timers running | Cloudflare runs the runtime; I maintain bindings, secrets, schedules, provider config |
| Code compatibility | firebase-admin runs as intended | Rewrote Firebase access with REST and Web Crypto |
| File handling | Can take whole uploads and build archives, using local disk and home upload bandwidth | Request and CPU limits: direct R2 uploads, browser ZIPs |
| Recovery | Local jobs run while the homelab is healthy; a home outage stops them too | GitHub Actions runs them elsewhere. Scheduled workflows aren’t a precise clock |
| Control and rollback | Full host access and logs | Route-based cutover and rollback, but debugging is through provider logs |
Where serverless helped
- A household power cut or ISP outage is no longer in the request path.
- The preview Worker let every flow be checked before the domain moved.
- Recovery jobs now run outside the house.
- The platform’s limits forced better boundaries: file bytes off the Worker, ZIPs in the browser, checkout off until a real payment rollout.
What the homelab still does better
- Code that expects Node, and
firebase-admin, just runs. - It can take a whole file and build archives on disk, with full process logs.
- It’s the rollback origin and runs the monitor. Shutting it down now would remove both safeguards.
Less host maintenance came with more integration work: the REST rewrite,
the auth helper, R2 multipart quirks, the edge-only fetch option.
Cost needs measurement, not opinions
The documented limits (10 ms CPU per HTTP request on Workers Free, R2 storage and operation pricing, Firestore daily quotas, GitHub’s warning that scheduled runs can be delayed or dropped) are reasons to measure, not numbers to compute a bill from. There’s no production-scale gallery measurement yet, and the homelab’s power and wear were never measured either. A fair comparison tracks both over real months.
Where It Landed: Hybrid
- Worker serves the site.
- GitHub Actions runs backup, restore verification and cleanup.
- Homelab stays as rollback origin and external monitor.
Moving the monitor, retiring the homelab and enabling live payments are each their own future decision, with their own checks. That’s ADR-014’s last line, and it’s the posture this whole book argues for: start cheap, keep a written exit (chapter 6), and don’t burn the bridge until you’ve walked back over it once.
Takeaways
- Stage recovery: destination, then policy, then one job, then the next.
- Restore into an empty, isolated target on a schedule, and record the evidence.
- Make readiness fail when recovery evidence is stale.
- Compare platforms on who runs what, not “cloud vs self-hosted”.
- Hybrid is a fine place to stop. Retiring the old system is a decision, not a default.
Want a migration or recovery plan like this for your own product? Book a call.