-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
201 lines (192 loc) · 5.09 KB
/
docker-compose.yml
File metadata and controls
201 lines (192 loc) · 5.09 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
version: '3.8'
# AI Backend Services Stack
# A complete backend infrastructure for AI applications
# Includes PostgreSQL with pgvector, Redis, ChromaDB, and MinIO
services:
# PostgreSQL Database with vector extensions
postgres:
image: pgvector/pgvector:pg15
container_name: ai-postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-ai_app}
POSTGRES_USER: ${POSTGRES_USER:-ai_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ai_secure_password}
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init:/docker-entrypoint-initdb.d
ports:
- "${POSTGRES_PORT:-5432}:5432"
networks:
- ai-backend
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ai_user} -d ${POSTGRES_DB:-ai_app}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
# Redis for caching and session management
redis:
image: redis:7-alpine
container_name: ai-redis
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-ai_redis_password}
volumes:
- redis_data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
networks:
- ai-backend
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# ChromaDB for vector search and embeddings
chromadb:
image: chromadb/chroma:latest
container_name: ai-chromadb
environment:
- CHROMA_SERVER_HOST=0.0.0.0
- CHROMA_SERVER_HTTP_PORT=8000
- ANONYMIZED_TELEMETRY=False
- ALLOW_RESET=True
# Authentication (optional)
- CHROMA_SERVER_AUTH_CREDENTIALS_FILE=/chroma/auth/credentials
- CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER=chromadb.auth.basic.BasicAuthCredentialsProvider
volumes:
- chromadb_data:/chroma/chroma
- ./auth:/chroma/auth:ro
ports:
- "${CHROMA_PORT:-8000}:8000"
networks:
- ai-backend
healthcheck:
test: ["CMD", "timeout", "5", "bash", "-c", "</dev/tcp/localhost/8000"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
# MinIO for object storage (S3-compatible)
minio:
image: minio/minio:latest
container_name: ai-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-ai_admin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-ai_minio_password}
volumes:
- minio_data:/data
ports:
- "${MINIO_API_PORT:-9000}:9000" # API port
- "${MINIO_CONSOLE_PORT:-9001}:9001" # Console port
networks:
- ai-backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
restart: unless-stopped
deploy:
resources:
limits:
memory: 1G
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# RabbitMQ Message Queue for MinIO notifications and event handling
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: ai-rabbitmq
hostname: rabbitmq
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-guest}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-guest}
RABBITMQ_DEFAULT_VHOST: /
volumes:
- rabbitmq_data:/var/lib/rabbitmq
- ./docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
ports:
- "${RABBITMQ_AMQP_PORT:-5672}:5672" # AMQP port
- "${RABBITMQ_MANAGEMENT_PORT:-15672}:15672" # Management UI port
networks:
- ai-backend
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 30s
timeout: 30s
retries: 3
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# Nginx reverse proxy for backend services (optional)
nginx:
image: nginx:alpine
container_name: ai-nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_HTTPS_PORT:-443}:443"
depends_on:
- postgres
- redis
- chromadb
- minio
networks:
- ai-backend
restart: unless-stopped
deploy:
resources:
limits:
memory: 128M
cpus: '0.25'
volumes:
postgres_data:
driver: local
redis_data:
driver: local
chromadb_data:
driver: local
minio_data:
driver: local
rabbitmq_data:
driver: local
networks:
ai-backend:
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/16