Files
ProjectE/DEPLOY.md
T
Hermes bb64be5d56 T9/Phase 7: deploy 4-container compose + Caddy reverse proxy
- docker-compose.yml: 4 services (db, api, spa, worker), Next.js removed
- Dockerfile.api: Bun base, install, run
- Dockerfile.worker: Bun base, install, run
- Dockerfile.spa: multi-stage (Bun build -> Caddy serve), fixed lockfile + workspace stubs
- Caddyfile: serve SPA + reverse-proxy /api/* + /mcp, SPA fallback routing
- Old Node worker stopped, replaced with new Bun worker
- Old Next.js server on :3000 stopped
- BASELINE.md: Phase 7 Deploy section added
- DEPLOY.md: deploy/rollback/debug guide added
2026-08-01 02:43:22 +00:00

4.5 KiB

Project E — Deploy Guide

How to redeploy

cd ~/ProjectE

# Pull latest
git pull origin redesign/ui-v2

# Rebuild images
docker compose build

# Restart stack
docker compose up -d

# Check status
docker compose ps

How to roll back

If the new stack fails:

cd ~/ProjectE

# Stop the new stack
docker compose down

# Restart the old worker (Node) from the legacy compose
# (The old compose file is preserved in git history)
# docker compose -f docker-compose.legacy.yml up -d worker

How to view logs

# All services
docker compose logs --tail=50 -f

# Specific service
docker compose logs --tail=50 -f api
docker compose logs --tail=50 -f spa
docker compose logs --tail=50 -f worker
docker compose logs --tail=50 -f db

How to debug

API health check

curl http://localhost:3001/api/health

SPA health check

curl -s -o /dev/null -w "%{http_code}\n" http://localhost:3000/

API through reverse proxy

curl http://localhost:3000/api/health

Login test

TOKEN=$(curl -s -X POST http://localhost:3000/api/auth/credentials \
  -H "Content-Type: application/json" \
  -d email:user@example.com | \
  python3 -c "import sys,json; print(json.load(sys.stdin).get(token,))")
echo "Token: $TOKEN"

Check container health

docker inspect project-e-db --format {{.State.Health.Status}}

Restart a single service

docker compose restart api
docker compose restart spa

Rebuild a single service

docker compose build spa
docker compose up -d --force-recreate spa

Architecture

Internet → :3000 → Caddy (SPA container)
                        ├── /api/* → api:3000 (Hono/Bun)
                        ├── /mcp*  → api:3000 (Hono/Bun)
                        └── /*     → index.html (SPA fallback)

API (:3001, direct) → PostgreSQL (:5432)
Worker → PostgreSQL

Important notes

  • The project-e-pg-data Docker volume contains the live database. Do not delete it.
  • The apps/web-legacy/ directory contains the old Next.js app for reference. Do not delete it.
  • Port 3000 is the SPA (Caddy), port 3001 is the API directly (for debugging).
  • The MCP endpoint requires a valid API key (separate from JWT auth). EOF cd ~/ProjectE && cat > DEPLOY.md << 'EOF'

Project E — Deploy Guide

How to redeploy

cd ~/ProjectE

# Pull latest
git pull origin redesign/ui-v2

# Rebuild images
docker compose build

# Restart stack
docker compose up -d

# Check status
docker compose ps

How to roll back

If the new stack fails:

cd ~/ProjectE

# Stop the new stack
docker compose down

# Restart the old worker (Node) from the legacy compose
# (The old compose file is preserved in git history)
# docker compose -f docker-compose.legacy.yml up -d worker

How to view logs

# All services
docker compose logs --tail=50 -f

# Specific service
docker compose logs --tail=50 -f api
docker compose logs --tail=50 -f spa
docker compose logs --tail=50 -f worker
docker compose logs --tail=50 -f db

How to debug

API health check

curl http://localhost:3001/api/health

SPA health check

curl -s -o /dev/null -w "%{http_code}\n" http://localhost:3000/

API through reverse proxy

curl http://localhost:3000/api/health

Login test

TOKEN=$(curl -s -X POST http://localhost:3000/api/auth/credentials \
  -H "Content-Type: application/json" \
  -d password:<password> | \
  python3 -c "import sys,json; print(json.load(sys.stdin).get(token,))")
echo "Token: $TOKEN"

Check container health

docker inspect project-e-db --format {{.State.Health.Status}}

Restart a single service

docker compose restart api
docker compose restart spa

Rebuild a single service

docker compose build spa
docker compose up -d --force-recreate spa

Architecture

Internet → :3000 → Caddy (SPA container)
                        ├── /api/* → api:3000 (Hono/Bun)
                        ├── /mcp*  → api:3000 (Hono/Bun)
                        └── /*     → index.html (SPA fallback)

API (:3001, direct) → PostgreSQL (:5432)
Worker → PostgreSQL

Important notes

  • The project-e-pg-data Docker volume contains the live database. Do not delete it.
  • The apps/web-legacy/ directory contains the old Next.js app for reference. Do not delete it.
  • Port 3000 is the SPA (Caddy), port 3001 is the API directly (for debugging).
  • The MCP endpoint requires a valid API key (separate from JWT auth).