feat: harden podman deployment orchestration

This commit is contained in:
Yahya Alhinai
2026-06-28 01:44:26 +00:00
parent 5185845090
commit c818d5081e
37 changed files with 1796 additions and 273 deletions
+58 -8
View File
@@ -2,23 +2,51 @@
Deploy targets for PodMan on DigitalOcean.
- `Dockerfile` — builds the Hermes backend from the monorepo root
- `app.yaml` — DigitalOcean App Platform spec (Hermes web service + frontend static site)
- `Dockerfile` — builds the backend runtime image from the monorepo root
- `app.yaml` — DigitalOcean App Platform spec: static site, API service, agent worker
- `systemd/` — local droplet service units for the API and agent worker
Full deploy spec and env var reference in [`docs/digitalocean.md`](../docs/digitalocean.md).
## Local development
```bash
pnpm --filter backend dev # Hermes on :8787
pnpm --filter frontend dev # PWA on :5173
pnpm --filter @podman/backend dev:server
pnpm --filter @podman/backend dev:agent
pnpm --filter @podman/frontend dev
```
## Local container
```bash
docker build -f infra/Dockerfile -t podman-hermes .
docker run --env-file .env -p 8787:8787 podman-hermes
docker build -f infra/Dockerfile -t podman-backend .
docker run --env-file backend/.env -e PODMAN_PROCESS=server -p 8787:8787 podman-backend
docker run --env-file backend/.env -e PODMAN_PROCESS=agent podman-backend
```
## Local production services
On the demo droplet, serve the API and worker with systemd instead of tmux:
```bash
sudo install -m 0644 infra/systemd/podman-platform-api.service /etc/systemd/system/
sudo install -m 0644 infra/systemd/podman-platform-agent.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now podman-platform-api podman-platform-agent
sudo systemctl status podman-platform-api podman-platform-agent
```
The services expect:
- built backend artifacts in `backend/dist`
- runtime env in `backend/.env`
- Caddy proxying `/api/*` to `127.0.0.1:8787`
Useful checks:
```bash
curl http://127.0.0.1:8787/health
journalctl -u podman-platform-api -u podman-platform-agent -f
```
## DigitalOcean deploy
@@ -27,8 +55,30 @@ docker run --env-file .env -p 8787:8787 podman-hermes
doctl apps create --spec infra/app.yaml
```
Set secret env vars (LiveKit, Gemini, MongoDB) in the DO dashboard after app creation.
Set secret env vars (LiveKit, Gemini, GitHub, MongoDB) in the DO dashboard after app creation.
Run `pnpm deploy:doctor:strict` with the same environment loaded before treating the
deployment as production-ready.
## Droplet/systemd fallback
The `infra/systemd/` units run the compiled API and LiveKit/Gemini agent from
`/root/podman` and load `/root/podman/backend/.env`, matching the current
droplet layout. `pnpm deploy:doctor` also falls back to that file when root
`.env` is absent. Set `FRONTEND_URL` when the static frontend is served from a
different public origin than `VITE_BACKEND_URL`.
The matching Caddy config is in `infra/Caddyfile`; it serves `/var/www/podman`,
proxies `/api/*` and `/health` to `localhost:8787`, and proxies the optional
local LiveKit host.
```bash
sudo cp infra/systemd/podman-platform-*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now podman-platform-api podman-platform-agent
systemctl status podman-platform-api podman-platform-agent
```
## Fallback (demo safety)
If DO deploy is flaky on stage, run Hermes locally. The PWA defaults to `http://localhost:8787` via `VITE_BACKEND_URL` fallback — no code change needed.
If DO deploy is flaky on stage, run the API and agent locally. In dev, the PWA
defaults to `http://localhost:8787`; in production it falls back to same-origin.