# Sol-37 Backups

Sol-37 runtime backups are stored locally under:

`/home/david/backups/sol37-runtime`

The store is:

- compressed with `zstd`
- deduplicated by SHA-256 content hash
- snapshot-based, with one manifest per run
- pruned automatically with retention

## Coverage

Backed up content includes:

- `/home/david/random/www`
- `/home/david/random/docs`
- `/home/david/random/prompts`
- `/home/david/knowledge`
- Sol-37 runtime scripts such as:
  - `sol_chat_api.py`
  - `sol_state_api.py`
  - `knowledge_query_api.py`
  - `local_dashboard_api.py`
  - `dashboard_access_daemon.py`
  - `site_metrics_snapshot.py`
  - `public_logbook_api.py`
  - `public_logbook_irc_logger.py`
  - `video_playlist_watch.py`
  - `sol37_markdown_bridge.py`
  - `sol37_gui_share_server.py`
- selected user service units under `~/.config/systemd/user`
- `~/.local/state/sol37`
- `~/.local/share/sol_chat_web/sessions`
- `~/.local/share/sol_chat_web/query_cache`
- generated runtime metadata captured at snapshot time:
  - `/api/state`
  - relevant `systemctl --user status` and `cat` output
  - recent journal tail for the relevant services
  - git head, branch, status, and diff stat
  - relevant ports and process listings

Excluded on purpose:

- `~/.local/share/sol_chat_web/tts_cache`
- unrelated large tool/vendor trees under `random/bin`
- generic home-directory clutter outside the Sol-37 runtime footprint

## Commands

Create a snapshot:

```bash
python3 /home/david/random/bin/sol37_backup.py snapshot
```

List snapshots:

```bash
python3 /home/david/random/bin/sol37_backup.py list
```

Prune old snapshots and unreferenced blobs:

```bash
python3 /home/david/random/bin/sol37_backup.py prune
```

Restore the latest snapshot into a directory:

```bash
python3 /home/david/random/bin/sol37_backup.py restore /tmp/sol37-restore
```

Restore a specific snapshot:

```bash
python3 /home/david/random/bin/sol37_backup.py restore --snapshot-id 20260427T220000Z /tmp/sol37-restore
```

## Automation

Installed user units:

- `sol37-backup.service`
- `sol37-backup.timer`
- `sol37-backup-prune.service`
- `sol37-backup-prune.timer`

Default schedule:

- snapshot every 6 hours
- prune daily

Default retention:

- keep all snapshots for 48 hours
- keep one per day for 30 days
- keep one per ISO week for 12 weeks
- keep one per month for 12 months

These can be adjusted with environment variables read by `sol37_backup.py`:

- `SOL37_BACKUP_ROOT`
- `SOL37_BACKUP_ZSTD_LEVEL`
- `SOL37_BACKUP_KEEP_ALL_HOURS`
- `SOL37_BACKUP_KEEP_DAILY_DAYS`
- `SOL37_BACKUP_KEEP_WEEKLY_WEEKS`
- `SOL37_BACKUP_KEEP_MONTHLY_MONTHS`
