Add healthcheck
This commit is contained in:
@@ -39,6 +39,7 @@ curl -H "X-Cache: 1" http://localhost:3000/?url=https://api.example.com/data
|
||||
- Cache validity: 365 days for 200 responses
|
||||
- Cache key: Based on scheme, host, URI, and query parameters
|
||||
- Cache status header: `X-Cache-Status` shows cache hit/miss status
|
||||
- Health endpoint: `GET /health` returns "healthy" for container health checks
|
||||
|
||||
## In n8n
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ services:
|
||||
expose:
|
||||
- 3000
|
||||
volumes:
|
||||
- nginx_cache:/var/cache/nginx
|
||||
- ./nginx_cache:/var/cache/nginx
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/?url=http://httpbin.org/get"]
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
@@ -2,6 +2,11 @@ http {
|
||||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=api_cache:10m max_size=1g inactive=365d;
|
||||
server {
|
||||
listen 3000;
|
||||
location /health {
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_cache api_cache;
|
||||
proxy_cache_valid 200 365d;
|
||||
|
||||
Reference in New Issue
Block a user