File size: 2,370 Bytes
1aa566a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

version: "3.9"

# ============================================================
# Self-Healing ML System — Docker Compose
# ============================================================
#
# Services:
#   api        - FastAPI prediction service
#   dashboard  - Streamlit monitoring dashboard
#   mlflow     - MLflow tracking server
#
# Usage:
#   docker compose up --build
#   docker compose up api          # API only
#   docker compose up dashboard    # Dashboard only

services:
  # ----------------------------------------------------------
  # ML API (FastAPI)
  # ----------------------------------------------------------
  api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: self_healing_api
    ports:
      - "8000:8000"
    environment:
      - PYTHONUNBUFFERED=1
      - MLFLOW_TRACKING_URI=http://mlflow:5000
    volumes:
      - ./data:/app/data          # persist model registry + logs
      - ./configs:/app/configs    # live config changes
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    restart: unless-stopped
    networks:
      - self_healing_net

  # ----------------------------------------------------------
  # Streamlit Dashboard
  # ----------------------------------------------------------
  dashboard:
    build:
      context: .
      dockerfile: Dockerfile.dashboard
    container_name: self_healing_dashboard
    ports:
      - "8501:8501"
    environment:
      - API_URL=http://api:8000
    volumes:
      - ./data:/app/data
    depends_on:
      api:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - self_healing_net

  # ----------------------------------------------------------
  # MLflow Tracking Server
  # ----------------------------------------------------------
  mlflow:
    image: ghcr.io/mlflow/mlflow:v2.12.1
    container_name: self_healing_mlflow
    ports:
      - "5000:5000"
    volumes:
      - ./data/mlruns:/mlflow/mlruns
    command: >
      mlflow server
      --host 0.0.0.0
      --port 5000
      --backend-store-uri /mlflow/mlruns
      --default-artifact-root /mlflow/mlruns/artifacts
    restart: unless-stopped
    networks:
      - self_healing_net

networks:
  self_healing_net:
    driver: bridge

volumes:
  data: