File size: 3,864 Bytes
9c0b225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ═══════════════════════════════════════════════════════════
#  MAC β€” Control Node (PC1)
#  This PC runs: API server, DB, Redis, Nginx, Qdrant, SearXNG
#  Worker GPU nodes connect to this control node via enrollment tokens.
#  
#  Usage:  docker compose -f docker-compose.control-node.yml up -d
# ═══════════════════════════════════════════════════════════

services:

  # ── MAC API Server ──────────────────────────────────────
  mac:
    build: .
    container_name: mac-api
    ports:
      - "8000:8000"
    env_file: .env
    environment:
      - DATABASE_URL=postgresql+asyncpg://mac:mac_password@postgres:5432/mac_db
      - REDIS_URL=redis://redis:6379/0
      - QDRANT_URL=http://qdrant:6333
      - SEARXNG_URL=http://searxng:8080
      - IS_CONTROL_NODE=true
      - MAX_RESOURCE_PCT=85
      # vLLM URLs are dynamically resolved via node_service
      # based on enrolled worker nodes
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - mac-net

  # ── PostgreSQL ─────────────────────────────────────────
  postgres:
    image: postgres:16-alpine
    container_name: mac-postgres
    environment:
      POSTGRES_USER: mac
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mac_password}
      POSTGRES_DB: mac_db
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U mac -d mac_db"]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: unless-stopped
    networks:
      - mac-net

  # ── Redis ──────────────────────────────────────────────
  redis:
    image: redis:7-alpine
    container_name: mac-redis
    ports:
      - "6379:6379"
    volumes:
      - redisdata:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: unless-stopped
    networks:
      - mac-net

  # ── Nginx ──────────────────────────────────────────────
  nginx:
    image: nginx:alpine
    container_name: mac-nginx
    ports:
      - "80:80"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./frontend:/usr/share/nginx/html:ro
    depends_on:
      - mac
    restart: unless-stopped
    networks:
      - mac-net

  # ── Qdrant (Vector DB for RAG) ─────────────────────────
  qdrant:
    image: qdrant/qdrant:latest
    container_name: mac-qdrant
    ports:
      - "6333:6333"
    volumes:
      - qdrantdata:/qdrant/storage
    restart: unless-stopped
    networks:
      - mac-net

  # ── SearXNG (Web Search) ──────────────────────────────
  searxng:
    image: searxng/searxng:latest
    container_name: mac-searxng
    ports:
      - "8888:8080"
    environment:
      - SEARXNG_BASE_URL=http://localhost:8888/
    volumes:
      - searxngdata:/etc/searxng
    restart: unless-stopped
    networks:
      - mac-net

volumes:
  pgdata:
  redisdata:
  qdrantdata:
  searxngdata:

networks:
  mac-net:
    driver: bridge