File size: 5,285 Bytes
6e8d20e
 
 
8a841b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e8d20e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a841b2
6e8d20e
 
 
 
 
 
 
8a841b2
 
 
 
 
6e8d20e
 
 
 
 
 
8a841b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e8d20e
 
 
 
8a841b2
 
6e8d20e
 
 
 
 
 
 
 
8a841b2
6e8d20e
 
 
 
 
 
 
8a841b2
 
 
6e8d20e
 
 
 
 
 
8a841b2
6e8d20e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a841b2
6e8d20e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a841b2
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
version: '3.8'

services:
  # ── InferRoute Gateway ──────────────────────────────────────────────────────
  gateway:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: inferroute-gateway
    ports:
      - "8080:8080"
    environment:
      - ENV=development
      - DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/inferroute
      - REDIS_URL=redis://redis:6379/0
      - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
      - MOCK_VLLM=true
      - MOCK_GEMINI=true
      - MOCK_OLLAMA=true
    env_file:
      - .env
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/healthz')"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
    restart: unless-stopped

  # ── PostgreSQL ──────────────────────────────────────────────────────────────
  postgres:
    image: postgres:16-alpine
    container_name: inferroute-postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: inferroute
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

  # ── Redis ───────────────────────────────────────────────────────────────────
  redis:
    image: redis:7-alpine
    container_name: inferroute-redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    command: >
      redis-server
      --maxmemory 512mb
      --maxmemory-policy allkeys-lru
      --save ""
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 5s
      retries: 5

  # ── Local Ollama (optional β€” comment out if not using local models) ─────────
  ollama:
    image: ollama/ollama:latest
    container_name: inferroute-ollama
    ports:
      - "11434:11434"
    volumes:
      - ollama_data:/root/.ollama
    # Uncomment for GPU support:
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: all
    #           capabilities: [gpu]
    profiles:
      - local-llm  # start with: docker compose --profile local-llm up

  # ── Jaeger (distributed tracing) ────────────────────────────────────────────
  jaeger:
    image: jaegertracing/all-in-one:1.57
    container_name: inferroute-jaeger
    ports:
      - "16686:16686"  # UI
      - "4317:4317"    # OTLP gRPC
    environment:
      - COLLECTOR_OTLP_ENABLED=true
    healthcheck:
      test: ["CMD", "wget", "--spider", "http://localhost:16686"]
      interval: 5s
      timeout: 5s
      retries: 5

  # ── OpenTelemetry Collector ──────────────────────────────────────────────────
  otel-collector:
    image: otel/opentelemetry-collector-contrib:0.102.0
    container_name: inferroute-otel-collector
    command: ["--config=/etc/otel-collector-config.yaml"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
    ports:
      - "4318:4318"  # OTLP HTTP
      - "8888:8888"  # Internal metrics
      - "9464:9464"  # Prometheus exporter
    depends_on:
      jaeger:
        condition: service_healthy
    extra_hosts:
      - "host.docker.internal:host-gateway"

  # ── Prometheus ───────────────────────────────────────────────────────────────
  prometheus:
    image: prom/prometheus:v2.52.0
    container_name: inferroute-prometheus
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
    ports:
      - "9090:9090"
    depends_on:
      - otel-collector
    extra_hosts:
      - "host.docker.internal:host-gateway"

  # ── Grafana ───────────────────────────────────────────────────────────────────
  grafana:
    image: grafana/grafana:11.0.0
    container_name: inferroute-grafana
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
    volumes:
      - grafana_data:/var/lib/grafana
    depends_on:
      - prometheus

volumes:
  postgres_data:
  redis_data:
  prometheus_data:
  grafana_data:
  ollama_data: