PLAN: database backup and restore; messages survive #fragment redirects
The redirect helper put ?msg= after the #fragment, so "imported" and "saved" never showed after lead-source imports or campaign assignments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,7 +83,8 @@ running a Federated Core can install as a CoreDesktop sibling.
|
||||
`~/.hermes/.env`.
|
||||
- **No inbound webhooks.** Nothing on the internet can reach the app, so Stripe
|
||||
and the social platforms are polled. Stripe's Events API makes this cheap.
|
||||
- **Data in SQLite.** That means one file to back up. The existing
|
||||
- **Data in SQLite.** That means one file to back up (see Future
|
||||
enhancements: back up and restore). The existing
|
||||
`posts.json`, `dismissed.json` and `state.json` are imported on first start.
|
||||
|
||||
### The Hermes bridge (Core MCP → EspoCRM)
|
||||
@@ -687,6 +688,55 @@ Not in any phase yet; picked up when the user asks.
|
||||
- Docs: learn.microsoft.com/linkedin/marketing/community-management-app-review
|
||||
and .../community-management/community-management-overview.
|
||||
|
||||
2. **Back up the database and restore from a backup** (asked for
|
||||
2026-11-21). Today backups are copies made by hand before risky changes
|
||||
(`app.db.pre-phase1`, `app.db.pre-dedupe`, …) in the data folder. A plain
|
||||
`cp` of a running database in WAL mode can miss recent writes, so
|
||||
backups must use SQLite's own backup (`VACUUM INTO` or the online backup
|
||||
API). This doesn't depend on any phase.
|
||||
- **Where they go:** `~/.local/share/supermarket/backups/`, named
|
||||
`app-<date>-<time>[-<reason>].db`, e.g. `app-20261121-1830-before-schema-9.db`.
|
||||
Each one is a single, consistent SQLite file you can open with `sqlite3`.
|
||||
- **When they're made:**
|
||||
- When you ask: `supermarket backup [note]` from the terminal, or
|
||||
*Back up now* on Settings → Backups.
|
||||
- Automatically before every schema migration, before a restore, and
|
||||
before bulk changes such as merging duplicates. This replaces the
|
||||
hand-made `app.db.pre-*` copies.
|
||||
- Once a day while the app runs.
|
||||
- **Keeping them:** the last 7 daily backups, plus 4 weekly ones. Backups
|
||||
made before a migration or a restore, and the ones you make yourself,
|
||||
are kept until you delete them. Settings → Backups shows each backup's
|
||||
size and schema version, and lets you download or delete it.
|
||||
- **Restoring:** `supermarket restore <file>`, or *Restore* on a backup in
|
||||
Settings → Backups (after you confirm). The steps:
|
||||
1. Check the file: `PRAGMA integrity_check`, and that its schema isn't
|
||||
newer than this version of the app.
|
||||
2. Back up the current database first.
|
||||
3. Stop the background jobs and close the database.
|
||||
4. Swap the file in, removing the old `-wal` and `-shm` files.
|
||||
5. Start again. Any migrations the backup lacks run on start.
|
||||
|
||||
From the browser, the app exits after the swap and Docker's
|
||||
`restart: unless-stopped` brings it back. You can also restore a
|
||||
downloaded backup by uploading it.
|
||||
- **Secrets aren't included.** Tokens and keys stay in `secrets.json`,
|
||||
and a restore never touches them. Putting them in a file that gets
|
||||
downloaded and copied around would spread credentials.
|
||||
`supermarket backup --with-secrets` adds them for a move to a new
|
||||
machine. The result is a mode-0600 `.tar.gz`, and the command warns
|
||||
that the file holds credentials.
|
||||
- **The `supermarket` command:** `backup`, `backups` (lists them) and
|
||||
`restore` run the app's own binary inside the container
|
||||
(`docker exec supermarket supermarket backup …`). That way the backup
|
||||
comes from the process that holds the database, with no locking
|
||||
surprises.
|
||||
- **The existing `app.db.pre-*` files:** moved into `backups/` the first
|
||||
time, so they show up in the list. Their `-shm` and `-wal` leftovers are
|
||||
dropped after a check that each copy opens.
|
||||
- **Later:** an optional copy off this machine, to Nextcloud on the Core.
|
||||
A backup in the same folder as the database won't survive a lost disk.
|
||||
|
||||
## 6. Contact enrichment: suggested services
|
||||
|
||||
"Enrichment" means: given a target company (or a person's name), find the
|
||||
|
||||
Reference in New Issue
Block a user