# Deployment Overview

FluxiQ PIX supports multiple deployment models, from single-node Docker Compose for development to multi-region Kubernetes clusters for production.

## Prerequisites

- Completed the [Requirements](../guide/requirements.md) review
- Chosen your target deployment environment
- Network connectivity to required services (PostgreSQL, Redis, NATS, optionally BACEN)

## Deployment Models

| Model | Use Case | Complexity | HA | TPS Target |
|-------|----------|------------|-----|-----------|
| Docker Compose (dev) | Development, testing | Low | No | ~100 |
| Docker Compose (prod) | Small institutions | Medium | Optional | ~500 |
| Kubernetes (single region) | Production | High | Yes | 5,000 |
| Kubernetes (multi-region) | Large banks | Very High | Yes | 7,500+ |
| On-Premises | Regulated environments | High | Yes | 5,000 |

## Architecture per Deployment Model

```mermaid
graph TB
    subgraph Docker Compose
        DC_BE[Backend Container]
        DC_PG[(PostgreSQL)]
        DC_RD[(Redis)]
        DC_NT[NATS]
    end

    subgraph Kubernetes
        K_ING[Ingress / Traefik]
        K_BE1[Backend Pod 1]
        K_BE2[Backend Pod 2]
        K_ADM[Admin Frontend Pod]
        K_PG[(Cloud SQL / StatefulSet)]
        K_RD[(Redis / Memorystore)]
        K_NT[NATS Cluster 3-node]
    end
```

## Component Matrix

| Component | Docker Compose | Kubernetes | On-Premises |
|-----------|---------------|------------|-------------|
| Backend | Single container | 2+ pods with PDB | Systemd or Docker |
| PostgreSQL | Container | Cloud SQL / StatefulSet | Patroni cluster |
| Redis | Container | Memorystore / StatefulSet | Redis Sentinel |
| NATS | Container | 3-node StatefulSet or VMs | 3-node cluster |
| Admin Frontend | Container (nginx) | Pod (nginx) | nginx on VM |
| Load Balancer | Docker port mapping | Traefik / Cloud LB | HAProxy / nginx |
| TLS Termination | Optional (self-signed) | cert-manager / Cloud LB | HAProxy / nginx |
| Monitoring | Optional | Prometheus + Grafana | Prometheus + Grafana |

## Container Images

| Image | Registry | Size | Purpose |
|-------|----------|------|---------|
| `pix-backend` | Private registry | ~180 MB | Elixir release (4 services) |
| `pix-frontend` | Private registry | ~25 MB | Admin portal (nginx + Vue SPA) |
| `pix-user-frontend` | Private registry | ~25 MB | User portal (nginx + Vue SPA) |

Build images:

```bash
# Backend
cd backend
docker build -t pix-backend:latest .

# Admin Frontend
cd frontend/admin
docker build -t pix-frontend:latest .

# User Frontend
cd frontend/user
docker build -t pix-user-frontend:latest .
```

## Health Checks

All services expose health endpoints:

| Service | Endpoint | Method | Expected |
|---------|----------|--------|----------|
| Settlement (Gateway) | `/health` | GET | 200 OK |
| Dict Service | `/api/health` | GET | 200 OK |
| SPI Service | `/api/health` | GET | 200 OK |
| Prometheus Metrics | `/metrics` | GET | 200 OK |

## Environment-Specific Guides

- [Docker Compose](./docker-compose.md) -- development and small-scale production
- [Kubernetes](./kubernetes.md) -- production-grade orchestration
- [AWS](./aws.md) -- Amazon Web Services deployment
- [GCP](./gcp.md) -- Google Cloud Platform deployment
- [Azure](./azure.md) -- Microsoft Azure deployment
- [OCI](./oci.md) -- Oracle Cloud Infrastructure deployment
- [On-Premises](./on-premises.md) -- bare metal and virtualized deployments

## Expected Outcome

After reading this overview, you can select the appropriate deployment model and proceed to the environment-specific guide that matches your infrastructure.
