fix(backend): use /health for cloud run smoke endpoints

This commit is contained in:
zouantchaw
2026-02-24 08:58:49 -05:00
parent f8f81ec77c
commit 1876441a12
5 changed files with 17 additions and 10 deletions

View File

@@ -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. |

View File

@@ -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"

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)]..."