proxy-pool/deploy/docker-compose.yml
youfak 155411ef23
Some checks are pending
ci / proto (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
ci / race (push) Waiting to run
ci / integration (push) Waiting to run
fix: align deployment manifests with available commands
2026-07-31 16:56:38 +08:00

156 lines
4.2 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]
volumes:
- ./config/local.yaml:/etc/proxy-pool/config.yaml:ro
environment: *app-environment
stop_grace_period: 45s
services:
gateway-a:
<<: *app
command: ["proxy-gateway"]
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"]
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}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
expose: ["8081", "8082", "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
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: {}