File size: 5,592 Bytes
939c0c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
version: "3.9"

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

  # ── Redis ─────────────────────────────────────────────────
  redis:
    image: redis:7-alpine
    container_name: copilot_redis
    command: redis-server --appendonly yes
    volumes:
      - redis_data:/data
    ports:
      - "6379:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - copilot_net

  # ── Qdrant ────────────────────────────────────────────────
  qdrant:
    image: qdrant/qdrant:v1.12.0
    container_name: copilot_qdrant
    volumes:
      - qdrant_data:/qdrant/storage
    ports:
      - "6333:6333"
      - "6334:6334"
    networks:
      - copilot_net

  # ── FastAPI Backend ────────────────────────────────────────
  backend:
    build:
      context: ..
      dockerfile: backend/Dockerfile
    container_name: copilot_backend
    env_file:
      - ../.env
    environment:
      - PYTHONPATH=/app:/agents:/services:.
      - DATABASE_URL=postgresql+asyncpg://copilot:copilot@postgres:5432/copilot_db
      - REDIS_URL=redis://redis:6379/0
      - QDRANT_URL=http://qdrant:6333
      - CELERY_BROKER_URL=redis://redis:6379/1
      - DEPLOY_MODE=local
    volumes:
      - ../backend:/app
      - ../agents:/agents
      - ../services:/services
      - ../scripts:/scripts
      - ../tests:/tests
      - uploads_data:/uploads
    ports:
      - "8000:8000"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
      qdrant:
        condition: service_started
    command: >
      sh -c "alembic upgrade head &&
             uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
    networks:
      - copilot_net

  # ── Celery Worker ──────────────────────────────────────────
  celery_worker:
    build:
      context: ..
      dockerfile: backend/Dockerfile
    container_name: copilot_celery
    env_file:
      - ../.env
    environment:
      - PYTHONPATH=/app:/agents:/services:.
      - DATABASE_URL=postgresql+asyncpg://copilot:copilot@postgres:5432/copilot_db
      - REDIS_URL=redis://redis:6379/0
      - QDRANT_URL=http://qdrant:6333
      - CELERY_BROKER_URL=redis://redis:6379/1
      - DEPLOY_MODE=local
    volumes:
      - ../backend:/app
      - ../agents:/agents
      - ../services:/services
      - uploads_data:/uploads
    command: celery -A app.core.celery_app worker --loglevel=info --concurrency=2
    depends_on:
      - redis
      - postgres
    networks:
      - copilot_net

  # ── React Frontend ─────────────────────────────────────────
  frontend:
    build:
      context: ../frontend
      dockerfile: Dockerfile
    container_name: copilot_frontend
    volumes:
      - ../frontend/src:/app/src
    ports:
      - "3000:3000"
    environment:
      - VITE_API_URL=http://localhost:8000
    networks:
      - copilot_net

  # ── Nginx Reverse Proxy ────────────────────────────────────
  nginx:
    image: nginx:alpine
    container_name: copilot_nginx
    ports:
      - "8080:80"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - backend
      - frontend
    networks:
      - copilot_net

  # ── Prometheus ────────────────────────────────────────────
  prometheus:
    image: prom/prometheus:latest
    container_name: copilot_prometheus
    volumes:
      - ../monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus_data:/prometheus
    ports:
      - "9090:9090"
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    networks:
      - copilot_net

  # ── Grafana ───────────────────────────────────────────────
  grafana:
    image: grafana/grafana:latest
    container_name: copilot_grafana
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
    volumes:
      - grafana_data:/var/lib/grafana
      - ../monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
    ports:
      - "3001:3000"
    depends_on:
      - prometheus
    networks:
      - copilot_net

volumes:
  postgres_data:
  redis_data:
  qdrant_data:
  uploads_data:
  prometheus_data:
  grafana_data:

networks:
  copilot_net:
    driver: bridge