EnergyVenom's picture
Astra: regression catalogue, runner robustness, idempotent Agent Studio contract, key-screen design (2182ef729b22)
152e0c1 verified
|
Raw History Blame Contribute Delete
9.18 kB
# Deploying Astra in a customer's cloud
One deployment serves one customer. Everything the product stores stays on the customer's own server, in Docker
volumes: nothing is kept outside their environment.
> **Oracle Fusion pods do not run in this shape today.** This stack runs the workflow on Temporal, and the Temporal
> execute activity (`coworker/workflows/activities.py`) supports the practice pod only: it starts the local practice
> pod and has no remote browser runner, no per-area test users and no pre-flight. Fusion test cycles run on the
> Hugging Face Space shape with a remote runner ([docs/DEPLOYMENT.md](../docs/DEPLOYMENT.md)). Say this plainly to a
> buyer.
> **Status of this package.** The application image is built and checked automatically on every push to `main`
> (`.github/workflows/image.yml`): it starts, serves the web app, the practice pod answers, sign-in works, and the
> self-tests pass inside the container (35 checks offline, 42 with three scenarios in Chromium). Image size: 1.8 GB.
> **Not yet run:** the full `docker compose` stack in this folder (the application together with Temporal and the
> HTTPS proxy). The compose file passes `docker compose config`; run "Verify" on a staging server before the
> first customer install.
## What gets installed
| Container | What it does | Reachable from |
|---|---|---|
| `app` | Web app, API, workflow worker, test browser (Chromium), practice pod | only through the proxy |
| `temporal` | Keeps long test runs alive across restarts | the app; its UI on the server's loopback only |
| `proxy` (Caddy) | HTTPS on ports 80 and 443 | the customer's users |
| Volume | Contents |
|---|---|
| `fpt-data` | Database, secrets vault, encrypted evidence, reports, script library |
| `temporal-data` | Workflow history |
| `caddy-data` | TLS certificates |
## Server
- A Linux VM with Docker Engine 24+ and the compose plugin. AWS EC2, Azure VM and Google Compute Engine all work.
- Size: 4 vCPU, 8 GB RAM, 50 GB disk for the product. A local AI model needs its own GPU server (24 GB GPU).
- Network: inbound 443 (and 80 for the certificate) from the customer's users only. No other inbound port.
- Outbound: nothing is required. Allow `https://docs.oracle.com` only if live release-note research is switched on,
and the external AI provider's address only if an external model is configured.
## Install
```sh
# on the server, in the folder that holds the product files
cd deploy
cp .env.example .env
nano .env # set FPT_DOMAIN, FPT_TLS, the first admin and a long password
docker compose build # or: docker load < patch-coworker-1.0.0.tar when shipping a pre-built image
docker compose up -d
docker compose ps # all three should be "running"; app becomes "healthy" within a minute
```
Open `https://<FPT_DOMAIN>` and sign in as the first admin. Then, in the product:
1. **Settings > Users**: create named accounts (consultant, QA approver, viewer) and change the admin password.
2. **Test environments**: check the pod. A fresh install has the practice pod only.
3. **Settings > AI models**: optional. Connect a local model and, if the customer agrees, an external one.
`FPT_TLS=internal` gives a certificate from Caddy's own authority, which browsers do not trust until the customer
installs Caddy's root certificate. For a public certificate set `FPT_TLS` to an e-mail address; the domain must then
resolve to the server and port 80 must be reachable from the internet.
## Verify (do this on staging before a customer install)
```sh
docker compose exec app curl -fsS http://127.0.0.1:8800/api/ready # "ready": true, orchestrator temporal
docker compose exec app python -m coworker selftest # 35 checks, offline
docker compose exec app python -m coworker selftest --live # runs 3 scenarios in Chromium
docker compose logs app | tail -50
```
Then in the browser: start a **full run in a real browser** on Procure-to-Pay, approve the scenarios, open the
Live view, and download the report and the Excel test script.
## Day-to-day
| Task | Command |
|---|---|
| Stop / start | `docker compose stop` / `docker compose up -d` |
| Logs | `docker compose logs -f app` |
| Backup | `./backup.sh /secure/backups` (the archive includes the secrets vault: keep it encrypted) |
| Upgrade | take a backup, load or build the new image, `docker compose up -d` (database upgrades run on start) |
| Upgrade the browser runner (Space shape only: Fusion tests on a separate runner, `FPT_REMOTE_RUNNER_URL`) | right after every upgrade, on the same commit: `deploy/runner/sync.sh ubuntu@<runner> <ssh key> https://<runner>`. It refuses while a test run is using the runner; its `/healthz` then shows the commit as `version` and `cases: true` |
| Temporal UI | `ssh -L 8233:127.0.0.1:8233 <server>` then open `http://127.0.0.1:8233` |
| Emergency stop | in the product: Settings > Emergency stop, or `docker compose exec app python -m coworker kill` |
| Check the audit log | `docker compose exec app python -m coworker verify-audit` |
## Security checklist for the customer's team
- Only 443 (and 80) are open, and only to the customer's users.
- The first admin password was changed and named accounts are in use.
- `.env` and the backups are readable by administrators only.
- The server disk is encrypted (the evidence store is encrypted by the product; the database and reports are not).
- Backups run on a schedule and a restore has been tried once.
- If an external AI model is connected: the customer has agreed to it, and the provider's data-retention terms are known.
## What this deployment does not include
These are the limits of the product today, not of the packaging. Say them plainly to a buyer.
- **No Oracle Fusion pods in this shape** (see the note at the top). On the Space shape, the committed Fusion
scenario library is Payables (`AP-FUS-*`); scenarios for the other areas are written by the AI model from the
pod's screens during a run; approved ones join the library when `FPT_CASE_WRITEBACK=1`.
- **Single sign-on** (SAML/OIDC) is not built; accounts are local or come from Supabase.
- **SQLite and a single-node Temporal dev server.** Fine for one customer on one server; not highly available.
- **Jira / ServiceNow**: tickets are written to files; the connectors are stubs.
- **Windows desktop app**: the installer is not code-signed.
- **Updates and licensing**: there is no licence check, update channel or usage metering.
- **No independent security test** (penetration test) has been done.
## Settings that make the demo survive a restart (Hugging Face Space or any host without a disk)
The app keeps its data in an encrypted snapshot in a bucket (OCI Object Storage when `OCI_STATE_PAR_URL` is set, else
Supabase Storage) and restores it at start. These settings rebuild the
essentials from the environment, so a lost or unreadable snapshot never leaves the product without its pod or its AI model.
| Setting | Kind | Effect |
|---|---|---|
| `FPT_FUSION_BASE_URL` (`https://<pod>.fa.ocs.oraclecloud.com`), `FPT_FUSION_NAME`, `FPT_FUSION_ENVIRONMENT`, `FPT_FUSION_MODULES` | variable | The Oracle Fusion test pod exists after every start. Production addresses are refused. |
| `FPT_SECRET_FUSION_USERNAME`, `FPT_SECRET_FUSION_PASSWORD` | secret | The pod's test user. Never written to the vault file or shown. |
| `FRONTIER_BASE_URL` (https), `FRONTIER_MODEL`, `FPT_SECRET_FRONTIER_API_KEY` | variable, variable, secret | The external model is switched on at start when no AI settings are saved in the app. `FPT_FRONTIER_AUTO=0` turns this off. |
| `OCI_STATE_PAR_URL`, `FPT_STATE_KEY` | secrets | The OCI bucket's pre-authenticated request URL (read and write objects, listing denied) and the snapshot key, which OCI requires. Periodic saves at most every 300 s there; event saves go at once. One bucket per deployment. |
| `SUPABASE_BUCKET`, `SUPABASE_URL`, `SUPABASE_SERVICE_KEY`, `FPT_STATE_KEY` | variable and secrets | Supabase Storage instead. One bucket per deployment; never share a bucket between two instances (the last writer wins). |
If the start-up restore fails, the instance starts empty and **stops saving** (`/api/ready` shows `saved_state.paused`, and the app shows a notice) so the good
snapshot is not overwritten; restart to retry. The first save of every start keeps the archive it found as `state/previous.bin`
in the bucket; copy it over `state/latest.bin` to undo a bad save.
**Before every restart or deploy**, check that no run is running or queued and the runner is not busy, then save the
state and wait for the answer: `POST /api/storage/save` (administrator). After the deploy, run `deploy/runner/sync.sh`
on the same commit. The app also saves at once when a screen read finishes and when a run waits for a person, ends or
is cancelled, and first thing on shutdown; a screen read cut off by a restart shows as interrupted after it, never as
still running. Full steps: docs/RUNBOOK.md "Before every deploy or restart".