- Remove old review reports (keep latest only) - Move docs/ to deploy/docs-backup/ - Move performance-testing/ to deploy/ - Clean up test output files - Organize root directory
148 lines
3.8 KiB
YAML
148 lines
3.8 KiB
YAML
# Sub2API 多机统一运维 - 中心监控节点
|
|
# 建议配置: 4核8G+ 或云服务器
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# VictoriaMetrics 单节点版 (可扩展为集群)
|
|
victoriametrics:
|
|
image: victoriametrics/victoria-metrics:v1.93.0
|
|
container_name: sub2api-vm
|
|
restart: unless-stopped
|
|
mem_limit: 2g
|
|
cpus: '1.0'
|
|
command:
|
|
- '--storageDataPath=/storage'
|
|
- '--retentionPeriod=90d'
|
|
- '--httpListenAddr=:8428'
|
|
- '--maxConcurrentInserts=32'
|
|
- '--maxInsertRequestSize=32MB'
|
|
- '--search.maxQueryDuration=2m'
|
|
- '--search.maxPointsPerTimeseries=30000'
|
|
- '--dedup.minScrapeInterval=15s'
|
|
volumes:
|
|
- vm-storage:/storage
|
|
ports:
|
|
- "8428:8428"
|
|
networks:
|
|
- monitoring-central
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8428/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# vminsert - 数据写入层 (集群模式启用)
|
|
vminsert:
|
|
image: victoriametrics/vminsert:v1.93.0
|
|
container_name: sub2api-vm-insert
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: '0.5'
|
|
command:
|
|
- '--storageNode=victoriametrics:8428'
|
|
- '--maxConcurrentInserts=16'
|
|
- '--maxInsertRequestSize=32MB'
|
|
ports:
|
|
- "8480:8480"
|
|
networks:
|
|
- monitoring-central
|
|
depends_on:
|
|
- victoriametrics
|
|
|
|
# vmselect - 查询层 (集群模式启用)
|
|
vmselect:
|
|
image: victoriametrics/vmselect:v1.93.0
|
|
container_name: sub2api-vm-select
|
|
restart: unless-stopped
|
|
mem_limit: 1g
|
|
cpus: '0.5'
|
|
command:
|
|
- '--storageNode=victoriametrics:8428'
|
|
- '--search.maxQueryDuration=2m'
|
|
- '--search.maxPointsPerTimeseries=30000'
|
|
ports:
|
|
- "8481:8481"
|
|
networks:
|
|
- monitoring-central
|
|
depends_on:
|
|
- victoriametrics
|
|
|
|
# 中心 Grafana
|
|
grafana-central:
|
|
image: grafana/grafana:10.3.0
|
|
container_name: sub2api-grafana-central
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: '0.5'
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
|
|
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
|
|
- GF_DATABASE_TYPE=postgres
|
|
- GF_DATABASE_HOST=postgres:5432
|
|
- GF_DATABASE_NAME=grafana
|
|
- GF_DATABASE_USER=grafana
|
|
- GF_DATABASE_PASSWORD=${GRAFANA_DB_PASSWORD:-grafana}
|
|
- GF_DATABASE_SSL_MODE=disable
|
|
- GF_ANALYTICS_REPORTING_ENABLED=false
|
|
- GF_LOG_LEVEL=info
|
|
volumes:
|
|
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
- grafana-central-data:/var/lib/grafana
|
|
ports:
|
|
- "3000:3000"
|
|
networks:
|
|
- monitoring-central
|
|
depends_on:
|
|
- postgres
|
|
|
|
# Alertmanager - 统一告警管理
|
|
alertmanager:
|
|
image: prom/alertmanager:v0.26.0
|
|
container_name: sub2api-alertmanager
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: '0.2'
|
|
command:
|
|
- '--config.file=/etc/alertmanager/config.yml'
|
|
- '--storage.path=/alertmanager'
|
|
- '--web.external-url=http://localhost:9093'
|
|
volumes:
|
|
- ./alertmanager/config-central.yml:/etc/alertmanager/config.yml:ro
|
|
- alertmanager-data:/alertmanager
|
|
ports:
|
|
- "9093:9093"
|
|
networks:
|
|
- monitoring-central
|
|
|
|
# Grafana 数据库
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: sub2api-grafana-db
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: '0.2'
|
|
environment:
|
|
- POSTGRES_USER=grafana
|
|
- POSTGRES_PASSWORD=${GRAFANA_DB_PASSWORD:-grafana}
|
|
- POSTGRES_DB=grafana
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
networks:
|
|
- monitoring-central
|
|
|
|
volumes:
|
|
vm-storage:
|
|
driver: local
|
|
grafana-central-data:
|
|
driver: local
|
|
alertmanager-data:
|
|
driver: local
|
|
postgres-data:
|
|
driver: local
|
|
|
|
networks:
|
|
monitoring-central:
|
|
driver: bridge
|