asi / deploy /docker-compose.yml
srossi93's picture
chore: Add Prometheus and Grafana configuration, health check, and load test scripts
333517e
raw
history blame
2.84 kB
services:
traefik:
image: traefik:v3.6
restart: unless-stopped
command:
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--metrics.prometheus=true"
- "--accesslog=true"
- "--ping=true"
ports:
- "8000:80"
- "8080:8080" # Traefik dashboard
environment:
DOCKER_API_VERSION: "1.45"
volumes:
- ${XDG_RUNTIME_DIR}/docker.sock:/var/run/docker.sock:ro
networks:
- web
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
app:
build:
context: ..
dockerfile: Dockerfile
restart: unless-stopped
deploy:
replicas: 4
labels:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=PathPrefix(`/`)"
- "traefik.http.routers.app.entrypoints=web"
- "traefik.http.services.app.loadbalancer.server.port=8501"
- "traefik.http.services.app.loadbalancer.sticky.cookie=true"
- "traefik.http.services.app.loadbalancer.sticky.cookie.name=streamlit_session"
- "traefik.http.services.app.loadbalancer.healthcheck.path=/_stcore/health"
- "traefik.http.services.app.loadbalancer.healthcheck.interval=10s"
networks:
- web
depends_on:
traefik:
condition: service_healthy
prometheus:
image: prom/prometheus:v2.54.1
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=15d"
- "--web.enable-lifecycle"
ports:
- "9090:9090"
networks:
- web
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 3
grafana:
image: grafana/grafana:11.3.0
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
ports:
- "3000:3000"
networks:
- web
depends_on:
prometheus:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 3
networks:
web:
driver: bridge
volumes:
prometheus-data:
name: asi-demo_prometheus-data
external: true
grafana-data:
name: asi-demo_grafana-data
external: true