forked from trycompai/crm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
209 lines (198 loc) · 6.31 KB
/
Copy pathdocker-compose.yml
File metadata and controls
209 lines (198 loc) · 6.31 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
202
203
204
205
206
207
208
209
x-crm-image: &crm-image
image: northgraindata-crm:${SOURCE_COMMIT:-release}
build:
context: .
dockerfile: Dockerfile
args:
API_URL: http://api:3001
PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:3001}
AGENT_URL: http://agent:2000
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:3001}
x-crm-environment: &crm-environment
NODE_ENV: production
DATABASE_URL: postgresql://crm:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/crm?schema=public
REDIS_URL: redis://:${SERVICE_PASSWORD_REDIS}@redis:6379
AGENT_URL: http://agent:2000
APP_URL: ${SERVICE_URL_WEB}
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:?Set a random secret of at least 32 characters}
ALLOWED_SIGN_IN: ${ALLOWED_SIGN_IN:?Set an allowed email address or domain}
AGENT_BRIDGE_SECRET: ${SERVICE_REALBASE64_64_AGENT}
CRON_SECRET: ${SERVICE_PASSWORD_64_CRON}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:?Create a key at openrouter.ai/settings/keys}
STORAGE_ENDPOINT: http://minio:9000
STORAGE_REGION: us-east-1
STORAGE_BUCKET: crm
STORAGE_ACCESS_KEY_ID: crm
STORAGE_SECRET_ACCESS_KEY: ${SERVICE_PASSWORD_64_MINIO}
STORAGE_PUBLIC_URL: ${SERVICE_URL_WEB}/media
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
MICROSOFT_CLIENT_ID: ${MICROSOFT_CLIENT_ID:-}
MICROSOFT_CLIENT_SECRET: ${MICROSOFT_CLIENT_SECRET:-}
ZOHO_CLIENT_ID: ${ZOHO_CLIENT_ID:-}
ZOHO_CLIENT_SECRET: ${ZOHO_CLIENT_SECRET:-}
ZOHO_ACCOUNTS_URL: ${ZOHO_ACCOUNTS_URL:-https://accounts.zoho.eu}
ZOHO_MAIL_URL: ${ZOHO_MAIL_URL:-https://mail.zoho.eu}
MICROSOFT_TENANT_ID: ${MICROSOFT_TENANT_ID:-common}
RAPIDAPI_KEY: ${RAPIDAPI_KEY:-}
LINKDAPI_API_KEY: ${LINKDAPI_API_KEY:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
IS_MARKETING: ${IS_MARKETING:-false}
CRM_TELEMETRY_DISABLED: ${CRM_TELEMETRY_DISABLED:-1}
RESEND_API_KEY: ${RESEND_API_KEY:-}
RESEND_FROM_EMAIL: ${RESEND_FROM_EMAIL:-}
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: crm
POSTGRES_PASSWORD: ${SERVICE_PASSWORD_POSTGRES}
POSTGRES_DB: crm
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U crm -d crm"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
redis:
image: redis:8-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${SERVICE_PASSWORD_REDIS}"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD-SHELL", "REDISCLI_AUTH='${SERVICE_PASSWORD_REDIS}' redis-cli ping | grep PONG"]
interval: 10s
timeout: 5s
retries: 10
start_period: 5s
minio:
image: minio/minio:RELEASE.2024-11-07T00-52-20Z
restart: unless-stopped
environment:
MINIO_ROOT_USER: crm
MINIO_ROOT_PASSWORD: ${SERVICE_PASSWORD_64_MINIO}
command: ["server", "/data", "--address", ":9000", "--console-address", ":9001"]
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
minio-init:
image: minio/mc:RELEASE.2024-11-21T17-21-54Z
restart: "no"
environment:
MINIO_ROOT_PASSWORD: ${SERVICE_PASSWORD_64_MINIO}
entrypoint: ["/bin/sh", "-c"]
command:
- |
mc alias set local http://minio:9000 crm "$$MINIO_ROOT_PASSWORD"
mc mb --ignore-existing local/crm
depends_on:
minio:
condition: service_healthy
migrate:
<<: *crm-image
restart: "no"
exclude_from_hc: true
environment:
<<: *crm-environment
command: ["bun", "run", "db:deploy"]
depends_on:
postgres:
condition: service_healthy
api:
<<: *crm-image
restart: unless-stopped
environment:
<<: *crm-environment
API_URL: ${SERVICE_URL_WEB}
PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:3001}
PORT: "3001"
command: ["bun", "run", "--cwd", "apps/api", "start:prod"]
depends_on:
migrate:
condition: service_completed_successfully
minio-init:
condition: service_completed_successfully
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3001/health"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
agent:
<<: *crm-image
restart: unless-stopped
environment:
<<: *crm-environment
AGENT_PORT: "2000"
command: ["bun", "run", "--cwd", "apps/agent", "start"]
depends_on:
migrate:
condition: service_completed_successfully
minio-init:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:2000/eve/v1/info"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
web:
<<: *crm-image
restart: unless-stopped
environment:
<<: *crm-environment
API_URL: http://api:3001
PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:3001}
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:3001}
PORT: "3000"
HOSTNAME: 0.0.0.0
command: ["bun", "run", "--cwd", "apps/app", "start"]
depends_on:
api:
condition: service_healthy
agent:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3000/sign-in"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
cron:
image: curlimages/curl:8.16.0
restart: unless-stopped
exclude_from_hc: true
environment:
CRON_SECRET: ${SERVICE_PASSWORD_64_CRON}
entrypoint: ["/bin/sh", "-c"]
command:
- |
ticks=288
while true; do
curl -fsS -X POST -H "Authorization: Bearer $$CRON_SECRET" http://api:3001/internal/sync/mailboxes || true
curl -fsS -X POST -H "Authorization: Bearer $$CRON_SECRET" http://api:3001/internal/reminders/team-members || true
if [ "$$ticks" -ge 288 ]; then
curl -fsS -X POST -H "Authorization: Bearer $$CRON_SECRET" http://api:3001/internal/sync/rates || true
ticks=0
fi
ticks=$$((ticks + 1))
sleep 300
done
depends_on:
api:
condition: service_healthy
volumes:
postgres-data:
redis-data:
minio-data: