fix(infra): resolve NestJS dist build and Prometheus target issues
NestJS: disable incremental in 6 services tsconfig.json to fix dist not emitted when nest-cli deleteOutDir conflicts with tsc tsbuildinfo. classes/iam: import HealthModule in AppModule to fix /healthz 404. classes: rewrite HealthController to Drizzle getDb from TypeORM DI. teacher-bff: add /metrics endpoint for Prometheus scraping. infra: add node/mysql/redis exporters to observability profile. mysql-exporter v0.15.1 uses command-line flags not DATA_SOURCE_NAME. prometheus: enable web.enable-lifecycle for hot reload.
This commit is contained in:
@@ -184,8 +184,14 @@ services:
|
||||
container_name: edu-prometheus
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
- "--storage.tsdb.retention.time=15d"
|
||||
- "--web.enable-lifecycle"
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus_data:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
grafana:
|
||||
@@ -199,6 +205,49 @@ services:
|
||||
- "3030:3000"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
# ============================================================
|
||||
# Exporters(observability profile,与 Prometheus 同网络)
|
||||
# ============================================================
|
||||
node-exporter:
|
||||
image: docker.m.daocloud.io/prom/node-exporter:v1.8.2
|
||||
container_name: edu-node-exporter
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- "--path.rootfs=/host"
|
||||
ports:
|
||||
- "9100:9100"
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/host:ro
|
||||
mysql-exporter:
|
||||
image: docker.m.daocloud.io/prom/mysqld-exporter:v0.15.1
|
||||
container_name: edu-mysql-exporter
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- "--mysqld.address=edu-mysql:3306"
|
||||
- "--mysqld.username=edu:changeme"
|
||||
environment:
|
||||
MYSQLD_EXPORTER_PASSWORD: "changeme"
|
||||
ports:
|
||||
- "9104:9104"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis-exporter:
|
||||
image: docker.m.daocloud.io/oliver006/redis_exporter:v1.67.0
|
||||
container_name: edu-redis-exporter
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
REDIS_ADDR: "redis://edu-redis:6379"
|
||||
ports:
|
||||
- "9121:9121"
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_started
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
@@ -206,3 +255,4 @@ volumes:
|
||||
neo4j_data:
|
||||
es_data:
|
||||
grafana_data:
|
||||
prometheus_data:
|
||||
|
||||
@@ -89,6 +89,6 @@ scrape_configs:
|
||||
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
- targets: ['host.docker.internal:9100']
|
||||
labels:
|
||||
service: node-exporter
|
||||
|
||||
Reference in New Issue
Block a user