Skip to content

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)

→ Full Documentation

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

→ Full Documentation

Usage:

  • Prescription data
  • Patient registry
  • HPR (Healthcare Provider Registry)
  • Dispense records

MySQL

Purpose: Legacy database for specific registries
Stack: Data
Port: 3306

→ Full Documentation

Usage:

  • Pharmacy registry
  • Medicine directory
  • Legacy EDA integration

Redis

Purpose: In-memory cache and session store
Stack: Data
Port: 6379

→ Full Documentation

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

→ Full Documentation

Metrics sources:

  • Kubernetes cluster metrics
  • Application metrics
  • Infrastructure metrics
  • Custom business metrics

Grafana

Purpose: Metrics visualization and dashboards
Stack: Monitoring
Port: 3000

→ Full Documentation

Dashboards:

  • Cluster health
  • Service performance
  • Business KPIs
  • Alert overview

Loki

Purpose: Log aggregation system
Stack: Monitoring
Port: 3100

→ Full Documentation

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)

→ Full Documentation

Features:

  • Service registration
  • Health checking
  • KV store
  • Service mesh (sidecar proxies)

Vault

Purpose: Secrets management
Stack: Discovery
Port: 8200

→ Full Documentation

Secrets:

  • Database credentials
  • API keys
  • TLS certificates
  • Encryption keys

Service Communication Matrix

Service Dependencies

ServiceDepends OnRequired For
TraefikNoneAll external access
ConsulNoneService discovery, Vault
VaultConsulAll applications
PostgreSQLNoneCore applications
RedisNoneCaching, sessions
PrometheusNoneMonitoring
GrafanaPrometheus, LokiDashboards
LokiNoneLog aggregation
ApplicationsPostgreSQL, Redis, Consul, VaultEnd-user features

Port Allocation

Gateway Stack

ServicePortProtocolExposure
Traefik80HTTPExternal
Traefik443HTTPSExternal
Traefik8080HTTPInternal
Traefik8082HTTPInternal (metrics)
Portainer9000HTTPInternal

Data Stack

ServicePortProtocolExposure
PostgreSQL5432TCPInternal
MySQL3306TCPInternal
Redis6379TCPInternal
MongoDB27017TCPInternal
Kafka9092TCPInternal

Monitoring Stack

ServicePortProtocolExposure
Prometheus9090HTTPInternal
Grafana3000HTTPInternal
Loki3100HTTPInternal
AlertManager9093HTTPInternal
Node Exporter9100HTTPInternal

Discovery Stack

ServicePortProtocolExposure
Consul8500HTTPInternal
Consul8600DNSInternal
Vault8200HTTPSInternal

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)

ServiceCPUMemoryStorageNotes
PostgreSQL4 cores8 GB500 GBPrimary database - scale based on query load
Redis2 cores4 GB20 GBCache layer - increase for higher throughput
Traefik2 cores2 GB10 GBGateway - scale with request volume
Consul2 cores2 GB20 GBService mesh - depends on service count

Medium Priority (Important)

ServiceCPUMemoryStorageNotes
Prometheus2 cores4 GB100 GBMetrics storage - adjust retention period
Vault1 core1 GB10 GBSecrets - minimal resource needs
MySQL2 cores4 GB100 GBLegacy data - estimate based on dataset
Grafana1 core2 GB10 GBDashboards - light workload

Low Priority (Supporting)

ServiceCPUMemoryStorageNotes
Loki1 core2 GB200 GBLogs - storage depends on retention
AlertManager0.5 core512 MB5 GBAlerts - minimal resources
Portainer0.5 core512 MB10 GBManagement - 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:

yaml
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: 3

Next Steps

Explore detailed documentation for each service:

Or continue with stack deployment: