Some checks are pending
CI Pipeline / Run Tests (push) Waiting to run
CI Pipeline / Lint Code (push) Waiting to run
CI Pipeline / Security Scan (push) Waiting to run
CI Pipeline / Build Docker Images (push) Blocked by required conditions
CI Pipeline / E2E Tests (push) Blocked by required conditions
151 lines
3.8 KiB
YAML
151 lines
3.8 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
gateway:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.prod
|
|
ports:
|
|
- "9876:9876" # Gateway API
|
|
- "8081:8081" # Blossom server
|
|
- "6882:6882/udp" # DHT node
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./configs:/app/configs:ro
|
|
- ./logs:/app/logs
|
|
environment:
|
|
- GO_ENV=production
|
|
- CGO_ENABLED=1
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
depends_on:
|
|
- redis
|
|
- prometheus
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9876/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./configs/redis.conf:/usr/local/etc/redis/redis.conf:ro
|
|
command: redis-server /usr/local/etc/redis/redis.conf
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Monitoring Stack
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
ports:
|
|
- "9090:9090"
|
|
volumes:
|
|
- ./configs/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./configs/alert_rules.yml:/etc/prometheus/alert_rules.yml:ro
|
|
- prometheus_data:/prometheus
|
|
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'
|
|
- '--web.enable-admin-api'
|
|
restart: unless-stopped
|
|
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./configs/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./configs/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
environment:
|
|
- GF_SECURITY_ADMIN_PASSWORD=admin123
|
|
- GF_USERS_ALLOW_SIGN_UP=false
|
|
- GF_INSTALL_PLUGINS=grafana-piechart-panel
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- prometheus
|
|
|
|
loki:
|
|
image: grafana/loki:latest
|
|
ports:
|
|
- "3100:3100"
|
|
volumes:
|
|
- ./configs/loki.yml:/etc/loki/local-config.yaml:ro
|
|
- loki_data:/tmp/loki
|
|
command: -config.file=/etc/loki/local-config.yaml
|
|
restart: unless-stopped
|
|
|
|
promtail:
|
|
image: grafana/promtail:latest
|
|
volumes:
|
|
- ./logs:/var/log/gateway:ro
|
|
- ./configs/promtail.yml:/etc/promtail/config.yml:ro
|
|
- /var/log:/var/log:ro
|
|
command: -config.file=/etc/promtail/config.yml
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- loki
|
|
|
|
alertmanager:
|
|
image: prom/alertmanager:latest
|
|
ports:
|
|
- "9093:9093"
|
|
volumes:
|
|
- ./configs/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
|
|
- alertmanager_data:/alertmanager
|
|
command:
|
|
- '--config.file=/etc/alertmanager/alertmanager.yml'
|
|
- '--storage.path=/alertmanager'
|
|
- '--web.external-url=http://localhost:9093'
|
|
restart: unless-stopped
|
|
|
|
# Reverse proxy with SSL termination
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./configs/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./configs/nginx/ssl:/etc/nginx/ssl:ro
|
|
- ./logs/nginx:/var/log/nginx
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- gateway
|
|
|
|
# Database backup service
|
|
backup:
|
|
image: alpine:latest
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./backups:/app/backups
|
|
- ./scripts/backup.sh:/app/backup.sh:ro
|
|
command: ["sh", "-c", "while true; do sh /app/backup.sh; sleep 3600; done"]
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
redis_data:
|
|
prometheus_data:
|
|
grafana_data:
|
|
loki_data:
|
|
alertmanager_data:
|
|
|
|
networks:
|
|
default:
|
|
name: torrent-gateway-prod |