This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
docker-compose.prod.yml
166 lines (160 loc) · 5.2 KB
/
docker-compose.prod.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
name: quack
version: '3.8'
services:
traefik:
image: traefik:v2.9.6
depends_on:
backend:
condition: service_healthy
gradio:
condition: service_healthy
grafana:
condition: service_healthy
ports:
# http(s) traffic
- "80:80"
- "443:443"
labels:
- "traefik.http.middlewares.strip-www.redirectregex.regex=^https?://(www\\.)(.+)"
- "traefik.http.middlewares.strip-www.redirectregex.replacement=https://$${2}"
- "traefik.http.middlewares.strip-www.redirectregex.permanent=true"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "$PWD/acme.json:/acme.json"
command:
# Enable the Traefik log, for configurations and errors
- "--log.level=INFO"
# Enable Docker in Traefik, so that it reads labels from Docker services
- "--providers.docker=true"
# Do not expose all Docker services, only the ones explicitly exposed
- "--providers.docker.exposedbydefault=false"
# HTTPS
- "--entryPoints.web.address=:80"
- "--entryPoints.websecure.address=:443"
# Certificate
- "--certificatesresolvers.quackresolver.acme.tlschallenge=true"
- "--certificatesresolvers.quackresolver.acme.email=${ACME_EMAIL}"
- "--certificatesresolvers.default.acme.storage=/acme.json"
restart: always
ollama:
image: ollama/ollama:0.2.1
expose:
- 11434
volumes:
- "$HOME/.ollama:/root/.ollama"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
command: serve
healthcheck:
test: ["CMD-SHELL", "ollama --help"]
interval: 10s
timeout: 5s
retries: 3
backend:
image: quackai/companion:latest
depends_on:
ollama:
condition: service_healthy
expose:
- 5050
environment:
- SUPERADMIN_GH_PAT=${SUPERADMIN_GH_PAT}
- GH_OAUTH_ID=${GH_OAUTH_ID}
- GH_OAUTH_SECRET=${GH_OAUTH_SECRET}
- POSTGRES_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
- SUPERADMIN_LOGIN=${SUPERADMIN_LOGIN}
- SUPERADMIN_PWD=${SUPERADMIN_PWD}
- JWT_SECRET=${JWT_SECRET}
- OLLAMA_ENDPOINT=http://ollama:11434
- OLLAMA_MODEL=${OLLAMA_MODEL}
- OLLAMA_TIMEOUT=${OLLAMA_TIMEOUT:-60}
- SUPPORT_EMAIL=${SUPPORT_EMAIL}
- SENTRY_DSN=${SENTRY_DSN}
- SERVER_NAME=${SERVER_NAME}
- POSTHOG_KEY=${POSTHOG_KEY}
- SLACK_API_TOKEN=${SLACK_API_TOKEN}
- SLACK_CHANNEL=${SLACK_CHANNEL}
- DEBUG=false
- PROMETHEUS_ENABLED=true
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`${BACKEND_HOST}`)"
- "traefik.http.routers.backend.entrypoints=websecure"
- "traefik.http.routers.backend.tls.certresolver=quackresolver"
- "traefik.http.services.backend.loadbalancer.server.port=5050"
command: >
sh -c "alembic upgrade head
&& python app/db.py
&& curl -X POST http://ollama:11434/api/pull -d '{\"name\": \"${OLLAMA_MODEL}\"}'
&& uvicorn app.main:app --reload --host 0.0.0.0 --port 5050 --proxy-headers"
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:5050/status"]
interval: 10s
timeout: 3s
retries: 5
gradio:
image: quackai/gradio:latest
depends_on:
backend:
condition: service_healthy
expose:
- 7860
environment:
- API_URL=http://backend:5050/api/v1
- SUPERADMIN_LOGIN=${SUPERADMIN_LOGIN}
- SUPERADMIN_PWD=${SUPERADMIN_PWD}
- POSTHOG_HOST=${POSTHOG_HOST}
- POSTHOG_KEY=${POSTHOG_KEY}
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${GRADIO_HOST}`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=quackresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=7860"
command: python main.py --server-name 0.0.0.0 --auth
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:7860"]
interval: 10s
timeout: 3s
retries: 3
prometheus:
image: quackai/prometheus:latest
depends_on:
backend:
condition: service_healthy
expose:
- 9090
command:
- "--config.file=/etc/prometheus/prometheus.yml"
healthcheck:
test: ["CMD-SHELL", "nc -vz localhost 9090"]
interval: 10s
timeout: 3s
retries: 3
grafana:
image: quackai/grafana:latest
depends_on:
prometheus:
condition: service_healthy
expose:
- 3000
environment:
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${GF_HOST}`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=quackresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
healthcheck:
test: ["CMD-SHELL", "nc -vz localhost 3000"]
interval: 10s
timeout: 3s
retries: 3