From 1a641cbdf9fc97c2686d156d7ccc322cdc76cddc Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 7 Jan 2026 19:12:45 +0100 Subject: [PATCH] Add healthcheck --- README.md | 1 + docker-compose.yml | 4 ++-- nginx.conf | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6fd08f8..8e46c8f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index e2bdd59..e1c9f61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/nginx.conf b/nginx.conf index b290380..a276435 100644 --- a/nginx.conf +++ b/nginx.conf @@ -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;