-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
166 lines (159 loc) · 5.06 KB
/
docker-compose.yml
File metadata and controls
166 lines (159 loc) · 5.06 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
x-bigrag-env: &bigrag-env
BIGRAG_ENV: "${BIGRAG_ENV:-dev}"
BIGRAG_DATABASE_URL: "postgres://${POSTGRES_USER:-bigrag}:${POSTGRES_PASSWORD:-bigrag}@postgres:5432/${POSTGRES_DB:-bigrag}?sslmode=disable"
BIGRAG_REDIS_URL: "${BIGRAG_REDIS_URL:-redis://redis:6379/0}"
BIGRAG_CACHE_REDIS_URL: "${BIGRAG_CACHE_REDIS_URL:-redis://redis-cache:6379/0}"
BIGRAG_MASTER_KEY: "${BIGRAG_MASTER_KEY:-}"
BIGRAG_MASTER_KEY_PREVIOUS: '${BIGRAG_MASTER_KEY_PREVIOUS:-[]}'
BIGRAG_SESSION_COOKIE_SECURE: "${BIGRAG_SESSION_COOKIE_SECURE:-false}"
BIGRAG_SESSION_COOKIE_SAMESITE: "${BIGRAG_SESSION_COOKIE_SAMESITE:-lax}"
BIGRAG_SESSION_COOKIE_DOMAIN: "${BIGRAG_SESSION_COOKIE_DOMAIN:-}"
BIGRAG_CORS_ORIGINS: '${BIGRAG_CORS_ORIGINS:-["http://localhost:3000"]}'
BIGRAG_TRUSTED_PROXIES: '${BIGRAG_TRUSTED_PROXIES:-[]}'
BIGRAG_LOG_LEVEL: "${BIGRAG_LOG_LEVEL:-info}"
BIGRAG_LOG_FORMAT: "${BIGRAG_LOG_FORMAT:-text}"
BIGRAG_UPLOAD_DIR: /data/uploads
services:
bigrag-api:
image: "${BIGRAG_API_IMAGE:-bigrag-api:local}"
build: ./api
container_name: bigrag-api
restart: unless-stopped
ports:
- "127.0.0.1:4000:4000"
volumes:
- bigrag_data:/data
environment:
<<: *bigrag-env
BIGRAG_HOST: 0.0.0.0
BIGRAG_ALLOW_PUBLIC_BIND_IN_PROD: "${BIGRAG_ALLOW_PUBLIC_BIND_IN_PROD:-false}"
deploy:
resources:
limits:
memory: 4g
cpus: "4"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
redis-cache:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
interval: 30s
timeout: 10s
retries: 3
bigrag-worker:
image: "${BIGRAG_API_IMAGE:-bigrag-api:local}"
container_name: bigrag-worker
restart: unless-stopped
command: ["bigrag-worker", "--processes", "${BIGRAG_WORKER_PROCESSES:-5}", "--threads", "${BIGRAG_WORKER_THREADS:-8}"]
volumes:
- bigrag_data:/data
environment:
<<: *bigrag-env
BIGRAG_WORKER_HEALTHCHECK_KEY: "${BIGRAG_WORKER_HEALTHCHECK_KEY:-bigrag:dramatiq:worker:heartbeat}"
deploy:
resources:
limits:
memory: 4g
cpus: "4"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
redis-cache:
condition: service_healthy
healthcheck:
test:
[
"CMD-SHELL",
"python -c 'import os, sys, redis; client = redis.Redis.from_url(os.environ.get(\"BIGRAG_REDIS_URL\", \"redis://redis:6379/0\")); key = os.environ.get(\"BIGRAG_WORKER_HEALTHCHECK_KEY\", \"bigrag:dramatiq:worker:heartbeat\"); sys.exit(0 if client.ttl(key) > 0 else 1)'",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
bigrag-ui:
image: "${BIGRAG_UI_IMAGE:-bigrag-ui:local}"
build:
context: .
dockerfile: app/Dockerfile
container_name: bigrag-ui
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
environment:
BIGRAG_URL: "${BIGRAG_UI_API_URL:-http://localhost:4000}"
depends_on:
bigrag-api:
condition: service_healthy
postgres:
image: postgres:17
container_name: bigrag-postgres
restart: unless-stopped
ports:
- "127.0.0.1:5432:5432"
environment:
POSTGRES_USER: "${POSTGRES_USER:-bigrag}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-bigrag}"
POSTGRES_DB: "${POSTGRES_DB:-bigrag}"
volumes:
- postgres_data:/var/lib/postgresql/data
command: postgres -c max_connections=200 -c shared_buffers=256MB -c work_mem=8MB -c effective_cache_size=768MB
deploy:
resources:
limits:
memory: 1g
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bigrag}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: bigrag-redis
restart: unless-stopped
ports:
- "127.0.0.1:6379:6379"
environment:
REDIS_PASSWORD: "${REDIS_PASSWORD:-}"
volumes:
- redis_data:/data
command:
- sh
- -c
- |
if [ -n "$$REDIS_PASSWORD" ]; then
exec redis-server --appendonly yes --maxmemory 1gb --maxmemory-policy noeviction --requirepass "$$REDIS_PASSWORD"
fi
exec redis-server --appendonly yes --maxmemory 1gb --maxmemory-policy noeviction
deploy:
resources:
limits:
memory: 1536m
healthcheck:
test: ["CMD-SHELL", "if [ -n \"$${REDIS_PASSWORD}\" ]; then redis-cli -a \"$${REDIS_PASSWORD}\" --no-auth-warning ping; else redis-cli ping; fi"]
interval: 10s
timeout: 5s
retries: 5
redis-cache:
image: redis:7-alpine
container_name: bigrag-redis-cache
restart: unless-stopped
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru --save ""
deploy:
resources:
limits:
memory: 640m
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
bigrag_data:
postgres_data:
redis_data: