-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
313 lines (287 loc) · 8.9 KB
/
docker-compose.yml
File metadata and controls
313 lines (287 loc) · 8.9 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
services:
mongodb:
image: mongo:latest
container_name: aitoearn-mongodb
restart: unless-stopped
entrypoint: ["bash", "-c", "openssl rand -base64 756 > /data/mongodb-keyfile && chmod 400 /data/mongodb-keyfile && chown mongodb:mongodb /data/mongodb-keyfile && exec docker-entrypoint.sh mongod --replSet rs0 --keyFile /data/mongodb-keyfile"]
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- "27017:27017"
volumes:
- mongodb-data:/data/db
- mongodb-config:/data/configdb
networks:
- aitoearn-network
healthcheck:
test: mongosh --quiet --eval "try { rs.status().ok } catch(e) { 0 }"
interval: 10s
timeout: 5s
retries: 10
start_period: 40s
mongodb-rs-init:
image: mongo:latest
container_name: aitoearn-mongodb-rs-init
depends_on:
mongodb:
condition: service_started
entrypoint: ["/bin/sh", "-c", "sleep 5 && mongosh mongodb://admin:password@mongodb:27017/?authSource=admin --eval \"try { rs.initiate({_id:'rs0', members:[{_id:0, host:'mongodb:27017'}]}) } catch(e) { if (e.codeName!=='AlreadyInitialized') throw e }\""]
restart: "no"
networks:
- aitoearn-network
redis:
image: redis:latest
container_name: aitoearn-redis
restart: unless-stopped
command: redis-server --requirepass password
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- aitoearn-network
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 3s
retries: 5
start_period: 30s
rustfs:
image: rustfs/rustfs:latest
container_name: aitoearn-rustfs
hostname: rustfs.local
restart: unless-stopped
environment:
RUSTFS_ACCESS_KEY: rustfsadmin
RUSTFS_SECRET_KEY: rustfsadmin
ports:
- "9001:9001"
volumes:
- rustfs-data:/data
networks:
aitoearn-network:
aliases:
- rustfs.local
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
aitoearn-init:
image: node:lts-alpine
container_name: aitoearn-init
depends_on:
mongodb:
condition: service_healthy
volumes:
- ./scripts/init.mjs:/app/init.mjs:ro
- ./scripts/init-package.json:/app/package.json:ro
- init-data:/data/init
working_dir: /app
environment:
MONGO_URI: mongodb://admin:password@mongodb:27017
JWT_SECRET: change-this-jwt-secret
DB_NAME: aitoearn
AUTO_LOGIN_TOKEN_PATH: /data/init/token.txt
entrypoint: /bin/sh -c "npm install --omit=dev 2>/dev/null && node init.mjs"
networks:
- aitoearn-network
rustfs-init:
image: minio/mc:latest
container_name: aitoearn-rustfs-init
depends_on:
rustfs:
condition: service_healthy
networks:
- aitoearn-network
entrypoint: >
/bin/sh -c "
mc alias set rustfs http://rustfs.local:9000 rustfsadmin rustfsadmin;
mc mb rustfs/aitoearn --ignore-existing;
mc anonymous set download rustfs/aitoearn;
exit 0;
"
aitoearn-ai:
image: aitoearn/aitoearn-ai:latest
pull_policy: always
container_name: aitoearn-ai
restart: unless-stopped
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./project/aitoearn-backend/apps/aitoearn-ai/config/config.js:/app/config.js:ro
networks:
- aitoearn-network
environment:
NODE_ENV: production
APP_ENV: production
APP_NAME: aitoearn-ai
MONGODB_HOST: mongodb
MONGODB_PORT: 27017
MONGODB_USERNAME: admin
MONGODB_PASSWORD: password
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: password
JWT_SECRET: change-this-jwt-secret
INTERNAL_TOKEN: change-this-secret-token
SERVER_URL: http://aitoearn-server:3002
ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://127.0.0.1:9000","cdnEndpoint":"http://127.0.0.1:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
# AI Services
OPENAI_API_KEY: sk-placeholder
OPENAI_BASE_URL: https://api.openai.com/v1
ANTHROPIC_API_KEY: sk-placeholder
ANTHROPIC_BASE_URL: https://api.anthropic.com
VOLCENGINE_API_KEY: ""
VOLCENGINE_ACCESS_KEY_ID: ""
VOLCENGINE_SECRET_ACCESS_KEY: ""
VOLCENGINE_VOD_SPACE_NAME: ""
GROK_API_KEY: ""
GEMINI_API_KEY: ""
GEMINI_BASE_URL: ""
GEMINI_KEY_PAIRS: '[]'
GEMINI_LOCATION: us-central1
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3010/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) })"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
aitoearn-server:
image: aitoearn/aitoearn-server:latest
pull_policy: always
container_name: aitoearn-server
restart: unless-stopped
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
aitoearn-ai:
condition: service_healthy
volumes:
- ./project/aitoearn-backend/apps/aitoearn-server/config/config.js:/app/config.js:ro
networks:
- aitoearn-network
environment:
NODE_ENV: production
APP_ENV: production
APP_NAME: aitoearn-server
APP_DOMAIN: localhost
MONGODB_HOST: mongodb
MONGODB_PORT: 27017
MONGODB_USERNAME: admin
MONGODB_PASSWORD: password
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: password
AI_URL: http://aitoearn-ai:3010
JWT_SECRET: change-this-jwt-secret
INTERNAL_TOKEN: change-this-secret-token
ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://127.0.0.1:9000","cdnEndpoint":"http://127.0.0.1:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
MAIL_USER: ""
MAIL_PASS: ""
# Third-party OAuth
BILIBILI_CLIENT_ID: ""
BILIBILI_CLIENT_SECRET: ""
GOOGLE_CLIENT_ID: ""
GOOGLE_CLIENT_SECRET: ""
KWAI_CLIENT_ID: ""
KWAI_CLIENT_SECRET: ""
PINTEREST_CLIENT_ID: ""
PINTEREST_CLIENT_SECRET: ""
TIKTOK_CLIENT_ID: ""
TIKTOK_CLIENT_SECRET: ""
TWITTER_CLIENT_ID: ""
TWITTER_CLIENT_SECRET: ""
FACEBOOK_CLIENT_ID: ""
FACEBOOK_CLIENT_SECRET: ""
FACEBOOK_CONFIG_ID: ""
THREADS_CLIENT_ID: ""
THREADS_CLIENT_SECRET: ""
INSTAGRAM_CLIENT_ID: ""
INSTAGRAM_CLIENT_SECRET: ""
LINKEDIN_CLIENT_ID: ""
LINKEDIN_CLIENT_SECRET: ""
YOUTUBE_CLIENT_ID: ""
YOUTUBE_CLIENT_SECRET: ""
WXPLAT_APP_ID: ""
WXPLAT_APP_SECRET: ""
WXPLAT_ENCODING_AES_KEY: ""
DOYIN_CLIENT_ID: ""
DOYIN_CLIENT_SECRET: ""
# Aliyun SMS
ALI_SMS_ACCESS_KEY_ID: ""
ALI_SMS_ACCESS_KEY_SECRET: ""
ALI_SMS_SIGN_NAME: ""
ALI_SMS_TEMPLATE_CODE: ""
# Relay (optional)
RELAY_SERVER_URL: https://aitoearn.ai/api
RELAY_API_KEY: ""
RELAY_CALLBACK_URL: http://127.0.0.1:8080/api/plat/relay-callback
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3002/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) })"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
aitoearn-web:
image: aitoearn/aitoearn-web:latest
pull_policy: always
container_name: aitoearn-web
restart: unless-stopped
depends_on:
aitoearn-server:
condition: service_healthy
volumes:
- init-data:/data/init:ro
networks:
- aitoearn-network
command: ["/bin/sh", "-c", "AUTO_LOGIN_TOKEN=$$(cat /data/init/token.txt 2>/dev/null || echo '') exec node server.js"]
environment:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: 1
nginx:
image: nginx:alpine
container_name: aitoearn-nginx
restart: unless-stopped
depends_on:
aitoearn-web:
condition: service_started
aitoearn-server:
condition: service_healthy
aitoearn-ai:
condition: service_healthy
ports:
- "8080:80"
- "9000:9000"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
networks:
- aitoearn-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1/_nhealth"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
networks:
aitoearn-network:
driver: bridge
name: aitoearn-network
volumes:
mongodb-data:
driver: local
mongodb-config:
driver: local
redis-data:
driver: local
rustfs-data:
driver: local
init-data:
driver: local