Files
FunctionalScaffold/deployment/docker-compose.yml
Roog (顾新培) 31af5e2286 main:添加核心文件并初始化项目
新增内容:
- 创建基础项目结构。
- 添加 `.gitignore` 和 `.dockerignore` 文件。
- 编写 `pyproject.toml` 和依赖文件。
- 添加算法模块及示例算法。
- 实现核心功能模块(日志、错误处理、指标)。
- 添加开发和运行所需的相关脚本文件及文档。
2026-02-02 10:46:01 +08:00

109 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
services:
app:
build:
context: ..
dockerfile: deployment/Dockerfile
ports:
- "8111:8000"
environment:
- APP_ENV=development
- LOG_LEVEL=INFO
- METRICS_ENABLED=true
# 方案1Pushgateway 配置
- PUSHGATEWAY_URL=pushgateway:9091
- METRICS_JOB_NAME=functional_scaffold
# 方案2Redis 配置
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_METRICS_DB=0
volumes:
- ../src:/app/src
restart: unless-stopped
depends_on:
- redis
- pushgateway
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/healthz')"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
# Redis - 用于集中式指标存储方案2
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
# Pushgateway - 用于短生命周期任务的指标推送方案1推荐
pushgateway:
image: prom/pushgateway:latest
ports:
- "9091:9091"
restart: unless-stopped
command:
- '--persistence.file=/data/pushgateway.data'
- '--persistence.interval=5m'
volumes:
- pushgateway_data:/data
# Redis Exporter - 将 Redis 指标导出为 Prometheus 格式方案2需要
redis-exporter:
build:
context: ..
dockerfile: deployment/Dockerfile.redis-exporter
ports:
- "8001:8001"
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_METRICS_DB=0
depends_on:
- redis
restart: unless-stopped
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ../monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
restart: unless-stopped
depends_on:
- pushgateway
- redis-exporter
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
- grafana_data:/var/lib/grafana
- ../monitoring/grafana:/etc/grafana/provisioning
restart: unless-stopped
depends_on:
- prometheus
volumes:
prometheus_data:
grafana_data:
redis_data:
pushgateway_data: