Files
oikos/docs/operations/rollback.md
dtoro 2b3aa248b1 N0: rename Hermes → Nomos (standalone commit)
Problem: "Hermes" collides with Nous Researchs unrelated product;
  unclear identity for the resident agent.

  Change: Rename the live service identity across 39 files:
  - cmd/hermes/ → cmd/nomos/ (binary, env vars NOMOS_*)
  - internal/config/ server.go (NomosAgentSlug, nomosAgentID)
  - compose/hermes/ → compose/nomos/ (Dockerfile, service name)
  - hermes/ → nomos/ (SOUL.md, config.yaml, skills/)
  - .agents/HERMES.md → NOMOS.md (persona)
  - tools/setup-hermes-soul.sh → setup-nomos-soul.sh
  - seeds/inventory.yaml (agent:hermes → agent:nomos)
  - migrations/014_rename_agent_hermes_to_nomos.up.sql
  - Caddy vhost hermes.hubris.network → nomos.hubris.network
  - All referencing docs, scripts, ADR notes

  History preserved: archive/, plans/done/, ADRs not rewritten.
  Matrix @hermes notifier account and Legacy bin/hermes on LXC 129
  intentionally untouched (out of scope).

  Risk: N0 is identity-only rename; zero behavioral changes.
  Verification: go build ./... passes; docker compose --profile full
  resolves nomos service; grep -ri hermes (excluding archive/plans)
  returns only intentional refs (LLM model name, Matrix user).
2026-07-08 14:14:56 +02:00

98 lines
2.5 KiB
Markdown

# Oikos rollback runbook
**Risk class:** reversible_low (rollback restores previous version)
**RTO:** < 10 minutes (scripted)
**RPO:** last pre-deploy pg_dump (created by deploy.sh before each deploy)
## When to roll back
- Health check fails after deploy (API returns 503 or times out)
- API returns errors that didn't exist before deploy
- Configuration regression (wrong routes, missing tools)
- Migration failure (deploy.sh finishes but seeds fail)
## Procedure
### Automated rollback
```bash
cd /opt/oikos
./scripts/rollback.sh <previous-sha>
```
The script performs:
1. Stop all Docker services
2. Restore DB from `/opt/oikos/backups/pre-deploy-<sha>.sql`
3. Check out the previous SHA
4. Rebuild and restart
5. Health check loop (30 attempts, 2s each)
Find the previous SHA:
```bash
git log --oneline -5
```
### Manual rollback (if script fails)
```bash
# 1. Stop everything
cd /opt/oikos
docker compose --profile full down
# 2. Restore DB manually
DUMP_FILE=/opt/oikos/backups/pre-deploy-<sha>.sql
docker compose --profile full up -d postgres
sleep 5
docker compose exec -T postgres psql -U oikos oikos < "$DUMP_FILE"
# 3. Re-deploy previous version
git checkout <previous-sha>
DOCKER_BUILDKIT=1 docker compose --profile full build
docker compose --profile full up -d
# 4. Health check
curl http://localhost:8090/healthz
```
### After rollback (re-deploy latest)
```bash
git checkout main
./scripts/deploy.sh
```
## Recovery verification
```bash
# API responds
curl http://localhost:8090/healthz
# Entity count matches
curl -s http://localhost:8090/api/v1/entities?limit=1 | jq '.items | length'
# MCP tools working (via Nomos)
curl -s http://localhost:8092/query -d '{"tool":"get_health_summary"}'
```
## Rollback decision tree
```
Deploy fails health check
├── Migration problem → rollback.sh + DB restore
├── Code regression → rollback.sh (DB restore optional)
├── Config change → rollback.sh (DB restore optional)
└── Docker/infra issue → rollback.sh + full DB restore
```
## Backups
- **Automated:** deploy.sh runs `pg_dump` before every deploy → `/opt/oikos/backups/pre-deploy-<sha>.sql`
- **Scheduled:** daily pg_dump via scheduler housekeeping + rclone push to Proton Drive (plan A3)
- **Retention:** keep last 30 pre-deploy dumps locally; 30 daily + 12 monthly on Proton Drive
## Rehearsal log
| Date | Trigger | Previous SHA | Result | Duration |
|------|---------|-------------|--------|----------|
| 2026-07-07 | Cutover test | 7ac2521 | Healthy, 20 tools | ~2 min |