Get Sentinel up and running in under 5 minutes.
1. Install Sentinel
Run the install script:
|
Add to your PATH if needed:
Verify it works:
2. Create a Configuration File
Create sentinel.kdl in your current directory:
server {
worker-threads 0
}
listeners {
listener "http" {
address "0.0.0.0:8080"
protocol "http"
}
}
routes {
route "api" {
matches {
path-prefix "/api/"
}
upstream "api-backend"
}
route "default" {
priority "low"
matches {
path-prefix "/"
}
upstream "web-backend"
}
}
upstreams {
upstream "api-backend" {
targets {
target { address "127.0.0.1:3000" }
}
}
upstream "web-backend" {
targets {
target { address "127.0.0.1:3001" }
}
}
}
observability {
metrics {
enabled true
address "0.0.0.0:9090"
}
logging {
level "info"
format "json"
}
}
3. Start a Test Backend
For testing, start a simple backend server:
# Using Python (port 3000)
&
# Or using Node.js
&
4. Run Sentinel
You should see:
INFO sentinel starting up
INFO listener http listening on 0.0.0.0:8080
INFO metrics server listening on 0.0.0.0:9090
5. Test It
In a new terminal:
# Test the proxy
# Check metrics
What’s Happening
- Listener accepts HTTP connections on port 8080
- Router matches requests against route rules:
/api/*requests go toapi-backend(port 3000)- All other requests go to
web-backend(port 3001)
- Upstream forwards requests to your backend servers
- Metrics are exposed on port 9090 for monitoring
Add Health Checks
Update your config to add health checks:
upstreams {
upstream "api-backend" {
targets {
target { address "127.0.0.1:3000" }
}
health-check {
type "http" {
path "/health"
}
interval-secs 10
unhealthy-threshold 3
}
}
}
Reload the configuration:
# Send SIGHUP to reload
Add TLS
For HTTPS, generate certificates and update the config:
# Generate self-signed cert for testing
listeners {
listener "https" {
address "0.0.0.0:8443"
protocol "https"
tls {
cert-file "cert.pem"
key-file "key.pem"
}
}
}
Test with:
Troubleshooting
“command not found: sentinel”
The install directory isn’t in your PATH. Add it:
# Check where it was installed
||
# Add to PATH (add this to your ~/.bashrc or ~/.zshrc)
# Reload your shell
“Permission denied” when installing
The installer needs write access to /usr/local/bin:
# Option 1: Use sudo (will prompt for password)
|
# Option 2: Install to user directory (no sudo needed)
# The script will automatically fall back to ~/.local/bin
“Address already in use” when starting
Another process is using port 8080:
# Find what's using the port
# Either stop that process, or change Sentinel's port
# In sentinel.kdl, change:
# address "0.0.0.0:8080"
# to:
# address "0.0.0.0:9000"
“Connection refused” when testing
Your backend server isn’t running or is on a different port:
# Check if backend is running
# If not, start one for testing
Configuration errors
Validate your config file:
Common issues:
- Missing closing braces
} - Typos in property names (e.g.,
adressinstead ofaddress) - Invalid port numbers (must be 1-65535)
Next Steps
- Basic Configuration - Detailed configuration reference
- First Route - Deep dive into routing
- Service Types - Learn about API, web, and static modes
- Health Checks - Configure upstream monitoring