Files
hermes-control-panel/docker-compose.yml
T
ZachariahSharma dd5318368e feat: route public api traffic through managed gateway
Replace the 3-service compose with a 5-service architecture that puts
api-gateway.cjs (hermes-pre-api, hermes-post-api) in front of internal
upstream services (hermes-pre-upstream, hermes-post-upstream), ensuring
all public API traffic passes through the auth/audit layer. Update
Dockerfile, .env.example, .dockerignore, and add a compose contract test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 02:12:05 -06:00

158 lines
5.0 KiB
YAML

x-hermes-build: &hermes-build
context: .
dockerfile: Dockerfile
x-hermes-environment: &hermes-environment
HOME: /home/hermes
HERMES_HOME: /home/hermes/.hermes
HERMES_EXE: /home/hermes/.hermes/hermes-agent/venv/bin/hermes
CODEX_HOME: /home/hermes/.codex
CLAUDE_CONFIG_DIR: /home/hermes/.claude
GEMINI_CONFIG_DIR: /home/hermes/.gemini
NO_COLOR: "1"
HERMES_NO_TUI: "1"
x-hermes-volumes: &hermes-volumes
- type: bind
source: ${HERMES_HOME_HOST:-/opt/hermes-control-plane/hermes}
target: /home/hermes/.hermes
bind:
create_host_path: true
- type: bind
source: ${CODEX_HOME_HOST:-/opt/hermes-control-plane/codex}
target: /home/hermes/.codex
bind:
create_host_path: true
- type: bind
source: ${CLAUDE_HOME_HOST:-/opt/hermes-control-plane/claude}
target: /home/hermes/.claude
bind:
create_host_path: true
- type: bind
source: ${GEMINI_HOME_HOST:-/opt/hermes-control-plane/gemini}
target: /home/hermes/.gemini
bind:
create_host_path: true
services:
hermes-control-plane:
build: *hermes-build
image: hermes-control-plane:local
user: ${HERMES_CONTAINER_USER:-0:0}
restart: unless-stopped
ports:
- "${HERMES_SETUP_UI_PORT:-7843}:7843"
environment:
<<: *hermes-environment
HERMES_SETUP_UI_HOST: 0.0.0.0
HERMES_SETUP_UI_PORT: 7843
DATABASE_URL: ${DATABASE_URL}
HERMES_ADMIN_USERNAME: ${HERMES_ADMIN_USERNAME}
HERMES_ADMIN_PASSWORD: ${HERMES_ADMIN_PASSWORD}
HERMES_ADMIN_SESSION_TTL_HOURS: ${HERMES_ADMIN_SESSION_TTL_HOURS:-12}
HERMES_LOG_RETENTION_DAYS: ${HERMES_LOG_RETENTION_DAYS:-90}
volumes: *hermes-volumes
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:7843/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
hermes-pre-upstream:
build: *hermes-build
image: hermes-control-plane:local
user: ${HERMES_CONTAINER_USER:-0:0}
restart: unless-stopped
expose:
- "8645"
command:
- /bin/sh
- -lc
- exec "$$HERMES_EXE" proxy start --provider "$$HERMES_PRE_AI_PROVIDER" --host 0.0.0.0 --port 8645
environment:
<<: *hermes-environment
HERMES_PRE_AI_PROVIDER: ${HERMES_PRE_AI_PROVIDER:-nous}
volumes: *hermes-volumes
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8645/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
hermes-post-upstream:
build: *hermes-build
image: hermes-control-plane:local
user: ${HERMES_CONTAINER_USER:-0:0}
restart: unless-stopped
expose:
- "8642"
command:
- /bin/sh
- -lc
- exec "$$HERMES_EXE" gateway run --replace --accept-hooks
environment:
<<: *hermes-environment
API_SERVER_ENABLED: "true"
API_SERVER_HOST: 0.0.0.0
API_SERVER_PORT: 8642
HERMES_POST_AI_PROVIDER: ${HERMES_POST_AI_PROVIDER:-nous}
volumes: *hermes-volumes
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8642/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
hermes-pre-api:
build: *hermes-build
image: hermes-control-plane:local
user: ${HERMES_CONTAINER_USER:-0:0}
restart: unless-stopped
command: ["node", "/app/api-gateway.cjs"]
ports:
- "${HERMES_PRE_AI_API_PORT:-8645}:8645"
environment:
DATABASE_URL: ${DATABASE_URL}
HERMES_API_ROUTE_KIND: pre
HERMES_API_GATEWAY_HOST: 0.0.0.0
HERMES_API_GATEWAY_PORT: 8645
HERMES_UPSTREAM_URL: http://hermes-pre-upstream:8645
HERMES_LOG_RETENTION_DAYS: ${HERMES_LOG_RETENTION_DAYS:-90}
HERMES_AUDIT_MAX_BYTES: ${HERMES_AUDIT_MAX_BYTES:-10485760}
depends_on:
- hermes-pre-upstream
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8645/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
hermes-post-api:
build: *hermes-build
image: hermes-control-plane:local
user: ${HERMES_CONTAINER_USER:-0:0}
restart: unless-stopped
command: ["node", "/app/api-gateway.cjs"]
ports:
- "${HERMES_POST_AI_API_PORT:-8646}:8646"
environment:
DATABASE_URL: ${DATABASE_URL}
HERMES_API_ROUTE_KIND: post
HERMES_API_GATEWAY_HOST: 0.0.0.0
HERMES_API_GATEWAY_PORT: 8646
HERMES_UPSTREAM_URL: http://hermes-post-upstream:8642
HERMES_LOG_RETENTION_DAYS: ${HERMES_LOG_RETENTION_DAYS:-90}
HERMES_AUDIT_MAX_BYTES: ${HERMES_AUDIT_MAX_BYTES:-10485760}
depends_on:
- hermes-post-upstream
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:8646/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s