Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / infra / agents / README.md
| 1 | # Agents sandbox (compose project `agents`) |
| 2 | |
| 3 | - Runner: `agent-runner` (Tokio+axum, `infra/agents/runner/`) serves the |
| 4 | `proto` HTTP API from inside the sandbox: per-slot checkouts at |
| 5 | `/builds/slots/slot-N`, `bash -lc` exec in its own process group (Build |
| 6 | kind serialized on a single permit), path confinement, `git` ops. |
| 7 | - Image: `Dockerfile.builder` builds the runner, then extends |
| 8 | `location-share-builder:local` with ripgrep, user `agent` (10001), and a |
| 9 | small-Gradle profile; ENTRYPOINT runs the runner under tini. |
| 10 | - Isolation: `builder` runs as 10001, caps (6 CPU/14 GB/4k pids), |
| 11 | `cap_drop: ALL`, no-new-privileges, only on `agents-internal` (sealed) |
| 12 | and `agents-egress` (172.31.250.0/24, host-firewalled from RFC1918). |
| 13 | - Orchestrator: `agentd` (separate image) talks to `http://builder:7070`, |
| 14 | serves the UI as `agents-ui` on prod net, pushes via the mirror volume. |
| 15 | - Release back-pressure: `release-signal` mirrors prod's |
| 16 | `/srv/release_in_progress` into `/signal/release` for agentd to defer. |
| 17 | |
| 18 | Deploy (once, on the host as root, from /root/agent-world/Modern-Apps): |
| 19 | 1. `git clone <Modern-Apps> /root/agent-world/Modern-Apps` |
| 20 | 2. Review `infra/agents/host-setup.sh`, then `sudo bash infra/agents/host-setup.sh` |
| 21 | 3. Copy `infra/agents/.env.example` to `/root/agent-world/.env`, fill secrets |
| 22 | 4. Ensure base exists: `docker compose -f /root/location_share_server/compose.yml --profile release build builder` |
| 23 | 5. `docker compose -p agents -f infra/agents/compose.yml up -d --build` |
| 24 | |
| 25 | Verify: `docker compose -p agents ps`; `docker exec agents-builder-1 curl -s localhost:7070/v1/health`; |
| 26 | agentd UI via Caddy; run one `agent/` task end to end, then check |
| 27 | `docker stats` (builder ≤ 6 CPU/14 GB) and `iptables -S DOCKER-USER`. |
| 28 | |
| 29 | Stop/remove (never touches `location-share`): |
| 30 | `docker compose -p agents -f infra/agents/compose.yml down` (add `-v` to |
| 31 | drop agents-* volumes too; the builds image + mirror stay until deleted). |