This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
/
docker-compose.dist.yml
2546 lines (2351 loc) · 77 KB
/
docker-compose.dist.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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Media Cloud backend
# ===================
#
# Deploy by running:
#
# docker stack deploy -c docker-compose.mediacloud.yml mediacloud
#
# on one of the Docker Swarm's managers (preferably the leader):
#
# docker node ls | grep Leader
#
version: "3.7"
#
# Configuration for "common"-derived images
# =========================================
#
x-common-configuration: &common-configuration
# One or more semicolon-separated storage methods to store downloads in.
#
# Supported locations:
#
# * "postgresql" -- store downloads in the PostgreSQL database,
# "raw_downloads" table
# * "amazon_s3" -- store downloads in Amazon S3
#
# Default is "postgresql" which stores downloads directly in the PostgreSQL
# database.
#
# The path of the last download storage method listed below will be stored
# in "downloads.path" database column.
MC_DOWNLOADS_STORAGE_LOCATIONS: "postgresql"
# Read all non-inline ("content") downloads from S3
MC_DOWNLOADS_READ_ALL_FROM_S3: "0"
# Fallback PostgreSQL downloads to Amazon S3 (if download doesn't exist in
# PostgreSQL storage, S3 will be tried instead)
MC_DOWNLOADS_FALLBACK_POSTGRESQL_TO_S3: "0"
# Enable local Amazon S3 download cache
MC_DOWNLOADS_CACHE_S3: "0"
# (optional) S3 download storage access key ID
#MC_DOWNLOADS_AMAZON_S3_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
# (optional) S3 download storage secret access key
#MC_DOWNLOADS_AMAZON_S3_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY"
# (optional) S3 download storage bucket name
#MC_DOWNLOADS_AMAZON_S3_BUCKET_NAME: "mediacloud-downloads"
# (optional) S3 download storage directory name (prefix)
#MC_DOWNLOADS_AMAZON_S3_DIRECTORY_NAME: "downloads"
# amazon config for the public store (topic_maps, timespan_files, snapshot_files)
#MC_PUBLIC_AMAZON_S3_ACCESS_KEY_ID: "ASFASDF"
#MC_PUBLIC_AMAZON_S3_SECRET_ACCESS_KEY: "ASDFASDFADFADSF"
#MC_PUBLIC_AMAZON_S3_BUCKET_NAME: "mediacloud-public"
# set to 's3' for production after setting the above info or set to 'postgresql' for testing
MC_PUBLIC_STORE_TYPE: "s3"
# this should be a large random value so that the urls generate by the public store cannot be guessed
MC_PUBLIC_STORE_SALT: "GENERATE_UNIQUE_SALT"
# s3 directory under which to store the public s3 store objects
#MC_PUBLIC_AMAZON_S3_DIRECTORY_NAME: "production"
# "From:" email address when sending emails
MC_EMAIL_FROM_ADDRESS: "info@mediacloud.org"
# Email address to point to in List-Unsubscribe email header.
# Technically we don't have a straightforward "unsubscribe" endpoint, but our
# emails are more likely to be marked spam if we don't have such a header, so
# we make the email subject "Delete account and unsubscribe" in
# mediawords/util/config/common.py
# example value = support@example.com
MC_EMAIL_UNSUBSCRIBE: "support@example.com"
# Fail all HTTP requests that match the following pattern, e.g.
# "^https?://[^/]*some-website.com"
MC_USERAGENT_BLACKLIST_URL_PATTERN: ""
# (optional) JSON array of dictionaries of domains that might need HTTP auth credentials
# to work
#
# Example:
#
# [
# {
# "domain": "domain.com",
# "username": "username1",
# "password": "password1"
# },
# {
# "domain": "domain2.org",
# "username": "username2",
# "password": "password2"
# }
# ]
#
# Make sure to:
#
# * use double quotes instead of single quotes, as per JSON spec;
# * avoid double newlines as those would get parsed to a single newline and
# break the environment variable export for Cron jobs;
# * escape dollar signs ("$") by using double dollar signs ("$$"), if any.
#
MC_USERAGENT_AUTHENTICATED_DOMAINS: '
[
]
'
# parallel_get() parallel connection count
MC_USERAGENT_PARALLEL_GET_NUM_PARALLEL: "10"
# parallel_get() connection timeout, in seconds
MC_USERAGENT_PARALLEL_GET_TIMEOUT: "90"
# parallel_get() per-domain timeout, in seconds
MC_USERAGENT_PARALLEL_GET_PER_DOMAIN_TIMEOUT: "1"
# (Used by apps which inherit from "topics-base")
# Comma-separated email addresses to inform about topic updates
MC_TOPICS_BASE_TOPIC_ALERT_EMAILS: "topicupdates@mediacloud.org, slackupdates@mediacloud.org"
#
# Twitter API configuration
# =========================
#
x-twitter-api-configuration: &twitter-api-configuration
# Twitter API consumer key
MC_TWITTER_CONSUMER_KEY: ""
# Twitter API consumer secret
MC_TWITTER_CONSUMER_SECRET: ""
# Twitter API access token
MC_TWITTER_ACCESS_TOKEN: ""
# Twitter API access token secret
MC_TWITTER_ACCESS_TOKEN_SECRET: ""
#
# Brandwatch API configuration
# ============================
#
x-brandwatch-api-configuration: &brandwatch-api-configuration
MC_BRANDWATCH_USER: ""
# You need to escape dollar signs ("$") by using double dollar signs ("$$"), if any.
MC_BRANDWATCH_PASSWORD: ""
#
# Solr shard base service
# =======================
#
# Solr shards are not easily replicatable (because resharding would have to be
# done manually), also every Solr shard has to have its very own named volume
# to write the data to, so instead of replicating Solr shards with
# "deploy/replicas", we define every shard as its own independent service.
#
x-solr-shard_base: &solr-shard_base
image: gcr.io/mcback/solr-shard:release
init: true
environment:
# Shard count (every individual shard needs to know the total count)
#
# (keep in sync with how many shard services get actually defined in
# the "services" section, e.g. solr-shard-01, solr-shard-02,
# ..., solr-shard-24)
MC_SOLR_SHARD_COUNT: "24"
depends_on:
- solr-zookeeper
expose:
- "8983"
networks:
- default
# Default resources for every Solr shard
x-solr-shard_base_deploy_resources: &solr-shard_base_deploy_resources
# Every shard runs as its own independent, non-replicated service
resources:
limits:
# CPU core limit
#
# (each node has 32 cores and will be running 8 shards
# each, so 32 / 8 = 4)
cpus: "4"
# RAM limit
#
# (each node has 192 GB of RAM and will be running 8 shards
# each, so 192 / 8 = 24)
memory: 24G
# Placement constraints for Solr shards that run on host #1
x-solr-shard_base_deploy_placement_host1: &solr-shard_base_deploy_placement_host1
placement:
constraints:
# Must run on the host with Solr data volume
- node.labels.role-solr-shards-host1 == true
# Placement constraints for Solr shards that run on host #2
x-solr-shard_base_deploy_placement_host2: &solr-shard_base_deploy_placement_host2
placement:
constraints:
# Must run on the host with Solr data volume
- node.labels.role-solr-shards-host2 == true
# Placement constraints for Solr shards that run on host #3
x-solr-shard_base_deploy_placement_host3: &solr-shard_base_deploy_placement_host3
placement:
constraints:
# Must run on the host with Solr data volume
- node.labels.role-solr-shards-host3 == true
#
# Misc. apps placement constraint
# ===============================
#
# To be applied to every service that's not bound to run on a specific host.
# This is needed to prevent misc. services from running on hosts which are to
# be reserved for a particular service, e.g. we might want to run only
# "postgresql-server" app on a specific server.
#
x-misc-apps_deploy_placement_constraints: &misc-apps_deploy_placement_constraints
placement:
constraints:
# Must run on a host on which misc. apps are configured to run on
- node.labels.role-misc-apps == true
#
# Mitigate IPVS timeouts
# ======================
#
# See https://success.docker.com/article/ipvs-connection-timeout-issue
#
x-endpoint-mode-dnsrr: &endpoint-mode-dnsrr
endpoint_mode: dnsrr
#
# Services
# ========
#
services:
#
# CLIFF annotator service
# -----------------------
#
cliff-annotator:
image: gcr.io/mcback/cliff-annotator:release
init: true
networks:
- default
expose:
- 8080
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 1
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "6G"
#
# Webapp proxy to CLIFF annotator service
# ---------------------------------------
#
cliff-annotator-webapp-proxy:
image: gcr.io/mcback/cliff-annotator-webapp-proxy:release
init: true
networks:
- default
depends_on:
- cliff-annotator
ports:
# Public HTTP port
# (SSL is done by Nginx running on bastion host)
# MAKE SURE to BLOCK THIS PORT in provision/roles/docker/tasks/iptables.yml
- "8090:8080"
deploy:
# DNSRR disabled as it's not supported with published ports.
<<: *misc-apps_deploy_placement_constraints
# Worker count
replicas: 1
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
# CLIFF fetch annotation and tag
# -----------------------
#
cliff-update-story-tags:
image: gcr.io/mcback/cliff-fetch-annotation-and-tag:release
init: true
networks:
- default
environment:
<<: *common-configuration
# CLIFF version tag
MC_CLIFF_VERSION_TAG: "cliff_clavin_v2.6.1"
# Tag set to use for geographical name entities
MC_CLIFF_GEONAMES_TAG_SET: "cliff_geonames"
# Tag set to use for organization name entities
MC_CLIFF_ORGANIZATIONS_TAG_SET: "cliff_organizations"
# Tag set to use for person name entities
MC_CLIFF_PEOPLE_TAG_SET: "cliff_people"
depends_on:
- cliff-annotator
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 1
# Auto-restart on crashes
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "512M"
#
# AP crawler
# ----------
#
crawler-ap:
image: gcr.io/mcback/crawler-ap:release
init: true
networks:
- default
environment:
<<: *common-configuration
# AP API key
MC_CRAWLER_AP_API_KEY: ""
depends_on:
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 1
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "512M"
#
# Crawler fetcher
# ---------------
#
crawler-fetcher:
image: gcr.io/mcback/crawler-fetcher:release
init: true
networks:
- default
environment:
<<: *common-configuration
# Univision API client ID
MC_UNIVISION_CLIENT_ID: ""
# Univision API client secret (secret key)
MC_UNIVISION_CLIENT_SECRET: ""
depends_on:
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 8
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "512M"
#
# Crawler provider
# ----------------
#
crawler-provider:
image: gcr.io/mcback/crawler-provider:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "1G"
#
# Generate daily RSS dumps Cron job
# ---------------------------------
#
cron-generate-daily-rss-dumps:
image: gcr.io/mcback/cron-generate-daily-rss-dumps:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
volumes:
# Shared with "webapp-httpd" container:
- vol_daily_rss_dumps:/var/lib/daily_rss_dumps/
deploy:
<<: *endpoint-mode-dnsrr
placement:
constraints:
# Must run on the same host as the webapp-httpd server because they will be
# sharing the volume with generated static RSS dumps
- node.labels.role-webapp-httpd == true
resources:
limits:
# CPU core limit
cpus: "1"
# It appears that sometimes the script has to do huge dumps, and it does all of it in RAM
memory: "4GB"
#
# Generate media health report Cron job
# -------------------------------------
#
cron-generate-media-health:
image: gcr.io/mcback/cron-generate-media-health:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Generate daily / weekly user summary Cron job
# ---------------------------------------------
#
cron-generate-user-summary:
image: gcr.io/mcback/cron-generate-user-summary:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Print long running job states
# -----------------------------
#
cron-print-long-running-job-states:
image: gcr.io/mcback/cron-print-long-running-job-states:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Refresh stats Cron job
# ----------------------
#
cron-refresh-stats:
image: gcr.io/mcback/cron-refresh-stats:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Add due media to the rescraping queue Cron job
# ----------------------------------------------
#
cron-rescrape-due-media:
image: gcr.io/mcback/cron-rescrape-due-media:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Report rescraping changes Cron job
# ----------------------------------
#
cron-rescraping-changes:
image: gcr.io/mcback/cron-rescraping-changes:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Set media primary language Cron job
# -----------------------------------
#
cron-set-media-primary-language:
image: gcr.io/mcback/cron-set-media-primary-language:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Set media subject country Cron job
# -----------------------------------
#
cron-set-media-subject-country:
image: gcr.io/mcback/cron-set-media-subject-country:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# ELK Elasticsearch (log indexing)
# --------------------------------
#
elk-elasticsearch:
image: gcr.io/mcback/elk-elasticsearch:release
init: true
networks:
- default
environment:
<<: *common-configuration
# S3 credentials for Elasticsearch snapshot storage:
MC_ELK_ELASTICSEARCH_SNAPSHOT_S3_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
MC_ELK_ELASTICSEARCH_SNAPSHOT_S3_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY"
MC_ELK_ELASTICSEARCH_SNAPSHOT_S3_BUCKET_NAME: "mediacloud-test-elk-elasticsearch-snapshots"
MC_ELK_ELASTICSEARCH_SNAPSHOT_S3_PATH_PREFIX: "snapshots"
expose:
# HTTP transport
- "9200"
# TCP transport
- "9300"
volumes:
- vol_elk_elasticsearch_data:/var/lib/elasticsearch/
deploy:
<<: *endpoint-mode-dnsrr
placement:
constraints:
# Must run on the host with ELK Elasticsearch data volume
- node.labels.role-elk-elasticsearch == true
resources:
limits:
# CPU core limit
cpus: "4"
# RAM limit
memory: "8G"
#
# ELK Filebeat (plain text log collection)
# ----------------------------------------
#
elk-filebeat:
image: gcr.io/mcback/elk-filebeat:release
init: true
networks:
- default
environment:
<<: *common-configuration
volumes:
# Mount log directories, Docker directories and socket for Filebeat to
# be able to read logs
- /etc/hostname:/etc/hostname:ro
- /etc/machine-id:/etc/machine-id:ro
- /var/log/:/var/log/:ro
- /var/lib/docker/:/var/lib/docker/:ro
- /var/run/docker.sock:/var/run/docker.sock
deploy:
<<: *endpoint-mode-dnsrr
# Run on every node to be able to collect logs from each
mode: global
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "1G"
#
# ELK Journalbeat (journald log collection)
# -----------------------------------------
#
elk-journalbeat:
image: gcr.io/mcback/elk-journalbeat:release
init: true
networks:
- default
environment:
<<: *common-configuration
volumes:
# Mount journald log directory for Journalbeat to be able to read logs
- /etc/hostname:/etc/hostname:ro
- /etc/machine-id:/etc/machine-id:ro
- /var/log/journal/:/var/log/journal/:ro
# - /run/systemd:/run/systemd/:ro
deploy:
<<: *endpoint-mode-dnsrr
# Run on every node to be able to collect logs from each
mode: global
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "1G"
#
# ELK Kibana (web UI)
# ------------------------------
#
elk-kibana:
image: gcr.io/mcback/elk-kibana:release
init: true
networks:
- default
environment:
<<: *common-configuration
expose:
# Web server
- "5601"
ports:
# For connecting to through a SSH tunnel
# MAKE SURE to BLOCK THIS PORT in provision/roles/docker/tasks/iptables.yml
- "5601:5601"
deploy:
# DNSRR disabled as it's not supported with published ports.
<<: *misc-apps_deploy_placement_constraints
resources:
limits:
# CPU core limit
cpus: "2"
# RAM limit
memory: "8G"
#
# Extract and vector stories
# --------------------------
#
extract-and-vector:
image: gcr.io/mcback/extract-and-vector:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
- extract-article-from-page
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 24
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Extract article HTML from page HTML
# -----------------------------------
#
extract-article-from-page:
image: gcr.io/mcback/extract-article-from-page:release
init: true
networks:
- default
environment:
<<: *common-configuration
expose:
# HTTP extraction service
- 8080
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 8
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "512M"
#
# Fetch story stats from Facebook
# -------------------------------
#
facebook-fetch-story-stats:
image: gcr.io/mcback/facebook-fetch-story-stats:release
init: true
networks:
- default
environment:
<<: *common-configuration
# Facebook application ID
MC_FACEBOOK_APP_ID: ""
# Facebook application secret
MC_FACEBOOK_APP_SECRET: ""
depends_on:
- postgresql-pgbouncer
- rabbitmq-server
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
# Worker count
replicas: 4
restart_policy:
# Automatically restart on non-zero exit codes only instead of on any exit
condition: on-failure
# Autorestart up to three times
max_attempts: 3
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "256M"
#
# Import stories into Solr
# ------------------------
#
import-solr-data:
image: gcr.io/mcback/import-solr-data:release
init: true
networks:
- default
environment:
<<: *common-configuration
# Stories to import into Solr on a single run
MC_SOLR_IMPORT_MAX_QUEUED_STORIES: 100000
depends_on:
- postgresql-pgbouncer
- solr-shard-01
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# If importer script is playing catch up and has to import
# many stories at once, it will require more memory
memory: "8G"
#
# Import stories by scraping Feedly
# ---------------------------------
#
import-stories-feedly:
image: gcr.io/mcback/import-stories-feedly:release
init: true
networks:
- default
environment:
<<: *common-configuration
depends_on:
# Writes stories to PostgreSQL
- postgresql-pgbouncer
deploy:
<<: *misc-apps_deploy_placement_constraints
<<: *endpoint-mode-dnsrr
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit (uses quite a lot of it until it OOMs)
memory: "4G"
#
# OpenDKIM server
# ---------------
#
mail-opendkim-server:
image: gcr.io/mcback/mail-opendkim-server:release
init: true
networks:
- default
environment:
# Top-level domain to use for signing emails, e.g. "mediacloud.org"
MC_MAIL_OPENDKIM_DOMAIN: "mediacloud.org"
expose:
# OpenDKIM port used by Postfix
- "12301"
volumes:
- vol_opendkim_config:/etc/opendkim/
deploy:
<<: *endpoint-mode-dnsrr
placement:
constraints:
# Must run on the host with OpenDKIM data volume
- node.labels.role-mail-opendkim == true
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "128M"
#
# Postfix server
# ---------------
#
mail-postfix-server:
image: gcr.io/mcback/mail-postfix-server:release
init: true
networks:
- default
environment:
# Fully qualified domain name of a host server that will be used for HELO messages.
#
# Must both resolve and have a PTR record, i.e. if an email sent by us arrives from
# 1.2.3.4, and that host has a hostname smtp.mediacloud.org, then both:
#
# 1) Sending IP address should have a PTR record that points to FQDN:
#
# $ nslookup 1.2.3.4
# <...>
# 4.3.2.1.in-addr.arpa name = smtp.mediacloud.org
#
# 2) The FQDN should resolve to sending IP address:
#
# $ nslookup smtp.mediacloud.org
# <...>
# Non-authoritative answer:
# Name: server.mediacloud.org
# Address: 1.2.3.4
#
MC_MAIL_POSTFIX_FQDN: "smtp.mediacloud.org"
depends_on:
# Signs emails using OpenDKIM
- mail-opendkim-server
expose:
# Expose SMTP to mail senders
- "25"
volumes:
- vol_postfix_data:/var/lib/postfix/
deploy:
<<: *endpoint-mode-dnsrr
placement:
constraints:
# Must run on the host with Postfix data volume
- node.labels.role-mail-postfix == true
resources:
limits:
# CPU core limit
cpus: "1"
# RAM limit
memory: "128M"
#
# Munin Cron stats collector
# --------------------------
#
munin-cron:
image: gcr.io/mcback/munin-cron:release
# Docker doesn't reap zombie processes properly
# (https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/),
# and Munin runs all kinds of plugins which might not take care of their children properly.
init: true
networks:
- default
depends_on:
# Reads data from Munin node
- munin-node
environment:
MC_MUNIN_CRON_ALERT_EMAIL: "FIXME@mediacloud.org"