forked from usdot-jpo-ode/jpo-conflictmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
181 lines (174 loc) · 6.63 KB
/
docker-compose.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
version: '3.9'
services:
conflictmonitor:
build: .
image: jpo-conflictmonitor:latest
restart: always
ports:
- "8082:8082"
environment:
DOCKER_HOST_IP: ${DOCKER_HOST_IP}
KAFKA_BROKER_IP: ${KAFKA_BROKER_IP}
DB_HOST_IP: ${DB_HOST_IP}
spring.kafka.bootstrap-servers: ${KAFKA_BROKER_IP}:9092
healthcheck:
test: ["CMD", "java", "-version"]
interval: 10s
timeout: 10s
retries: 20
logging:
options:
max-size: "10m"
max-file: "5"
deploy:
resources:
limits:
memory: 3G
deduplicator:
build:
context: .
dockerfile: Dedup_Dockerfile
image: jpo-deduplicator:latest
restart: always
environment:
DOCKER_HOST_IP: ${DOCKER_HOST_IP}
KAFKA_BROKER_IP: ${KAFKA_BROKER_IP}
spring.kafka.bootstrap-servers: ${KAFKA_BROKER_IP}:9092
healthcheck:
test: ["CMD", "java", "-version"]
interval: 10s
timeout: 10s
retries: 20
logging:
options:
max-size: "10m"
max-file: "5"
deploy:
resources:
limits:
memory: 3G
mongodb_container:
image: mongo:6
container_name: jpo-conflictmonitor-mongodb-container
restart: always
environment:
- MONGO_REPLICA_SET_NAME=rs0
- DB_HOST_IP=${DB_HOST_IP}
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- CM_MONGO_CONNECTOR_USERNAME=${CM_MONGO_CONNECTOR_USERNAME}
- CM_MONGO_CONNECTOR_PASSWORD=${CM_MONGO_CONNECTOR_PASSWORD}
- CM_MONGO_API_USERNAME=${CM_MONGO_API_USERNAME}
- CM_MONGO_API_PASSWORD=${CM_MONGO_API_PASSWORD}
- CM_MONGO_USER_USERNAME=${CM_MONGO_USER_USERNAME}
- CM_MONGO_USER_PASSWORD=${CM_MONGO_USER_PASSWORD}
- CM_DATABASE_NAME=${CM_DATABASE_NAME}
- CM_DATABASE_STORAGE_COLLECTION_NAME=${CM_DATABASE_STORAGE_COLLECTION_NAME}
- CM_DATABASE_SIZE_GB=${CM_DATABASE_SIZE_GB}
- CM_DATABASE_SIZE_TARGET_PERCENT=${CM_DATABASE_SIZE_TARGET_PERCENT}
- CM_DATABASE_DELETE_THRESHOLD_PERCENT=${CM_DATABASE_DELETE_THRESHOLD_PERCENT}
- CM_DATABASE_MAX_TTL_RETENTION_SECONDS=${CM_DATABASE_MAX_TTL_RETENTION_SECONDS}
- CM_DATABASE_MIN_TTL_RETENTION_SECONDS=${CM_DATABASE_MIN_TTL_RETENTION_SECONDS}
- CM_DATABASE_COMPACTION_TRIGGER_PERCENT=${CM_DATABASE_COMPACTION_TRIGGER_PERCENT}
ports:
- "27017:27017"
volumes:
- mongodb_data_container:/data/db
- ./docker/mongo/manage-volume-cron:/docker-entrypoint-initdb.d/manage-volume-cron
- ./docker/mongo/keyfile.txt:/data/keyfile-import.txt
- ./docker/mongo/a_init_replicas.js:/docker-entrypoint-initdb.d/a_init_replicas.js
- ./docker/mongo/b_create_indexes.js:/docker-entrypoint-initdb.d/b_create_indexes.js
- ./docker/mongo/manage_volume.js:/docker-entrypoint-initdb.d/manage_volume.js
healthcheck:
test: |
test $$(mongosh --username ${MONGO_INITDB_ROOT_USERNAME} --password ${MONGO_INITDB_ROOT_PASSWORD} --quiet --eval "db.runCommand({ping:1}).ok") -eq 1
interval: 10s
start_period: 60s
entrypoint:
- bash
- -c
- |
apt update
apt install -y cron gettext systemctl dos2unix
systemctl start cron
systemctl enable cron
envsubst < /docker-entrypoint-initdb.d/manage-volume-cron > /etc/cron.d/manage-volume-cron
dos2unix /etc/cron.d/manage-volume-cron
chmod 644 /etc/cron.d/manage-volume-cron
systemctl restart cron
cp /data/keyfile-import.txt /data/keyfile.txt
chmod 400 /data/keyfile.txt
chown 999:999 /data/keyfile.txt
exec docker-entrypoint.sh $$@
command: ["mongod", "--replSet", "rs0", "--bind_ip_all", "--keyFile", "/data/keyfile.txt"]
logging:
options:
max-size: "10m"
max-file: "5"
deploy:
resources:
limits:
memory: 3G
connect:
image: cp-kafka-connect:6.1.9
build:
context: ./docker/connect
dockerfile: Dockerfile
container_name: jpo-conflictmonitor-kafka-connect
restart: always
ports:
- "8083:8083"
depends_on:
mongodb_container:
condition: service_healthy
environment:
DOCKER_HOST_IP: ${DOCKER_HOST_IP}
DB_HOST_IP: ${DB_HOST_IP}
CONNECT_BOOTSTRAP_SERVERS: ${KAFKA_BROKER_IP}:9092
CONNECT_REST_ADVERTISED_HOST_NAME: connect
CONNECT_REST_PORT: 8083
CONNECT_GROUP_ID: compose-connect-group
CONNECT_CONFIG_STORAGE_TOPIC: CmConnectConfigs
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
CONNECT_CONFIG_STORAGE_CLEANUP_POLICY: compact
CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000
CONNECT_OFFSET_STORAGE_TOPIC: CmConnectOffsets
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
CONNECT_OFFSET_STORAGE_CLEANUP_POLICY: compact
CONNECT_STATUS_STORAGE_TOPIC: CmConnectStatus
CONNECT_STATUS_STORAGE_CLEANUP_POLICY: compact
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_LOG4J_ROOT_LOGLEVEL: "ERROR"
CONNECT_LOG4J_LOGGERS: "org.apache.kafka.connect.runtime.rest=ERROR,org.reflections=ERROR,com.mongodb.kafka=ERROR"
CONNECT_PLUGIN_PATH: /usr/share/confluent-hub-components
CONNECT_ZOOKEEPER_CONNECT: "zookeeper:2181"
CM_MONGO_CONNECTOR_USERNAME: ${CM_MONGO_CONNECTOR_USERNAME}
CM_MONGO_CONNECTOR_PASSWORD: ${CM_MONGO_CONNECTOR_PASSWORD}
logging:
options:
max-size: "10m"
max-file: "5"
command:
- bash
- -c
- |
/etc/confluent/docker/run &
echo "Waiting for Kafka Connect to start listening on kafka-connect ❳"
while [ $$(curl -s -o /dev/null -w %{http_code} http://${KAFKA_CONNECT_IP}:8083/connectors) -eq 000 ] ; do
echo -e $$(date) " Kafka Connect listener HTTP state: " $$(curl -s -o /dev/null -w %{http_code} http://${KAFKA_CONNECT_IP}:8083/connectors) " (waiting for 200)"
sleep 5
done
sleep 10
echo -e "\n--\n+> Creating Kafka Connect MongoDB sink"
bash /scripts/connect_start.sh "mongodb://${CM_MONGO_CONNECTOR_USERNAME}:${CM_MONGO_CONNECTOR_USERNAME}@${DOCKER_HOST_IP}:27017/?authMechanism=DEFAULT&authSource=ConflictMonitor&replicaSet=rs0"
sleep infinity
deploy:
resources:
limits:
memory: 3G
volumes:
mongodb_data_container: