Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
170 lines (160 loc) · 5.83 KB
/
Copy pathdocker-compose.yml
File metadata and controls
170 lines (160 loc) · 5.83 KB
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
# ─────────────────────────────────────────────
# JurisFind – Docker Compose (Production on Azure VM)
# Usage:
# docker compose up -d → start all services
# docker compose down → stop
# docker compose logs -f api → live API logs
# docker compose logs -f celery_worker → live worker logs
# docker compose pull && docker compose up -d --build → redeploy
# ─────────────────────────────────────────────
version: "3.9"
# ── Shared network ────────────────────────────────────────────────────────────
networks:
jurisfind_net:
driver: bridge
# ── Named volumes ─────────────────────────────────────────────────────────────
volumes:
confidential_tmp:
rabbitmq_data:
jurisfind_db_data:
redis_data:
qdrant_storage:
external: true
services:
# ── Qdrant Vector Database ──────────────────────────────────────────────────
qdrant:
image: qdrant/qdrant
container_name: jurisfind_qdrant
restart: always
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_storage:/qdrant/storage
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:6333/readyz"]
interval: 10s
timeout: 5s
retries: 5
networks:
- jurisfind_net
# ── PostgreSQL with pgvector ──────────────────────────────────────────────
db:
image: pgvector/pgvector:pg17
container_name: jurisfind_db
restart: always
ports:
- "5433:5432" # Exposed on 5433 to avoid conflicts with native Windows Postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: jurisfind
volumes:
- jurisfind_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- jurisfind_net
# ── Redis (Cache Layer) ─────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: jurisfind_redis
restart: always
ports:
- "6379:6379"
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
networks:
- jurisfind_net
# ── RabbitMQ (Message Broker) ─────────────────────────────────────────────
rabbitmq:
image: rabbitmq:3-management
container_name: jurisfind_rabbitmq
restart: always
ports:
- "5672:5672" # AMQP protocol (broker)
- "15672:15672" # Management UI (http://localhost:15672)
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 20s
timeout: 10s
retries: 5
start_period: 30s
networks:
- jurisfind_net
# ── FastAPI (Stateless API layer) ─────────────────────────────────────────
api:
build:
context: ./backend
dockerfile: Dockerfile
container_name: jurisfind_api
restart: always
ports:
# Only expose to localhost — Nginx proxies from port 80 to here
- "127.0.0.1:8000:8000"
env_file:
# Copy backend/.env.example → backend/.env on the VM and fill in real values
- ./backend/.env
volumes:
# Persist local FAISS index & PDFs if not using Azure Blob
- ./backend/data:/app/data
# Temp dir for confidential uploads (cleared between restarts is fine)
- confidential_tmp:/tmp/confidential_uploads
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 90s # give sentence-transformers time to load on first boot
networks:
- jurisfind_net
# ── Celery Worker (Distributed Document Processor) ────────────────────────
celery_worker:
build:
context: ./backend
dockerfile: Dockerfile
container_name: jurisfind_celery_worker
restart: always
# Override the Dockerfile CMD — run the Celery worker instead of uvicorn
command: >
celery -A workers.celery_app worker
--loglevel=info
--concurrency=2
--prefetch-multiplier=1
-P prefork
-Q jurisfind_documents
env_file:
- ./backend/.env
volumes:
- ./backend/data:/app/data
- confidential_tmp:/tmp/confidential_uploads
depends_on:
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD", "celery", "-A", "workers.celery_app", "inspect", "ping"]
interval: 30s
timeout: 15s
retries: 3
start_period: 120s # model loading takes time
networks:
- jurisfind_net