97 lines
2.7 KiB
Plaintext
97 lines
2.7 KiB
Plaintext
```plaintext
|
|
%% Database Strategy with CloudNativePG (ADR-0027)
|
|
%% C4 Component diagram showing CNPG operator and clusters
|
|
|
|
flowchart TB
|
|
subgraph operator["🎛️ CNPG Operator"]
|
|
cnpg["CloudNativePG<br/>Controller<br/>(cnpg-system)"]
|
|
end
|
|
|
|
subgraph clusters["📊 PostgreSQL Clusters"]
|
|
direction LR
|
|
|
|
subgraph gitea_pg["gitea-pg"]
|
|
direction TB
|
|
g_primary["🔵 Primary"]
|
|
g_replica1["⚪ Replica"]
|
|
g_replica2["⚪ Replica"]
|
|
g_bouncer["🔗 PgBouncer"]
|
|
end
|
|
|
|
subgraph authentik_db["authentik-db"]
|
|
direction TB
|
|
a_primary["🔵 Primary"]
|
|
a_replica1["⚪ Replica"]
|
|
a_replica2["⚪ Replica"]
|
|
a_bouncer["🔗 PgBouncer"]
|
|
end
|
|
|
|
subgraph companions_db["companions-db"]
|
|
direction TB
|
|
c_primary["🔵 Primary"]
|
|
c_replica1["⚪ Replica"]
|
|
c_replica2["⚪ Replica"]
|
|
c_bouncer["🔗 PgBouncer"]
|
|
end
|
|
|
|
subgraph mlflow_db["mlflow-db"]
|
|
direction TB
|
|
m_primary["🔵 Primary"]
|
|
end
|
|
end
|
|
|
|
subgraph storage["💾 Storage"]
|
|
longhorn["Longhorn PVCs<br/>(NVMe/SSD)"]
|
|
s3["S3 Backups<br/>(barman)"]
|
|
end
|
|
|
|
subgraph services["🔌 Service Discovery"]
|
|
direction TB
|
|
rw["-rw (read-write)"]
|
|
ro["-ro (read-only)"]
|
|
pooler["-pooler-rw<br/>(PgBouncer)"]
|
|
end
|
|
|
|
subgraph apps["📦 Applications"]
|
|
gitea["Gitea"]
|
|
authentik["Authentik"]
|
|
companions["Companions"]
|
|
mlflow["MLflow"]
|
|
end
|
|
|
|
%% Operator manages clusters
|
|
cnpg -->|"Manages"| clusters
|
|
|
|
%% Storage connections
|
|
clusters --> longhorn
|
|
clusters -->|"WAL archiving"| s3
|
|
|
|
%% Service routing
|
|
g_bouncer --> rw
|
|
a_bouncer --> rw
|
|
c_bouncer --> rw
|
|
g_replica1 --> ro
|
|
g_replica2 --> ro
|
|
|
|
%% App connections
|
|
gitea -->|"gitea-pg-pooler-rw"| g_bouncer
|
|
authentik -->|"authentik-db-pooler-rw"| a_bouncer
|
|
companions -->|"companions-db-pooler-rw"| c_bouncer
|
|
mlflow -->|"mlflow-db-rw"| m_primary
|
|
|
|
classDef operator fill:#e74c3c,color:white
|
|
classDef primary fill:#3498db,color:white
|
|
classDef replica fill:#95a5a6,color:white
|
|
classDef bouncer fill:#9b59b6,color:white
|
|
classDef storage fill:#27ae60,color:white
|
|
classDef app fill:#f39c12,color:black
|
|
|
|
class cnpg operator
|
|
class g_primary,a_primary,c_primary,m_primary primary
|
|
class g_replica1,g_replica2,a_replica1,a_replica2,c_replica1,c_replica2 replica
|
|
class g_bouncer,a_bouncer,c_bouncer bouncer
|
|
class longhorn,s3 storage
|
|
class gitea,authentik,companions,mlflow app
|
|
|
|
```
|