didi-lot1-ai/ai_platform/modules/web/deploy/metasearch/docker-compose.yaml

201 lines
5.8 KiB
YAML

# Metasearch Module - Docker Compose Configuration
#
# Architecture:
# nginx (load balancer) -> 3x SearXNG instances + dedicated Redis each
# Round-robin distributes requests to avoid CAPTCHA/rate-limits
#
# Port Allocation (x55xx = Backend Services / Search):
# 55100 - nginx load balancer (entry point)
#
# Naming Convention: didiAI-{module}-{service}
#
# Network:
# Uses deploy_default network (shared with other modules)
networks:
didi-network:
external: true # single shared network for all DIDI + AI platform stacks
services:
# ==========================================================================
# Nginx Load Balancer (entry point)
# ==========================================================================
searxng-lb:
container_name: didiAI-web-searxng
image: nginx:1.27-alpine
ports:
- "${SEARXNG_PORT:-55100}:8080"
networks:
- didi-network
volumes:
- ./nginx-lb.conf:/etc/nginx/nginx.conf:ro
depends_on:
searxng-1:
condition: service_healthy
searxng-2:
condition: service_healthy
searxng-3:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
# ==========================================================================
# SearXNG Instance 1
# ==========================================================================
searxng-1:
container_name: didiAI-web-searxng-1
image: docker.io/searxng/searxng:latest
networks:
- didi-network
volumes:
- ./searxng-1:/etc/searxng:rw
- searxng-data-1:/var/cache/searxng:rw
environment:
- SEARXNG_BASE_URL=http://localhost:55100
depends_on:
redis-1:
condition: service_healthy
tor:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# ==========================================================================
# SearXNG Instance 2
# ==========================================================================
searxng-2:
container_name: didiAI-web-searxng-2
image: docker.io/searxng/searxng:latest
networks:
- didi-network
volumes:
- ./searxng-2:/etc/searxng:rw
- searxng-data-2:/var/cache/searxng:rw
environment:
- SEARXNG_BASE_URL=http://localhost:55100
depends_on:
redis-2:
condition: service_healthy
tor:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# ==========================================================================
# SearXNG Instance 3
# ==========================================================================
searxng-3:
container_name: didiAI-web-searxng-3
image: docker.io/searxng/searxng:latest
networks:
- didi-network
volumes:
- ./searxng-3:/etc/searxng:rw
- searxng-data-3:/var/cache/searxng:rw
environment:
- SEARXNG_BASE_URL=http://localhost:55100
depends_on:
redis-3:
condition: service_healthy
tor:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# ==========================================================================
# Tor SOCKS5 proxy (shared by all SearXNG instances)
# ==========================================================================
tor:
container_name: didiAI-web-tor
image: dperson/torproxy:latest
networks:
- didi-network
environment:
- TOR_MaxCircuitDirtiness=300
- TOR_NewCircuitPeriod=60
healthcheck:
test: ["CMD", "curl", "-sf", "--socks5-hostname", "127.0.0.1:9050", "https://check.torproject.org/api/ip"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# ==========================================================================
# Redis instances (one per SearXNG for isolated cache/state)
# ==========================================================================
redis-1:
container_name: didiAI-web-searxng-redis-1
image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning
networks:
- didi-network
volumes:
- searxng-redis-data-1:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
redis-2:
container_name: didiAI-web-searxng-redis-2
image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning
networks:
- didi-network
volumes:
- searxng-redis-data-2:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
redis-3:
container_name: didiAI-web-searxng-redis-3
image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning
networks:
- didi-network
volumes:
- searxng-redis-data-3:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
volumes:
searxng-data-1:
searxng-data-2:
searxng-data-3:
searxng-redis-data-1:
searxng-redis-data-2:
searxng-redis-data-3: