Skip to main content

Config Service — Deployment Topology

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 17 technology-stack


1. Runtime

PropertyValue
RuntimeNode.js 22 LTS
FrameworkNestJS 11
LanguageTypeScript 5.x
Package@ghasi/service-config
Port3015
Container basenode:22-alpine

2. Replicas and Scaling

EnvironmentMin replicasMax replicasScaling trigger
Production310CPU > 60 % or request queue depth > 200
Staging24CPU > 70 %
Dev/local11

The service is stateless (all state in PostgreSQL + Redis). Horizontal scaling is straightforward. Redis is shared across replicas; cache invalidation events via NATS ensure consistency.


3. Infrastructure Dependencies

DependencyTypeNotes
PostgreSQL 16Primary storeSeparate schema config_svc; RLS enforced
Redis 7CacheNamespace cfg:*; separate Redis instance or dedicated keyspace
NATS JetStreamMessage busStreams: cfg-feature-events, cfg-role-events, cfg-ui-events, cfg-override-events, cfg-token-events, cfg-ops-events
facility-serviceHTTPGET /internal/hierarchy/nodes/{id}/ancestors
platform-admin-serviceHTTPLicense check + feature flag endpoints
access-policyHTTPPOST /internal/access/evaluate
identity-serviceHTTPUser membership validation
KongAPI GatewayRoutes /api/v1/config/* with JWT auth; IP-restricts /internal/*
KeycloakIdentityJWT issuer
OpenTelemetry CollectorTelemetryOTLP export to Grafana / Tempo

4. Regions

RegionRoleNotes
Primary (Afghanistan MoPH)ActiveAll write traffic; primary PostgreSQL
Secondary (DR)StandbyRead replica; NATS replication; promotes on failover

Data residency: config data stays in the tenant's designated region per 13-security-compliance-tenancy.md.


5. Health Checks

EndpointChecks
GET /health/liveProcess alive
GET /health/readyPostgreSQL connection OK; Redis connection OK; NATS connection OK

Kubernetes: livenessProbe/health/live; readinessProbe/health/ready.


6. Resource Limits (Production)

ResourceRequestLimit
CPU250 m1000 m
Memory256 Mi512 Mi

7. Deployment Diagram