Services Overview
This section provides detailed documentation for each infrastructure service in the HealthFlow NDP platform.
Infrastructure Services
Gateway Layer
Traefik
Purpose: Ingress controller and API gateway
Stack: Gateway
Port: 80, 443, 8080 (dashboard)
Key features:
- Automatic HTTPS with Let's Encrypt
- Dynamic routing and load balancing
- Middleware chain (auth, rate-limiting, CORS)
- Prometheus metrics export
Portainer
Purpose: Kubernetes management UI
Stack: Gateway
Port: 9000
→ Full Documentation (Coming soon)
Key features:
- Visual container management
- RBAC and team management
- Stack deployment interface
- Log viewer and console access
Data Layer
PostgreSQL
Purpose: Primary relational database
Stack: Data
Port: 5432
Usage:
- Prescription data
- Patient registry
- HPR (Healthcare Provider Registry)
- Dispense records
MySQL
Purpose: Legacy database for specific registries
Stack: Data
Port: 3306
Usage:
- Pharmacy registry
- Medicine directory
- Legacy EDA integration
Redis
Purpose: In-memory cache and session store
Stack: Data
Port: 6379
Usage:
- API response caching
- Session management
- Rate limiting counters
- Real-time data
MongoDB
Purpose: Document database for audit logs
Stack: Data
Port: 27017
→ Full Documentation (Coming soon)
Usage:
- Audit trail storage
- Compliance logging
- Analytics data
Monitoring Layer
Prometheus
Purpose: Metrics collection and storage
Stack: Monitoring
Port: 9090
Metrics sources:
- Kubernetes cluster metrics
- Application metrics
- Infrastructure metrics
- Custom business metrics
Grafana
Purpose: Metrics visualization and dashboards
Stack: Monitoring
Port: 3000
Dashboards:
- Cluster health
- Service performance
- Business KPIs
- Alert overview
Loki
Purpose: Log aggregation system
Stack: Monitoring
Port: 3100
Features:
- Centralized log storage
- Label-based indexing
- Grafana integration
- Cost-effective storage
AlertManager
Purpose: Alert routing and notifications
Stack: Monitoring
Port: 9093
→ Full Documentation (Coming soon)
Channels:
- Email notifications
- Slack webhooks
- PagerDuty integration
- SMS alerts
Service Discovery Layer
Consul
Purpose: Service mesh and service discovery
Stack: Discovery
Port: 8500 (UI), 8600 (DNS)
Features:
- Service registration
- Health checking
- KV store
- Service mesh (sidecar proxies)
Vault
Purpose: Secrets management
Stack: Discovery
Port: 8200
Secrets:
- Database credentials
- API keys
- TLS certificates
- Encryption keys
Service Communication Matrix
Service Dependencies
| Service | Depends On | Required For |
|---|---|---|
| Traefik | None | All external access |
| Consul | None | Service discovery, Vault |
| Vault | Consul | All applications |
| PostgreSQL | None | Core applications |
| Redis | None | Caching, sessions |
| Prometheus | None | Monitoring |
| Grafana | Prometheus, Loki | Dashboards |
| Loki | None | Log aggregation |
| Applications | PostgreSQL, Redis, Consul, Vault | End-user features |
Port Allocation
Gateway Stack
| Service | Port | Protocol | Exposure |
|---|---|---|---|
| Traefik | 80 | HTTP | External |
| Traefik | 443 | HTTPS | External |
| Traefik | 8080 | HTTP | Internal |
| Traefik | 8082 | HTTP | Internal (metrics) |
| Portainer | 9000 | HTTP | Internal |
Data Stack
| Service | Port | Protocol | Exposure |
|---|---|---|---|
| PostgreSQL | 5432 | TCP | Internal |
| MySQL | 3306 | TCP | Internal |
| Redis | 6379 | TCP | Internal |
| MongoDB | 27017 | TCP | Internal |
| Kafka | 9092 | TCP | Internal |
Monitoring Stack
| Service | Port | Protocol | Exposure |
|---|---|---|---|
| Prometheus | 9090 | HTTP | Internal |
| Grafana | 3000 | HTTP | Internal |
| Loki | 3100 | HTTP | Internal |
| AlertManager | 9093 | HTTP | Internal |
| Node Exporter | 9100 | HTTP | Internal |
Discovery Stack
| Service | Port | Protocol | Exposure |
|---|---|---|---|
| Consul | 8500 | HTTP | Internal |
| Consul | 8600 | DNS | Internal |
| Vault | 8200 | HTTPS | Internal |
Resource Requirements by Service
Important Note
All resource specifications below are rough estimates for initial deployment. Production requirements should be determined based on:
- Load testing results
- Actual traffic patterns
- Data volume and growth rate
- Performance monitoring and profiling
Start with these baseline values and use Horizontal Pod Autoscaling (HPA) and Vertical Pod Autoscaling (VPA) for automatic adjustments.
High Priority (Critical)
| Service | CPU | Memory | Storage | Notes |
|---|---|---|---|---|
| PostgreSQL | 4 cores | 8 GB | 500 GB | Primary database - scale based on query load |
| Redis | 2 cores | 4 GB | 20 GB | Cache layer - increase for higher throughput |
| Traefik | 2 cores | 2 GB | 10 GB | Gateway - scale with request volume |
| Consul | 2 cores | 2 GB | 20 GB | Service mesh - depends on service count |
Medium Priority (Important)
| Service | CPU | Memory | Storage | Notes |
|---|---|---|---|---|
| Prometheus | 2 cores | 4 GB | 100 GB | Metrics storage - adjust retention period |
| Vault | 1 core | 1 GB | 10 GB | Secrets - minimal resource needs |
| MySQL | 2 cores | 4 GB | 100 GB | Legacy data - estimate based on dataset |
| Grafana | 1 core | 2 GB | 10 GB | Dashboards - light workload |
Low Priority (Supporting)
| Service | CPU | Memory | Storage | Notes |
|---|---|---|---|---|
| Loki | 1 core | 2 GB | 200 GB | Logs - storage depends on retention |
| AlertManager | 0.5 core | 512 MB | 5 GB | Alerts - minimal resources |
| Portainer | 0.5 core | 512 MB | 10 GB | Management - UI only |
Service Health Checks
All services implement three types of health checks:
1. Liveness Probe
Determines if the container is running. Failed checks result in container restart.
2. Readiness Probe
Determines if the service can accept traffic. Failed checks remove the pod from service endpoints.
3. Startup Probe
Used for slow-starting applications. Disables liveness/readiness checks until first success.
Example:
livenessProbe:
httpGet:
path: /health/live
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health/ready
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3Next Steps
Explore detailed documentation for each service:
Or continue with stack deployment: