Ports and Service Exposure
OpenGov containers publish zero host ports in production (docker-compose.yml).
A TLS-terminating reverse proxy routes public hostnames to internal service ports.
Compose Services and Internal Ports
| Service | Internal Ports / Expose | Host Ports | Network Mode | Notes |
|---|---|---|---|---|
postgres | None | None (0) | Default compose | Internal PostgreSQL 18 (max_connections=150). |
init-keycloak | None | None (0) | Default compose | One-shot Keycloak realm and SMTP bootstrap. |
opengov | 8000 | None (0) | Default compose | FastAPI app + 5 SPAs (:8000); unexposed internal metrics on :9100. |
worker | None | None (0) | Default compose | Procrastinate background worker; unexposed internal metrics on :9100. |
sentinel | None | None (0) | Default compose | Egress-only deployment watchdog; zero listening ports. |
errorpage | None | None (0) | Default compose | Legacy in-stack fallback page (:8099); superseded by host systemd unit. |
oidc | 8080 | None (0) | Default compose | Keycloak (:8080); internal health/metrics on :9000; /admin refused publicly. |
clamav | None | None (0) | none | ClamAV daemon; network isolated (none), reads Unix socket /run/clamd/clamd.sock. |
freshclam | None | None (0) | bridge | Virus signature updater; bridge network for signature downloads only. |
Host-Based Subdomain Routing (spa_router.py + artifact.py)
| Subdomain Label | Target | Dev Port | Environment Variable |
|---|---|---|---|
smartrules.<base> | SPA editor | :3000 | OPENGOV_EDITOR_URL |
approval.<base> | SPA approval | :3001 | OPENGOV_APPROVAL_URL |
applicant.<base> | SPA portal | :3002 | OPENGOV_PORTAL_URL |
smartlink.<base> | SPA smartlink-admin | :3003 | OPENGOV_SMARTLINK_URL |
studio.<base> | SPA studio | :3004 | OPENGOV_STUDIO_URL |
login.<base> | Keycloak (oidc:8080) | :8080 | OPENGOV_OIDC_ISSUER |
mcp.<base> | Embedded MCP door (/mcp, no SPA) | :8000 | OPENGOV_MCP_PUBLIC_URL |
Backend Passthrough Prefixes (PASSTHROUGH_PREFIXES)
The host-based SPA router passes these prefixes directly to FastAPI instead of serving index.html:
/api/health/version/config.json/mcp/.well-known/mesh/docs(disabled by default; requiresOPENGOV_API_DOCS_ENABLED=true)/redoc(disabled by default; requiresOPENGOV_API_DOCS_ENABLED=true)/openapi.json(disabled by default; requiresOPENGOV_API_DOCS_ENABLED=true)/metricsis deliberately excluded and served only on the internal:9100listener.
Login Reverse-Proxy Security Controls
oidc declares Traefik labels in docker-compose.yml to enforce:
- HTTP-to-HTTPS redirect on
login.<base>. - Public
403refusal on/adminpaths (ipallowlist.sourcerange=127.0.0.1/32). - Per-peer and aggregate rate limits on
/realms/opengov-applicants/auth, registration, and recovery.