83 lines
2.2 KiB
Text
83 lines
2.2 KiB
Text
@startuml API Infrastructure with HAProxy
|
||
skinparam linetype ortho
|
||
|
||
title Архитектура развертывания API (с HAProxy)
|
||
|
||
actor "Клиент" as Client
|
||
cloud "Internet" as Internet
|
||
|
||
package "Kubernetes Cluster" {
|
||
|
||
package "Ingress Layer" {
|
||
component "Nginx Ingress\nController" as NginxIngress #lightblue
|
||
note right of NginxIngress
|
||
- HTTPS (443) termination
|
||
- TLS (Let's Encrypt)
|
||
- X-Forwarded-For
|
||
- Domains:
|
||
* api.ivideon.com
|
||
* api.stage-01.stg01-k8s.extcam.com
|
||
end note
|
||
}
|
||
|
||
package "Proxy Layer" {
|
||
component "HAProxy\n(haproxy-central)" as HAProxy #lightgreen
|
||
note right of HAProxy
|
||
- Port 80 (HTTP)
|
||
- ACL routing
|
||
- Health checks (/status)
|
||
- Backend: api4.service.ivideon:80
|
||
end note
|
||
}
|
||
|
||
package "Service Layer" {
|
||
component "api4 Service" as Service #lightyellow
|
||
note right of Service
|
||
- Kubernetes Service
|
||
- Port 80 → 8080
|
||
- Load balancing
|
||
- DNS: api4.service.ivideon
|
||
end note
|
||
}
|
||
|
||
package "Application Layer" {
|
||
collections "api4 Pods" as Pods
|
||
|
||
component "Pod 1" as Pod1 {
|
||
component "Tornado\nHTTP Server" as Tornado1 #orange
|
||
note bottom of Tornado1
|
||
- Port: 8080
|
||
- xheaders: true
|
||
- Workers: 4
|
||
end note
|
||
}
|
||
|
||
component "Pod 2-N" as PodN {
|
||
component "Tornado\nHTTP Server" as TornadoN #orange
|
||
}
|
||
}
|
||
}
|
||
|
||
database "MongoDB\n(main)" as MongoDB
|
||
database "MongoDB\n(user_registry)" as UserRegistry
|
||
|
||
Client --> Internet: HTTPS\nPOST /public/registration
|
||
Internet --> NginxIngress: 443 (HTTPS)
|
||
NginxIngress --> HAProxy: 80 (HTTP)\n+ X-Forwarded-For
|
||
HAProxy --> Service: api4.service.ivideon:80\n(ACL: !has_api5_components)
|
||
Service --> Pods: Round-robin LB
|
||
Pods --> Pod1: 8080
|
||
Pods --> PodN: 8080
|
||
|
||
Pod1 --> MongoDB: users.insert_one()
|
||
Pod1 --> UserRegistry: check duplicate
|
||
|
||
note bottom of HAProxy
|
||
**HAProxy ACL Routing:**
|
||
- use_backend api4 if host_api !has_api5_components
|
||
- Health check: GET /status
|
||
- server-template api-four-srv 4
|
||
- option redispatch
|
||
end note
|
||
|
||
@enduml
|