Spaces:
Build error
Build error
| """ | |
| 部署方案和启动脚本 | |
| 包含 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 |