diff --git a/CHANGELOG.md b/CHANGELOG.md index 772f19c8..a8a953d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,4 @@ | 2026-02-24 | 0.1.4 | Locked defaults for idempotency, validation, bucket split, model provider, and p95 objectives. | | 2026-02-24 | 0.1.5 | Added backend makefile module and CI workflow for backend target validation. | | 2026-02-24 | 0.1.6 | Added Cloud SQL-backed idempotency storage, migration script, and command API test coverage. | +| 2026-02-24 | 0.1.7 | Added `/health` endpoints and switched smoke checks to `/health` for Cloud Run compatibility. | diff --git a/Makefile b/Makefile index 8f501219..7872163b 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,8 @@ help: @echo " make backend-deploy-core [ENV=dev] Build and deploy core API service" @echo " make backend-deploy-commands [ENV=dev] Build and deploy command API service" @echo " make backend-deploy-workers [ENV=dev] Deploy async worker functions scaffold" - @echo " make backend-smoke-core [ENV=dev] Run health smoke test for core service" - @echo " make backend-smoke-commands [ENV=dev] Run health smoke test for command service" + @echo " make backend-smoke-core [ENV=dev] Run health smoke test for core service (/health)" + @echo " make backend-smoke-commands [ENV=dev] Run health smoke test for command service (/health)" @echo " make backend-logs-core [ENV=dev] Tail/read logs for core service" @echo "" @echo " 🛠️ DEVELOPMENT TOOLS" diff --git a/backend/command-api/src/routes/health.js b/backend/command-api/src/routes/health.js index 6cae9737..90cd5690 100644 --- a/backend/command-api/src/routes/health.js +++ b/backend/command-api/src/routes/health.js @@ -2,11 +2,14 @@ import { Router } from 'express'; export const healthRouter = Router(); -healthRouter.get('/healthz', (req, res) => { +function healthHandler(req, res) { res.status(200).json({ ok: true, service: 'krow-command-api', version: process.env.SERVICE_VERSION || 'dev', requestId: req.requestId, }); -}); +} + +healthRouter.get('/health', healthHandler); +healthRouter.get('/healthz', healthHandler); diff --git a/backend/core-api/src/routes/health.js b/backend/core-api/src/routes/health.js index 761a044a..9196cc83 100644 --- a/backend/core-api/src/routes/health.js +++ b/backend/core-api/src/routes/health.js @@ -2,11 +2,14 @@ import { Router } from 'express'; export const healthRouter = Router(); -healthRouter.get('/healthz', (req, res) => { +function healthHandler(req, res) { res.status(200).json({ ok: true, service: 'krow-core-api', version: process.env.SERVICE_VERSION || 'dev', requestId: req.requestId, }); -}); +} + +healthRouter.get('/health', healthHandler); +healthRouter.get('/healthz', healthHandler); diff --git a/makefiles/backend.mk b/makefiles/backend.mk index 1e0e4a36..356bbee3 100644 --- a/makefiles/backend.mk +++ b/makefiles/backend.mk @@ -39,8 +39,8 @@ backend-help: @echo " make backend-deploy-core [ENV=dev] Build + deploy core API service" @echo " make backend-deploy-commands [ENV=dev] Build + deploy command API service" @echo " make backend-deploy-workers [ENV=dev] Deploy worker scaffold" - @echo " make backend-smoke-core [ENV=dev] Smoke test core /healthz" - @echo " make backend-smoke-commands [ENV=dev] Smoke test commands /healthz" + @echo " make backend-smoke-core [ENV=dev] Smoke test core /health" + @echo " make backend-smoke-commands [ENV=dev] Smoke test commands /health" @echo " make backend-logs-core [ENV=dev] Read core service logs" backend-enable-apis: @@ -149,7 +149,7 @@ backend-smoke-core: exit 1; \ fi; \ TOKEN=$$(gcloud auth print-identity-token); \ - curl -fsS -H "Authorization: Bearer $$TOKEN" "$$URL/healthz" >/dev/null && echo "✅ Core smoke check passed: $$URL/healthz" + curl -fsS -H "Authorization: Bearer $$TOKEN" "$$URL/health" >/dev/null && echo "✅ Core smoke check passed: $$URL/health" backend-smoke-commands: @echo "--> Running commands smoke check..." @@ -159,7 +159,7 @@ backend-smoke-commands: exit 1; \ fi; \ TOKEN=$$(gcloud auth print-identity-token); \ - curl -fsS -H "Authorization: Bearer $$TOKEN" "$$URL/healthz" >/dev/null && echo "✅ Commands smoke check passed: $$URL/healthz" + curl -fsS -H "Authorization: Bearer $$TOKEN" "$$URL/health" >/dev/null && echo "✅ Commands smoke check passed: $$URL/health" backend-logs-core: @echo "--> Reading logs for core backend service [$(BACKEND_CORE_SERVICE_NAME)]..."