Sentinel
Environment-scoped deployment sentinel service
Location: go/apps/sentinel/
CLI Command: unkey run sentinel
What It Does
Sentinel is an environment-scoped HTTP proxy service that receives requests from Frontline and routes them to the appropriate deployment instance.
Each environment has its own Sentinel instance(s), and a single Sentinel handles all deployments within that environment.
Sentinel handles three main responsibilities:
- Deployment Validation: Ensures the requested deployment belongs to this Sentinel's environment
- Instance Selection: Selects a healthy running instance for the deployment in the current region
- Request Proxying: Forwards the request to the selected instance and returns the response
Architecture
Environment-Scoped Design
Sentinel is an environment-scoped service, meaning:
- Each environment (e.g., production, staging, dev) has its own Sentinel instance(s)
- A single Sentinel handles all deployments within its environment
- Frontline passes the
X-Deployment-IDheader to specify which deployment to route to - Sentinel validates that the deployment belongs to its configured environment
Request Flow
How It Works
Sentinel validates that the requested deployment belongs to its configured environment, then selects a healthy instance to proxy the request to.
Security Note: Deployments from wrong environments are masked as "not found" rather than "forbidden" to avoid leaking information about deployments in other environments.
Database Schema
Sentinel uses the following tables:
Error Handling
Sentinel uses structured error codes for consistent error handling:
Error Codes
Error Middleware
Sentinel is not user-facing (only Frontline calls it), so it always returns JSON errors:
Frontline receives these errors and can decide how to present them to end users.
Configuration
Sentinel is configured per-environment:
Key Configuration: EnvironmentID is required and determines which deployments this Sentinel can serve.
Observability
Sentinel uses structured logging and metrics for monitoring.