Loading repository data…
Loading repository data…
Shyaminda / repository
Production-style TypeScript/Express microservice for SafeDeploy experiments, featuring Prometheus instrumentation, failure/latency simulation endpoints, Kubernetes canary validation, and GitOps-ready CI/CD workflow patterns.
A minimal TypeScript + Express service used to demonstrate SafeDeploy patterns such as health checks, controlled failures, synthetic latency, and Prometheus metrics when running on kubernetes safedeploy environment.
GET /health returns a healthy response for readiness/liveness checks.GET /slow simulates a slow dependency by waiting ~3 seconds.GET /error intentionally returns 500 for failure-path testing.GET /sum increments and returns an in-memory counter.GET /metrics exposes Prometheus metrics (default process metrics + custom HTTP metrics).npm install
npm run build
npm start
The app starts on http://0.0.0.0:3000.
npm run dev
npm run test
This service is intended to run in a Kubernetes environment as a Pod (for example, as a canary and/or stable workload behind a Service).
When deployed to Kubernetes, the endpoints in this README can be used for:
/health)/error)/slow)/metrics)This repository is designed to fit into a CI/CD workflow where pipelines typically:
A common command sequence in CI is:
npm ci
npm test -- --run
npm run build
In a GitOps setup, deployment state is tracked in Git, and the cluster continuously reconciles to the desired manifests that reference the image stored in GHCR.
ℹ️ SafeDeploy is still under active development, so slow rollout behavior is tested manually for now.
Start a temporary curl pod in Kubernetes:
kubectl run curltest \
--rm -it \
--image=curlimages/curl \
--restart=Never -- sh
Then issue repeated requests to the canary app's slow endpoint:
for i in {1..20}; do
curl http://demo-app-canary:3000/slow
done
GET /health{ "status": "ok - Application reached" }
GET /slow{ "status": "slow", "delayMs": 3000 }
GET /error{ "status": "error", "message": "Intentional error for SafeDeploy demo" }
GET /sum{ "status": "sum", "sum": 1 }
GET /metricsReturns Prometheus-formatted metrics, including:
http_request_duration_secondshttp_requests_total{status="..."}