206 lines
5.8 KiB
YAML
206 lines
5.8 KiB
YAML
name: proxy-pool
|
|
|
|
x-app-environment: &app-environment
|
|
PROXY_POOL_CONFIG: /etc/proxy-pool/config.yaml
|
|
PROXY_POOL_GATEWAY_PASSWORD: ${PROXY_POOL_GATEWAY_PASSWORD:?set PROXY_POOL_GATEWAY_PASSWORD}
|
|
PROXY_POOL_EXTRACT_TOKEN: ${PROXY_POOL_EXTRACT_TOKEN:?set PROXY_POOL_EXTRACT_TOKEN}
|
|
PROXY_POOL_ADMIN_TOKEN: ${PROXY_POOL_ADMIN_TOKEN:?set PROXY_POOL_ADMIN_TOKEN}
|
|
PROVIDER_A_TOKEN: ${PROVIDER_A_TOKEN:?set PROVIDER_A_TOKEN}
|
|
PROVIDER_B_TOKEN: ${PROVIDER_B_TOKEN:?set PROVIDER_B_TOKEN}
|
|
|
|
x-app: &app
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/docker/Dockerfile
|
|
image: proxy-pool:local
|
|
restart: unless-stopped
|
|
networks: [frontend, backend]
|
|
environment: *app-environment
|
|
stop_grace_period: 45s
|
|
|
|
services:
|
|
gateway-a:
|
|
<<: *app
|
|
command: ["proxy-gateway"]
|
|
environment:
|
|
<<: *app-environment
|
|
PROXY_POOL_CONTROL_PLANE_ADDRESS: controller:8443
|
|
PROXY_POOL_CLUSTER_ID: compose-local
|
|
PROXY_POOL_WORKER_ID: gateway-a
|
|
PROXY_POOL_INSTANCE_ID: gateway-a-1
|
|
PROXY_POOL_ZONE: compose-local
|
|
volumes:
|
|
- ./config/local.yaml:/etc/proxy-pool/config.yaml:ro
|
|
- ./.control-plane-tls/gateway-a:/run/proxy-pool-tls/client:ro
|
|
depends_on:
|
|
controller:
|
|
condition: service_healthy
|
|
expose: ["8080", "9090"]
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:9090/readyz"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 12
|
|
start_period: 10s
|
|
|
|
gateway-b:
|
|
<<: *app
|
|
command: ["proxy-gateway"]
|
|
environment:
|
|
<<: *app-environment
|
|
PROXY_POOL_CONTROL_PLANE_ADDRESS: controller:8443
|
|
PROXY_POOL_CLUSTER_ID: compose-local
|
|
PROXY_POOL_WORKER_ID: gateway-b
|
|
PROXY_POOL_INSTANCE_ID: gateway-b-1
|
|
PROXY_POOL_ZONE: compose-local
|
|
volumes:
|
|
- ./config/local.yaml:/etc/proxy-pool/config.yaml:ro
|
|
- ./.control-plane-tls/gateway-b:/run/proxy-pool-tls/client:ro
|
|
depends_on:
|
|
controller:
|
|
condition: service_healthy
|
|
expose: ["8080", "9090"]
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:9090/readyz"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 12
|
|
start_period: 10s
|
|
|
|
controller:
|
|
<<: *app
|
|
command: ["proxy-controller"]
|
|
environment:
|
|
<<: *app-environment
|
|
PROXY_POOL_CONFIG_FINGERPRINT_KEY: ${PROXY_POOL_CONFIG_FINGERPRINT_KEY:?set PROXY_POOL_CONFIG_FINGERPRINT_KEY}
|
|
volumes:
|
|
- ./config/local.yaml:/etc/proxy-pool/config.yaml:ro
|
|
- ./.control-plane-tls/controller:/run/proxy-pool-tls/server:ro
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
expose: ["8081", "8082", "8443", "9090"]
|
|
ports:
|
|
- "127.0.0.1:8081:8081"
|
|
- "127.0.0.1:8082:8082"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:9090/readyz"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 12
|
|
start_period: 15s
|
|
|
|
checker:
|
|
<<: *app
|
|
command: ["proxy-checker"]
|
|
environment:
|
|
<<: *app-environment
|
|
PROXY_POOL_CONTROL_PLANE_ADDRESS: controller:8443
|
|
PROXY_POOL_CHECKER_ID: checker-a
|
|
PROXY_POOL_CHECKER_INSTANCE_ID: checker-a-1
|
|
PROXY_POOL_CHECKER_MAX_IN_FLIGHT: "200"
|
|
volumes:
|
|
- ./config/local.yaml:/etc/proxy-pool/config.yaml:ro
|
|
- ./.control-plane-tls/checker-a:/run/proxy-pool-tls/client:ro
|
|
depends_on:
|
|
controller:
|
|
condition: service_healthy
|
|
expose: ["9090"]
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:9090/readyz"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 12
|
|
start_period: 10s
|
|
|
|
haproxy:
|
|
image: haproxy:3.2-alpine
|
|
restart: unless-stopped
|
|
networks: [frontend]
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
- "127.0.0.1:8404:8404"
|
|
volumes:
|
|
- ./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
depends_on:
|
|
gateway-a:
|
|
condition: service_healthy
|
|
gateway-b:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8404/healthz"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 6
|
|
|
|
postgres:
|
|
image: postgres:18-alpine
|
|
restart: unless-stopped
|
|
networks: [backend]
|
|
environment:
|
|
POSTGRES_DB: proxy_pool
|
|
POSTGRES_USER: proxy_pool
|
|
POSTGRES_PASSWORD: local-only-change-me
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U proxy_pool -d proxy_pool"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
|
|
redis:
|
|
image: redis:8.2-alpine
|
|
restart: unless-stopped
|
|
command: ["redis-server", "--appendonly", "no", "--save", ""]
|
|
networks: [backend]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
|
|
prometheus:
|
|
image: prom/prometheus:v3.5.0
|
|
restart: unless-stopped
|
|
networks: [frontend, backend]
|
|
ports:
|
|
- "127.0.0.1:9091:9090"
|
|
volumes:
|
|
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./prometheus/rules:/etc/prometheus/rules:ro
|
|
- prometheus-data:/prometheus
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --storage.tsdb.path=/prometheus
|
|
- --storage.tsdb.retention.time=7d
|
|
- --web.enable-lifecycle
|
|
|
|
grafana:
|
|
image: grafana/grafana:12.1.0
|
|
restart: unless-stopped
|
|
networks: [backend]
|
|
ports:
|
|
- "127.0.0.1:3000:3000"
|
|
environment:
|
|
GF_SECURITY_ADMIN_USER: admin
|
|
GF_SECURITY_ADMIN_PASSWORD: local-only-change-me
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
volumes:
|
|
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
- grafana-data:/var/lib/grafana
|
|
depends_on: [prometheus]
|
|
|
|
networks:
|
|
frontend: {}
|
|
backend:
|
|
internal: true
|
|
|
|
volumes:
|
|
postgres-data: {}
|
|
prometheus-data: {}
|
|
grafana-data: {}
|