docs: SQLite deploy uses .backup and remove WAL/SHM on VM

Made-with: Cursor
This commit is contained in:
ilia 2026-04-05 20:03:06 -04:00
parent 09ab32e1e8
commit 1d450d7cc5

View File

@ -202,13 +202,21 @@ Wait until `curl -sf http://127.0.0.1:3005/health` succeeds before relying on cr
sqlite3 data/jobs.db "PRAGMA wal_checkpoint(FULL);"
```
3. **Copy** `data/jobs.db` to the VM repos `./data/` (same path Docker mounts). Example from your Mac:
3. **Copy** a consistent DB file to the VMs `./data/` (same path Docker mounts). Prefer a **SQLite backup** (avoids WAL races while `npm run dev` is running):
```bash
rsync -avz --progress ./data/jobs.db YOUR_USER@178:/opt/Jobber/data/jobs.db
sqlite3 data/jobs.db ".backup 'data/jobs.deploy.db'"
scp ./data/jobs.deploy.db YOUR_USER@10.0.10.178:/opt/Jobber/data/jobs.db
rm -f data/jobs.deploy.db
```
If you use WAL files and skip checkpointing, copy `jobs.db`, `jobs.db-wal`, and `jobs.db-shm` together while **nothing** is writing to the DB.
On the VM, with the container **stopped**, **delete stale sidecars** or SQLite may report corrupt DB:
```bash
rm -f /opt/Jobber/data/jobs.db-wal /opt/Jobber/data/jobs.db-shm
```
Alternatively `rsync` only `jobs.db` after `PRAGMA wal_checkpoint(FULL)` on the laptop with nothing else writing to the file.
4. On the VM: `docker compose up -d` and verify `GET /api/settings` / the Settings UI shows your profile.