-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.production.yml
407 lines (381 loc) · 13.5 KB
/
docker-compose.production.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
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
version: '2'
services:
nginx:
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- "./volumes/nginx/nginx.conf:/etc/nginx/nginx.conf:ro"
- "./volumes/nginx/sites-enabled:/etc/nginx/sites-enabled:ro"
- "./volumes/nginx/include:/etc/nginx/include:ro"
- "/var/www/cofacts:/var/www/cofacts:ro"
- "/etc/letsencrypt:/etc/letsencrypt:ro"
- "/etc/ssl/certs:/etc/ssl/certs:ro"
- "/var/log:/var/log"
restart: always
cloudflared:
image: cloudflare/cloudflared
restart: unless-stopped
command: tunnel run
environment:
- TUNNEL_TOKEN=CHANGE_ME
site-en:
image: cofacts/rumors-site:latest-en
environment:
- PORT=3000
- NODE_ENV=production
- SERVER_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_ENV=production
- PUBLIC_API_URL=https://api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://collab.cofacts.tw
- PUBLIC_GTM_ID=GTM-NJXHKTH
- PUBLIC_GA_TRACKING_ID=
- SERVER_STACKIMPACT_AGENT_KEY=
- SERVER_STACKIMPACT_APP_NAME=
- PM2_PUBLIC_KEY=
- PM2_SECRET_KEY=
- WEB_CONCURRENCY=1
- PUBLIC_LINE_IFTTT_APPLET_URL=https://ifttt.com/applets/VrzvihCR-cofacts-rss-line
- PUBLIC_TELEGRAM_IFTTT_APPLET_URL=https://ifttt.com/applets/WRuZeP36-cofacts-rss-telegram
- PUBLIC_SLACK_IFTTT_APPLET_URL=https://ifttt.com/applets/H4Sm5LDF-cofacts-rss-slack
restart: always
site-zh:
image: cofacts/rumors-site:latest-tw
environment:
- PORT=3000
- NODE_ENV=production
- SERVER_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_ENV=production
- PUBLIC_API_URL=https://api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://collab.cofacts.tw
- PUBLIC_GTM_ID=GTM-NJXHKTH
- PUBLIC_GA_TRACKING_ID=
- SERVER_STACKIMPACT_AGENT_KEY=
- SERVER_STACKIMPACT_APP_NAME=
- PM2_PUBLIC_KEY=
- PM2_SECRET_KEY=
- WEB_CONCURRENCY=2
- PUBLIC_LINE_IFTTT_APPLET_URL=https://ifttt.com/applets/VrzvihCR-cofacts-rss-line
- PUBLIC_TELEGRAM_IFTTT_APPLET_URL=https://ifttt.com/applets/WRuZeP36-cofacts-rss-telegram
- PUBLIC_SLACK_IFTTT_APPLET_URL=https://ifttt.com/applets/H4Sm5LDF-cofacts-rss-slack
restart: always
site-ja:
image: cofacts/rumors-site:latest-ja
environment:
- PORT=3000
- NODE_ENV=production
- SERVER_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_TOKEN=CHANGE_ME
- PUBLIC_ROLLBAR_ENV=production
- PUBLIC_API_URL=https://api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://collab.cofacts.tw
- PUBLIC_GTM_ID=GTM-NJXHKTH
- PUBLIC_GA_TRACKING_ID=
- SERVER_STACKIMPACT_AGENT_KEY=
- SERVER_STACKIMPACT_APP_NAME=
- PM2_PUBLIC_KEY=
- PM2_SECRET_KEY=
- WEB_CONCURRENCY=1
- PUBLIC_LINE_IFTTT_APPLET_URL=https://ifttt.com/applets/VrzvihCR-cofacts-rss-line
- PUBLIC_TELEGRAM_IFTTT_APPLET_URL=https://ifttt.com/applets/WRuZeP36-cofacts-rss-telegram
- PUBLIC_SLACK_IFTTT_APPLET_URL=https://ifttt.com/applets/H4Sm5LDF-cofacts-rss-slack
restart: always
site-staging-en:
image: cofacts/rumors-site:latest-en
environment:
- PORT=3000
- ROLLBAR_SERVER_TOKEN=CHANGE_ME
- ROLLBAR_ENV=staging
- NODE_ENV=production
- PUBLIC_API_URL=https://dev-api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://dev-collab.cofacts.tw
- PUBLIC_APP_ID=RUMORS_SITE
- PUBLIC_GA_TRACKING_ID=
restart: always
site-staging-zh:
image: cofacts/rumors-site:latest-tw
environment:
- PORT=3000
- ROLLBAR_SERVER_TOKEN=CHANGE_ME
- ROLLBAR_ENV=staging
- NODE_ENV=production
- PUBLIC_API_URL=https://dev-api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://dev-collab.cofacts.tw
- PUBLIC_APP_ID=RUMORS_SITE
- PUBLIC_GA_TRACKING_ID=
restart: always
site-staging-ja:
image: cofacts/rumors-site:latest-ja
environment:
- PORT=3000
- ROLLBAR_SERVER_TOKEN=CHANGE_ME
- ROLLBAR_ENV=staging
- NODE_ENV=production
- PUBLIC_API_URL=https://dev-api.cofacts.tw
- PUBLIC_COLLAB_SERVER_URL=wss://dev-collab.cofacts.tw
- PUBLIC_APP_ID=RUMORS_SITE
- PUBLIC_GA_TRACKING_ID=
restart: always
line-bot-zh:
image: cofacts/rumors-line-bot:latest-tw
depends_on:
- api
- redis
logging:
# Sends all LINE bont logs to AWS Cloudwatch logs. For credential setup, please see:
# https://wdullaer.com/blog/2016/02/28/pass-credentials-to-the-awslogs-docker-logging-driver-on-ubuntu/
driver: gcplogs
options:
gcp-meta-id: <Meta ID>
gcp-project: <GCP project>
env_file:
- ./env-files/line-bot-zh
volumes:
- "./volumes/line-bot:/data"
line-bot-en:
image: cofacts/rumors-line-bot:latest-en
depends_on:
- api
- redis
logging:
# Sends all LINE bont logs to AWS Cloudwatch logs. For credential setup, please see:
# https://wdullaer.com/blog/2016/02/28/pass-credentials-to-the-awslogs-docker-logging-driver-on-ubuntu/
driver: gcplogs
options:
gcp-meta-id: <Meta ID>
gcp-project: <GCP project>
env_file:
- ./env-files/line-bot-zh
environment: # override line-bot-zh
- LINE_CHANNEL_SECRET=
- LINE_CHANNEL_TOKEN=
- LINE_LOGIN_CHANNEL_ID=
- LIFF_URL=
- SITE_URLS=https://en.cofacts.tw
- RUMORS_LINE_BOT_URL=
line-bot-ja:
image: cofacts/rumors-line-bot:latest-ja
depends_on:
- api
- redis
logging:
# Sends all LINE bont logs to AWS Cloudwatch logs. For credential setup, please see:
# https://wdullaer.com/blog/2016/02/28/pass-credentials-to-the-awslogs-docker-logging-driver-on-ubuntu/
driver: gcplogs
options:
gcp-meta-id: <Meta ID>
gcp-project: <GCP project>
env_file:
- ./env-files/line-bot-zh
environment: # override line-bot-zh
- LINE_CHANNEL_SECRET=
- LINE_CHANNEL_TOKEN=
- LINE_LOGIN_CHANNEL_ID=
- LIFF_URL=
- SITE_URLS=https://ja.cofacts.tw
- RUMORS_LINE_BOT_URL=
api:
image: cofacts/rumors-api
environment:
- ELASTICSEARCH_URL=http://db:9200
- ELASTIC_LOG_LEVEL=info
- PORT=5000
- ADM_PORT=5500
- CLOUDFLARE_ACCESS_TEAM_DOMAIN=https://cofacts.cloudflareaccess.com
- COOKIE_SECRETS=
- ROLLBAR_TOKEN=CHANGE_ME
- ROLLBAR_ENV=production
- HTTP_HEADER_APP_ID=x-app-id
- HTTP_HEADER_APP_SECRET=x-app-secret
- RUMORS_SITE_CORS_ORIGIN=https://cofacts.tw,https://en.cofacts.tw,https://ja.cofacts.tw
- RUMORS_SITE_REDIRECT_ORIGIN=https://cofacts.tw,https://en.cofacts.tw
- RUMORS_LINE_BOT_CORS_ORIGIN=https://rumors-line-bot.herokuapp.com
- RUMORS_LINE_BOT_SECRET=CHANGE_ME
- FACEBOOK_APP_ID=CHANGE_ME
- FACEBOOK_SECRET=CHANGE_ME
- FACEBOOK_CALLBACK_URL=https://api.cofacts.tw/callback/facebook
- TWITTER_CONSUMER_KEY=CHANGE_ME
- TWITTER_CONSUMER_SECRET=CHANGE_ME
- TWITTER_CALLBACK_URL=https://api.cofacts.tw/callback/twitter
- GITHUB_CLIENT_ID=CHANGE_ME
- GITHUB_SECRET=CHANGE_ME
- GITHUB_CALLBACK_URL=https://api.cofacts.tw/callback/github
- GOOGLE_CLIENT_ID=CHANGE_ME
- GOOGLE_SECRET=CHANGE_ME
- GOOGLE_CALLBACK_URL=https://api.cofacts.tw/callback/google
- INSTAGRAM_CLIENT_ID=CHANGE_ME
- INSTAGRAM_SECRET=CHANGE_ME
- INSTAGRAM_CALLBACK_URL=https://api.cofacts.tw/callback/instagram
- URL_RESOLVER_URL=url-resolver:4000
- GOOGLE_OAUTH_KEY_PATH=/data/service-account-key.json
- GA_WEB_VIEW_ID=CHANGE_ME
- GA_LINE_VIEW_ID=CHANGE_ME
- TIMEZONE=+08:00
- TRUST_PROXY_HEADERS=1
- COOKIE_SAMESITE_NONE=1
# Apollo engine
- ENGINE_API_KEY=CHANGE_ME
- GCS_CREDENTIALS=
- GCS_BUCKET_NAME=
- GCS_IMAGE_FOLDER=
- INTERNET_ARCHIVE_S3_ACCESS_KEY=
- INTERNET_ARCHIVE_S3_SECRET_KEY=
volumes:
- "./volumes/api:/data"
restart: always
api-staging:
image: cofacts/rumors-api
environment:
- ELASTICSEARCH_URL=http://db-staging:9200
- ELASTIC_LOG_LEVEL=info
- PORT=5000
- ADM_PORT=6000
- COOKIE_SECRETS=
- ROLLBAR_TOKEN=CHANGE_ME
- ROLLBAR_ENV=staging
- HTTP_HEADER_APP_ID=x-app-id
- HTTP_HEADER_APP_SECRET=x-app-secret
- RUMORS_SITE_CORS_ORIGIN=https://dev.cofacts.tw,https://dev-en.cofacts.tw,http://localhost:3000
- RUMORS_SITE_REDIRECT_ORIGIN=https://dev.cofacts.tw,https://dev-en.cofacts.tw,http://localhost:3000
- RUMORS_LINE_BOT_CORS_ORIGIN=https://rumors-line-bot-staging.herokuapp.com,http://localhost:5001
- RUMORS_LINE_BOT_SECRET=CHANGE_ME
- FACEBOOK_APP_ID=CHANGE_ME
- FACEBOOK_SECRET=CHANGE_ME
- FACEBOOK_CALLBACK_URL=https://dev-api.cofacts.tw/callback/facebook
- TWITTER_CONSUMER_KEY=CHANGE_ME
- TWITTER_CONSUMER_SECRET=CHANGE_ME
- TWITTER_CALLBACK_URL=https://dev-api.cofacts.tw/callback/twitter
- GITHUB_CLIENT_ID=CHANGE_ME
- GITHUB_SECRET=CHANGE_ME
- GITHUB_CALLBACK_URL=https://dev-api.cofacts.tw/callback/github
- GOOGLE_CLIENT_ID=CHANGE_ME
- GOOGLE_SECRET=CHANGE_ME
- GOOGLE_CALLBACK_URL=https://dev-api.cofacts.tw/callback/google
- INSTAGRAM_CLIENT_ID=CHANGE_ME
- INSTAGRAM_SECRET=CHANGE_ME
- INSTAGRAM_CALLBACK_URL=https://dev-api.cofacts.tw/callback/instagram
- URL_RESOLVER_URL=url-resolver:4000
- GOOGLE_OAUTH_KEY_PATH=/data/service-account-key.json
- GA_WEB_VIEW_ID=CHANGE_ME
- GA_LINE_VIEW_ID=CHANGE_ME
- TIMEZONE=+08:00
- TRUST_PROXY_HEADERS=1
- COOKIE_SAMESITE_NONE=1
- GCS_CREDENTIALS=
- GCS_BUCKET_NAME=
- GCS_IMAGE_FOLDER=
- INTERNET_ARCHIVE_S3_ACCESS_KEY=
- INTERNET_ARCHIVE_S3_SECRET_KEY=
volumes:
- "./volumes/api:/data"
restart: always
db:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.2
environment:
- "path.repo=/usr/share/elasticsearch/data"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
volumes:
- "./volumes/db-production:/usr/share/elasticsearch/data"
restart: always
# No exposed ports by default.
# When migration, manually edit docker-compose to add "ports"
# and do `docker-compose restart db`.
db-staging:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.2
environment:
- "path.repo=/usr/share/elasticsearch/data"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "bootstrap.memory_lock=true"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
volumes:
- "./volumes/db-staging:/usr/share/elasticsearch/data"
restart: always
ports: # expose ports for db migration operations
- "62222:9200"
url-resolver:
image: cofacts/url-resolver
mem_limit: 250m
restart: always
ports: # expose for debugging
- "4000:4000"
environment:
- YOUTUBE_API_KEY=CHANGE_ME
- ROLLBAR_TOKEN=CHANGE_ME
- ROLLBAR_ENV=production-cofacts
# Apollo engine
- ENGINE_API_KEY=CHANGE_ME
redis:
image: redis:alpine
volumes:
- "./volumes/redis/redis.conf:/usr/local/etc/redis/redis.conf"
command: redis-server /usr/local/etc/redis/redis.conf
restart: always
collab-server:
image: cofacts/collab-server
environment:
- PORT=1234
- ELASTICSEARCH_URL=http://db:9200
collab-server-staging:
image: cofacts/collab-server:dev
environment:
- PORT=1234
- ELASTICSEARCH_URL=http://db:9200
# LLM observability tool
#
langfuse:
image: langfuse/langfuse:2
environment:
# Please setup CloudSQL with automatic IAM database auth with the same service account as cloudsql-proxy.
# https://cloud.google.com/sql/docs/postgres/iam-logins#log-in-with-automatic
# USER_NAME is DB user name with `@` replaced by `%40`.
#
# If there is permission error during migration, grant the user with permission using
# `GRANT CREATE ON SCHEMA public TO "DB user name";`
#
- DATABASE_URL=postgresql://[USER_NAME]@cloudsql-proxy/[DB_NAME]
# Required envs
# See https://langfuse.com/docs/deployment/self-host#configuring-environment-variables
- NEXTAUTH_URL=
- NEXTAUTH_SECRET=
- SALT=
- ENCRYPTION_KEY=
# Default & headless params
- LANGFUSE_INIT_ORG_ID=
- LANGFUSE_INIT_ORG_NAME=
- LANGFUSE_DEFAULT_ORG_ID=
- LANGFUSE_DEFAULT_ORG_ROLE=OWNER
# Social login
- AUTH_GOOGLE_CLIENT_ID=
- AUTH_GOOGLE_CLIENT_SECRET=
- AUTH_GOOGLE_ALLOWED_DOMAINS=
- AUTH_DISABLE_USERNAME_PASSWORD=true
depends_on:
- cloudsql-proxy
logging:
driver: gcplogs
options:
gcp-meta-id: langfuse
gcp-project: <GCP project>
# Primarily for Langfuse
cloudsql-proxy:
image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.0
volumes:
# The service account is used to both create connection (Cloud SQL Client) and authenticate (Cloud SQL Instance User)
# Ref: https://cloud.google.com/sql/docs/postgres/sql-proxy#permissions
# Ref: https://cloud.google.com/sql/docs/postgres/connect-auth-proxy#connecting-docker
# Ref: https://cloud.google.com/sql/docs/postgres/iam-logins
- "./volumes/cloudsql/service-account-key.json:/service-account-key.json"
command: --auto-iam-authn --address 0.0.0.0 --credentials-file /service-account-key.json INSTANCE_CONNECTION_NAME_CHANGE_ME
restart: unless-stopped
logging:
driver: gcplogs
options:
gcp-meta-id: langfuse
gcp-project: <GCP project>