mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
- Introduced `README_ADDITIONS.md` for new services and features including CLI tools, system bootstrap, monitoring stack, and backup automation. - Created Dockerfiles for CLI and admin tools, enabling standalone usage and administrative tasks. - Implemented `docker-compose.monitoring.yml` for Prometheus, Grafana, Loki, and related services for monitoring and observability. - Added `backup-database.sh` for automated PostgreSQL backups with retention policies. - Developed `bootstrap-system.sh` for initializing the system, running migrations, and seeding the database. - Updated `deploy.sh` for streamlined deployment across development, production, and monitoring environments. - Configured Prometheus and Grafana with appropriate datasource and scrape configurations. - Enhanced directory structure for better organization of deployment files and scripts.
233 lines
6.0 KiB
YAML
233 lines
6.0 KiB
YAML
# MetaBuilder Monitoring Stack
|
|
# Prometheus, Grafana, Loki for logs, and health monitoring
|
|
# Usage: docker-compose -f deployment/docker/docker-compose.monitoring.yml up -d
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# Prometheus - Metrics collection
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: metabuilder-prometheus
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
- '--storage.tsdb.retention.time=30d'
|
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
- '--web.console.templates=/etc/prometheus/consoles'
|
|
- '--web.enable-lifecycle'
|
|
volumes:
|
|
- ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./config/prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
|
|
- prometheus_data:/prometheus
|
|
ports:
|
|
- "9090:9090"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
- metabuilder-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# Grafana - Metrics visualization
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: metabuilder-grafana
|
|
environment:
|
|
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER:-admin}
|
|
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin}
|
|
GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource
|
|
GF_SERVER_ROOT_URL: ${GRAFANA_ROOT_URL:-http://localhost:3001}
|
|
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
ports:
|
|
- "3001:3000"
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- prometheus
|
|
- loki
|
|
networks:
|
|
- metabuilder-monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
# Loki - Log aggregation
|
|
loki:
|
|
image: grafana/loki:latest
|
|
container_name: metabuilder-loki
|
|
command: -config.file=/etc/loki/local-config.yaml
|
|
volumes:
|
|
- ./config/loki/loki-config.yml:/etc/loki/local-config.yaml:ro
|
|
- loki_data:/loki
|
|
ports:
|
|
- "3100:3100"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
- metabuilder-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# Promtail - Log shipper
|
|
promtail:
|
|
image: grafana/promtail:latest
|
|
container_name: metabuilder-promtail
|
|
command: -config.file=/etc/promtail/config.yml
|
|
volumes:
|
|
- ./config/promtail/promtail-config.yml:/etc/promtail/config.yml:ro
|
|
- /var/log:/var/log:ro
|
|
- /var/lib/docker/containers:/var/lib/docker/containers:ro
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- loki
|
|
networks:
|
|
- metabuilder-monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
reservations:
|
|
cpus: '0.1'
|
|
memory: 128M
|
|
|
|
# Node Exporter - Host metrics
|
|
node-exporter:
|
|
image: prom/node-exporter:latest
|
|
container_name: metabuilder-node-exporter
|
|
command:
|
|
- '--path.rootfs=/host'
|
|
- '--path.procfs=/host/proc'
|
|
- '--path.sysfs=/host/sys'
|
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
|
volumes:
|
|
- /:/host:ro,rslave
|
|
ports:
|
|
- "9100:9100"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
|
|
# Postgres Exporter - Database metrics
|
|
postgres-exporter:
|
|
image: prometheuscommunity/postgres-exporter:latest
|
|
container_name: metabuilder-postgres-exporter
|
|
environment:
|
|
DATA_SOURCE_NAME: "postgresql://${POSTGRES_USER:-metabuilder}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-metabuilder}?sslmode=disable"
|
|
ports:
|
|
- "9187:9187"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
- metabuilder-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
|
|
# Redis Exporter - Cache metrics
|
|
redis-exporter:
|
|
image: oliver006/redis_exporter:latest
|
|
container_name: metabuilder-redis-exporter
|
|
environment:
|
|
REDIS_ADDR: redis:6379
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD:-changeme_redis_password}
|
|
ports:
|
|
- "9121:9121"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
- metabuilder-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
|
|
# cAdvisor - Container metrics
|
|
cadvisor:
|
|
image: gcr.io/cadvisor/cadvisor:latest
|
|
container_name: metabuilder-cadvisor
|
|
privileged: true
|
|
volumes:
|
|
- /:/rootfs:ro
|
|
- /var/run:/var/run:ro
|
|
- /sys:/sys:ro
|
|
- /var/lib/docker/:/var/lib/docker:ro
|
|
- /dev/disk/:/dev/disk:ro
|
|
ports:
|
|
- "8080:8080"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# Alertmanager - Alert routing
|
|
alertmanager:
|
|
image: prom/alertmanager:latest
|
|
container_name: metabuilder-alertmanager
|
|
command:
|
|
- '--config.file=/etc/alertmanager/config.yml'
|
|
- '--storage.path=/alertmanager'
|
|
volumes:
|
|
- ./config/alertmanager/alertmanager.yml:/etc/alertmanager/config.yml:ro
|
|
- alertmanager_data:/alertmanager
|
|
ports:
|
|
- "9093:9093"
|
|
restart: unless-stopped
|
|
networks:
|
|
- metabuilder-monitoring
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
|
|
volumes:
|
|
prometheus_data:
|
|
driver: local
|
|
grafana_data:
|
|
driver: local
|
|
loki_data:
|
|
driver: local
|
|
alertmanager_data:
|
|
driver: local
|
|
|
|
networks:
|
|
metabuilder-monitoring:
|
|
driver: bridge
|
|
metabuilder-network:
|
|
external: true
|
|
name: metabuilder_metabuilder-network
|