Secure Deployment Boundary
Supported exposure model
Riviamigo is not approved for direct Internet exposure. The production Compose
stack publishes its web origin on port 8080; place an authenticated tunnel or
identity-aware reverse proxy and host firewall rule in front of that listener. A tunnel that
only publishes the port without an access policy is not sufficient.
The outer gateway must terminate public HTTPS, require an identity policy, and
forward normal HTTP and WebSocket traffic to http://localhost:8080. Riviamigo
login remains enabled behind that gateway. Cloudflare Tunnel with Access and
Authentik in front of Caddy, Nginx, or Traefik are supported deployment shapes;
the gateway itself is operated and patched by the self-hoster.
Required production configuration
- Riviamigo defaults to production mode; use
RIVIAMIGO_ENV=developmentonly for local development. - Let Riviamigo generate and persist its application keys in PostgreSQL, or
supply
JWT_SECRET,JWT_PUBLIC_KEY, andAGE_ENCRYPTION_KEYtogether from a secret manager. Partial overrides fail startup. - Set
ALLOWED_ORIGINSto the exact public HTTPS origin, with no path. - Set strong
POSTGRES_PASSWORDandREDIS_PASSWORDvalues. Standard Compose safely constructs its internal URLs; customDATABASE_URLvalues must be valid URLs. - Keep
COOKIE_INSECUREabsent. It is local-development-only. - Do not publish API port 3001, PostgreSQL port 5432, Redis port 6379, or the origin port 8080 directly to the Internet.
Gateway requirements
- Enforce authentication before forwarding any request, including
/v1/*and WebSocket upgrades. - Preserve
Hostand WebSocket upgrade headers. Do not logAuthorizationorSec-WebSocket-Protocolheaders. - Own public TLS, certificate renewal, Internet-facing rate limits, and any trusted-client-IP policy. The internal Riviamigo origin intentionally does not trust arbitrary forwarded client IP headers.
- Restrict direct host access to port 8080 with host firewall rules.
Verification
- Run
docker compose --env-file .env -f compose/docker-compose.yml configand confirm the unified app publishes port8080:8080and no database or Redis port. - Start the stack and check
curl http://localhost:8080/healthlocally. - Confirm external access is denied by the gateway before reaching Riviamigo, then authenticate through the gateway and sign in to Riviamigo.
- Confirm
docker compose --env-file .env -f compose/docker-compose.yml psshows no host mapping for the internal API listener, TimescaleDB, or Redis. - Run
pnpm docs:checkand the security test suite before upgrading a shared instance.
Limits of this guidance
This boundary reduces exposure; it is not a security certification or a substitute for gateway patching, host hardening, backups, monitoring, and an independent penetration test when the deployment risk warrants one.