Migrate store: atomic-JSON → SQLite (modernc, cgo-free); backup deferred to go-live #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Decision record — 2026-08-25. Supersedes the "SQLite swap" open item on the architecture wiki. No code yet; this is the agreed plan.
Decision
Replace the single atomic-JSON store with SQLite via
modernc.org/sqlite(pure-Go, cgo-free). Backup/replication is explicitly deferred to go-live — see below.Why SQLite
save()clobbers everything and the only floor is a nightly copy.modernc.org/sqliteis pure Go → keepsCGO_ENABLED=0and the cross-compile indeploy.yml. ~2× slower than the cgomattndriver, irrelevant at this size (~0.5 KB/record, single-digit MB, a few hundred writes/day, reads from memory).Alternatives considered
Backup — DEFERRED TO GO-LIVE (cost decision)
No object-storage spend while the store is sandbox-only; backup lights up when real customer data exists. At launch:
s3.pub1.infomaniak.cloud) or Swiss Backup (S3/SFTP). NOT Garage — the license server stays off the homelab WireGuard mesh by design: a public VPS must not tunnel into the home network. Same provider as the VPS, Swiss, reachable over public TLS, no mesh.VACUUM INTOa timestamped snapshot → Infomaniak viaawsCLI (~10-line cron). Closes the long-standing "off-box shipping still open" item.Migration plan
licenses,accounts,oauth_identities,orgs,org_members,invites. Sessions, reset tokens and OAuth state stay in-memory (unchanged — a restart re-prompts login, by design).modernc.org/sqlite,database/sql. WAL mode. Keep the in-memory read model or query directly (TBD; reads are trivial either way).licenses.jsonis present, import it once, then move the JSON aside (licenses.json.migrated). Idempotent, safe to re-run.vet+ full suite) → PR for review → deploy. Do it pre-launch so the migration is exercised on sandbox data, not under launch pressure with live customer records.Sequencing
SQLite swap can land any time pre-launch (recommended: soon, on sandbox data). The backup layer is a go-live task (#26-launch), tracked separately once it lands.