Spaces:
Build error
Build error
File size: 3,396 Bytes
4ca5973 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | """
部署方案和启动脚本
包含 Docker 部署、本地部署和系统服务配置
"""
version: '3.8'
services:
# 主应用服务
hf-repair-system:
build:
context: .
dockerfile: Dockerfile.repair
container_name: hf-repair-system
restart: unless-stopped
environment:
- HF_TOKEN=${HF_TOKEN}
- WEBHOOK_URL=${WEBHOOK_URL}
- DB_PATH=/app/data/repair_system.db
- LOG_LEVEL=INFO
volumes:
- ./data:/app/data
- ./logs:/app/logs
- ./backups:/app/backups
- ./config:/app/config
ports:
- "8080:8080"
networks:
- hf-repair-network
depends_on:
- redis
- postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Redis 缓存服务
redis:
image: redis:7-alpine
container_name: hf-repair-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- hf-repair-network
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 30s
timeout: 10s
retries: 3
# PostgreSQL 数据库服务
postgres:
image: postgres:15-alpine
container_name: hf-repair-postgres
restart: unless-stopped
environment:
- POSTGRES_DB=hf_repair
- POSTGRES_USER=hf_repair
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- hf-repair-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hf_repair"]
interval: 30s
timeout: 10s
retries: 3
# Web 服务(可选的 Web 界面)
web-interface:
build:
context: ./web
dockerfile: Dockerfile
container_name: hf-repair-web
restart: unless-stopped
ports:
- "3000:3000"
environment:
- REACT_APP_API_URL=http://localhost:8080
networks:
- hf-repair-network
depends_on:
- hf-repair-system
# 监控服务
prometheus:
image: prom/prometheus:latest
container_name: hf-repair-prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
networks:
- hf-repair-network
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
# Grafana 可视化
grafana:
image: grafana/grafana:latest
container_name: hf-repair-grafana
restart: unless-stopped
ports:
- "3001:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana:/etc/grafana/provisioning
networks:
- hf-repair-network
depends_on:
- prometheus
volumes:
redis_data:
driver: local
postgres_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
networks:
hf-repair-network:
driver: bridge |