# Operations hardening (OCI app server and browser runner) Audit of where Astra's state lives on the OCI server, what protects it, and what was added. Read with [DEPLOYMENT.md](DEPLOYMENT.md), [RUNBOOK.md](RUNBOOK.md) and [REMOTE_RUNNER.md](REMOTE_RUNNER.md). ## Audit | Question | Finding | |---|---| | Where state lives | One folder, `FPT_HOME=/data` in the container, bind-mounted from `/home/ubuntu/astra-data` on the VM's own disk (`deploy/oci/update-app.sh`): `fpt.sqlite` (runs, users, audit, schedules, kv), `checkpoints.sqlite`, `secrets/` (vault), `evidence/` (encrypted), `runs/`, `tickets/`, `screens/`, `library/`, `logs/`, `fusion_areas.json`. Settings and secrets of the container are in `/etc/astra/app.env` on the VM (root), outside the repo and outside `/data`. | | Survives a container rebuild | Everything in `/data` (bind mount), `/etc/astra/app.env`, the previous image tag (one rollback). The runner VM keeps `~/astra`, `~/astra.prev`. | | Backed up today | Only if `OCI_STATE_PAR_URL` and `FPT_STATE_KEY` are in `app.env` (not visible from the repo: verify on the server). Then `statesync.py` saves an encrypted archive (SQLite copied with the online backup API) to the bucket: when data changed, at most every 5 min on OCI, at once on run events, on shutdown. Kept: `latest.bin`, `previous.bin`, the newest 5 `history/` copies. Over 45 MB it leaves out evidence, then finished runs' folders. Not in it: `logs/` (except audit anchors), `app.env`, the runner. | | Lost if the VM disk dies | With the bucket: everything saved there (at most the last few minutes), minus left-out evidence and logs. **Without it, everything.** Always lost: `app.env` (including `FPT_STATE_KEY`: without it the bucket's archives cannot be decrypted), the TLS proxy setup, the runner's systemd unit and token. The runner's code is rebuilt by `sync.sh`. | | Gaps found | 1. The rolling history is the last 5 saves, minutes to a few hours: damage noticed a day later could not be undone. 2. `FPT_STATE_KEY` and `app.env` have no copy anywhere. 3. `update-app.sh` removed the container with `docker rm -f` (SIGKILL), skipping the app's shutdown save and letting a run stop cleanly. 4. The container log was unbounded (docker default). 5. Alerts existed only for run events, `state.left_out` and Agent Studio dead letters. A dead runner or pod sign-in, a full disk, a stuck run, a failing save or a failing schedule showed up only when someone opened the app (pre-flight at the next run). The `trio_backup_ok` metric needs a scraper that is not set up. | ## What was added (all off or inert until switched on) - **Dated backups** (`platform/backup.py`): one encrypted archive per `FPT_BACKUP_INTERVAL_H` (24), same archive and key as the state save, to `state/daily/