-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
196 lines (180 loc) · 5.48 KB
/
docker-compose.yml
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
version: "3.9"
services:
monorepo:
build:
context: ./.devcontainer
dockerfile: Dockerfile
args:
VARIANT: 20
volumes:
- .:/workspace:cached
command: sleep infinity
expose: ["3000"]
profiles:
- dev
flask:
build:
context: ./backend
dockerfile: Dockerfile
args:
- SSL_CERTFILE
- SSL_KEYFILE
restart: unless-stopped
volumes:
- ./backend:/flask_app:rw
- /etc/letsencrypt:/etc/letsencrypt:ro
ports:
- ${FLASK_PORT:-3001}:${FLASK_PORT:-3001}
healthcheck:
interval: 10s
timeout: 10s
retries: 5
environment:
- TZ=${TZ:-UTC}
- DEPLOYMENT_TYPE=production
- FLASK_ENV=${FLASK_ENV:-production}
- FLASK_DEBUG=${FLASK_DEBUG:-0}
- ADMIN_AUTH_TOKEN=${FLASK_ADMIN_AUTH_TOKEN}
- SECRET_KEY=${FLASK_SECRET_KEY}
- DB_URI=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres
- REDIS_URL=redis://cache:6379
- OPENAI_API_KEY=${OPENAI_API_KEY}
- PUBLIC_URL=${FLASK_PUBLIC_URL} # Websocket connection attempts sends back this to the client so that it can establish the connection to the socketio server.
command: /bin/sh -c "env && gunicorn --reload --keyfile=${SSL_KEYFILE} --certfile=${SSL_CERTFILE} --worker-class=eventlet --workers=1 --worker-connections=1000 --timeout 30 -b 0.0.0.0:${FLASK_PORT:-3001} run:app"
depends_on:
- cache
- postgres
- chromadb
profiles:
- dev
- production
celery-worker:
build:
context: ./backend
dockerfile: Dockerfile
args:
- SSL_CERTFILE
- SSL_KEYFILE
restart: unless-stopped
command: sh -c "watchmedo auto-restart --directory=./app/utils --pattern=*.py --recursive -- celery -A run:celery worker -n celery@host --loglevel=info"
environment:
- TZ=${TZ:-UTC}
- DB_URI=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres
- REDIS_URL=redis://cache:6379
- OPENAI_API_KEY=${OPENAI_API_KEY}
volumes:
- ./backend:/flask_app:rw
- /etc/letsencrypt:/etc/letsencrypt:ro
depends_on:
- cache
- postgres
- chromadb
profiles:
- dev
- production
# celery-beat: # Likely not needed..
# build:
# context: ./backend
# dockerfile: Dockerfile
# args:
# - SSL_CERTFILE
# - SSL_KEYFILE
# restart: unless-stopped
# command: sh -c "watchmedo auto-restart --directory=./app/utils --pattern=*.py --recursive -- celery -A run:celery beat -n celery@host --loglevel=info"
# environment:
# - TZ=${TZ:-UTC}
# - DB_URI=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres
# - REDIS_URL=redis://cache:6379
# volumes:
# - ./backend:/flask_app:rw
# - /etc/letsencrypt:/etc/letsencrypt:ro
# depends_on:
# - cache
# - postgres
# - chromadb
cache:
image: redis:7
restart: unless-stopped
expose: ["6379"]
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 1s
timeout: 3s
retries: 5
profiles:
- dev
- production
postgres:
image: postgres:16.3-alpine3.19
restart: unless-stopped
environment:
- TZ=${TZ:-UTC}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# - POSTGRES_USER=${POSTGRES_USER:-postgres} # Not needed - default user is 'postgres' with above password.
# - POSTGRES_DB=${POSTGRES_DB:-postgres} # Not needed - default database name is 'postgres'.
expose: ["5432"]
volumes:
- postgres_volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -d postgres -U postgres"]
interval: 10s
timeout: 5s
retries: 5
profiles:
- dev
- production
chromadb:
image: chromadb/chroma:0.5.0
restart: unless-stopped
command: "--workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30"
environment:
- TZ=${TZ:-UTC}
- IS_PERSISTENT=TRUE
- PERSIST_DIRECTORY=/chroma/chroma
- ALLOW_RESET=FALSE # Better to delete docker volume instead..
expose: ["8000"]
volumes:
- chromadb_volume:/chroma/chroma
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat" ]
interval: 30s
timeout: 10s
retries: 3
profiles:
- dev
- production
dbgate: # Tool for inspecting dbs.
image: dbgate/dbgate
restart: unless-stopped
ports:
- ${DBGATE_PORT:-3002}:3000
volumes:
- chromadb_volume:/chroma/chroma # Adds access to the chroma db sqlite file
environment:
TZ: ${TZ:-UTC}
LOGINS: administrator
LOGIN_PASSWORD_administrator: ${DBGATE_LOGIN_PASSWORD:-iVVstTvRS8CDHRS3}
CONNECTIONS: postgres,chromadb,cache
LABEL_postgres: Postgres
URL_postgres: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres
ENGINE_postgres: postgres@dbgate-plugin-postgres
LABEL_chromadb: SQLite
FILE_chromadb: /chroma/chroma/chroma.sqlite3
ENGINE_chromadb: sqlite@dbgate-plugin-sqlite
LABEL_cache: Redis
URL_cache: redis://cache:6379
ENGINE_cache: redis@dbgate-plugin-redis
profiles:
- dev
- production
# ollama:
# image: 'ollama/ollama:latest'
# restart: unless-stopped
# volumes:
# - ollama_volume:/root/.ollama
# pull_policy: always
# tty: true
volumes:
postgres_volume:
chromadb_volume:
# ollama_volume: