177 lines
4.2 KiB
YAML
177 lines
4.2 KiB
YAML
![]() |
version: '3.8'
|
||
|
|
||
|
services:
|
||
|
worker:
|
||
|
build: .
|
||
|
container_name: seo-worker
|
||
|
restart: unless-stopped
|
||
|
environment:
|
||
|
- NODE_ENV=production
|
||
|
- WORKER_PORT=3002
|
||
|
- HEALTH_CHECK_PORT=8080
|
||
|
|
||
|
# Redis Configuration
|
||
|
- REDIS_HOST=redis
|
||
|
- REDIS_PORT=6379
|
||
|
- REDIS_PASSWORD=${REDIS_PASSWORD}
|
||
|
- REDIS_DB=0
|
||
|
|
||
|
# Database Configuration
|
||
|
- DATABASE_URL=${DATABASE_URL}
|
||
|
|
||
|
# AI Vision APIs
|
||
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||
|
- GOOGLE_CLOUD_VISION_KEY=${GOOGLE_CLOUD_VISION_KEY}
|
||
|
- VISION_CONFIDENCE_THRESHOLD=0.40
|
||
|
|
||
|
# Storage Configuration
|
||
|
- MINIO_ENDPOINT=minio
|
||
|
- MINIO_PORT=9000
|
||
|
- MINIO_USE_SSL=false
|
||
|
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
|
||
|
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||
|
- MINIO_BUCKET_NAME=seo-images
|
||
|
|
||
|
# Processing Configuration
|
||
|
- MAX_CONCURRENT_JOBS=5
|
||
|
- JOB_TIMEOUT=300000
|
||
|
- RETRY_ATTEMPTS=3
|
||
|
- RETRY_DELAY=2000
|
||
|
|
||
|
# File Processing
|
||
|
- MAX_FILE_SIZE=52428800
|
||
|
- ALLOWED_FILE_TYPES=jpg,jpeg,png,gif,webp
|
||
|
- TEMP_DIR=/tmp/seo-worker
|
||
|
- TEMP_FILE_CLEANUP_INTERVAL=3600000
|
||
|
|
||
|
# Virus Scanning
|
||
|
- VIRUS_SCAN_ENABLED=true
|
||
|
- CLAMAV_HOST=localhost
|
||
|
- CLAMAV_PORT=3310
|
||
|
- CLAMAV_TIMEOUT=30000
|
||
|
|
||
|
# Monitoring
|
||
|
- METRICS_ENABLED=true
|
||
|
- METRICS_PORT=9090
|
||
|
- LOG_LEVEL=info
|
||
|
|
||
|
ports:
|
||
|
- "3002:3002" # Worker API port
|
||
|
- "8080:8080" # Health check port
|
||
|
- "9090:9090" # Metrics port
|
||
|
|
||
|
volumes:
|
||
|
- worker-temp:/tmp/seo-worker
|
||
|
- worker-logs:/app/logs
|
||
|
|
||
|
depends_on:
|
||
|
- redis
|
||
|
- minio
|
||
|
|
||
|
networks:
|
||
|
- worker-network
|
||
|
|
||
|
healthcheck:
|
||
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||
|
interval: 30s
|
||
|
timeout: 10s
|
||
|
retries: 3
|
||
|
start_period: 30s
|
||
|
|
||
|
redis:
|
||
|
image: redis:7-alpine
|
||
|
container_name: seo-redis
|
||
|
restart: unless-stopped
|
||
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
|
||
|
environment:
|
||
|
- REDIS_PASSWORD=${REDIS_PASSWORD}
|
||
|
ports:
|
||
|
- "6379:6379"
|
||
|
volumes:
|
||
|
- redis-data:/data
|
||
|
networks:
|
||
|
- worker-network
|
||
|
healthcheck:
|
||
|
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||
|
interval: 30s
|
||
|
timeout: 10s
|
||
|
retries: 3
|
||
|
|
||
|
minio:
|
||
|
image: minio/minio:latest
|
||
|
container_name: seo-minio
|
||
|
restart: unless-stopped
|
||
|
command: server /data --console-address ":9001"
|
||
|
environment:
|
||
|
- MINIO_ROOT_USER=${MINIO_ACCESS_KEY}
|
||
|
- MINIO_ROOT_PASSWORD=${MINIO_SECRET_KEY}
|
||
|
ports:
|
||
|
- "9000:9000" # MinIO API
|
||
|
- "9001:9001" # MinIO Console
|
||
|
volumes:
|
||
|
- minio-data:/data
|
||
|
networks:
|
||
|
- worker-network
|
||
|
healthcheck:
|
||
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||
|
interval: 30s
|
||
|
timeout: 10s
|
||
|
retries: 3
|
||
|
|
||
|
# Optional: Prometheus for metrics collection
|
||
|
prometheus:
|
||
|
image: prom/prometheus:latest
|
||
|
container_name: seo-prometheus
|
||
|
restart: unless-stopped
|
||
|
command:
|
||
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
||
|
- '--storage.tsdb.path=/prometheus'
|
||
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||
|
- '--web.console.templates=/etc/prometheus/consoles'
|
||
|
- '--storage.tsdb.retention.time=200h'
|
||
|
- '--web.enable-lifecycle'
|
||
|
ports:
|
||
|
- "9091:9090"
|
||
|
volumes:
|
||
|
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||
|
- prometheus-data:/prometheus
|
||
|
networks:
|
||
|
- worker-network
|
||
|
depends_on:
|
||
|
- worker
|
||
|
|
||
|
# Optional: Grafana for metrics visualization
|
||
|
grafana:
|
||
|
image: grafana/grafana:latest
|
||
|
container_name: seo-grafana
|
||
|
restart: unless-stopped
|
||
|
environment:
|
||
|
- GF_SECURITY_ADMIN_USER=admin
|
||
|
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
|
||
|
- GF_USERS_ALLOW_SIGN_UP=false
|
||
|
ports:
|
||
|
- "3000:3000"
|
||
|
volumes:
|
||
|
- grafana-data:/var/lib/grafana
|
||
|
networks:
|
||
|
- worker-network
|
||
|
depends_on:
|
||
|
- prometheus
|
||
|
|
||
|
volumes:
|
||
|
worker-temp:
|
||
|
driver: local
|
||
|
worker-logs:
|
||
|
driver: local
|
||
|
redis-data:
|
||
|
driver: local
|
||
|
minio-data:
|
||
|
driver: local
|
||
|
prometheus-data:
|
||
|
driver: local
|
||
|
grafana-data:
|
||
|
driver: local
|
||
|
|
||
|
networks:
|
||
|
worker-network:
|
||
|
driver: bridge
|