-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
198 lines (185 loc) · 5.19 KB
/
docker-compose.yml
File metadata and controls
198 lines (185 loc) · 5.19 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
volumes:
mongo-community:
mongo-community-search:
services:
postgres:
image: postgres:15.0-bullseye
ports:
- '127.0.0.1:20001:5432'
environment:
POSTGRES_PASSWORD: admin
POSTGRES_USER: admin
POSTGRES_DB: test_db
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U admin -d test_db" ]
interval: 10s
timeout: 5s
retries: 5
mongo:
image: mongo:7.0
ports:
- '127.0.0.1:20002:27017'
environment:
MONGODB_INITDB_ROOT_USERNAME: admin
MONGODB_INITDB_ROOT_PASSWORD: admin
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
healthcheck:
test: [ "CMD-SHELL", "echo 'db.runCommand({ ping: 1 })' | mongosh mongodb://localhost:27017/test_db --quiet" ]
interval: 10s
timeout: 5s
retries: 5
elasticsearch:
image: elasticsearch:7.17.25
ports:
- '127.0.0.1:20003:9200'
environment:
discovery.type: single-node
ES_JAVA_OPTS: "-Xms1024m -Xmx1024m"
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:9200/_cat/health" ]
interval: 10s
timeout: 5s
retries: 5
mongo-community:
container_name: search-ast-helper-mongo-community
hostname: mongo-community
extra_hosts:
# We override the hostname for mongo to point to localhost.
# Because in the init mode mongo is only available to localhost.
# But we need the replicaset to be configured with a name other containers can see.
# https://github.com/docker-library/mongo/issues/339#issuecomment-2253159258
- "mongo-community:127.0.0.1"
#image: mongodb/mongodb-community-server:8.2.1-ubi8
image: mongo:8.2.1
command:
- "--bind_ip_all"
- "--replSet"
- "rs0"
- "--setParameter"
- "mongotHost=mongo-community-search:27027"
- "--setParameter"
- "searchIndexManagementHostAndPort=mongo-community-search:27027"
- "--setParameter"
- "skipAuthenticationToSearchIndexManagementServer=false"
- "--setParameter"
- "useGrpcForSearch=true"
- "--keyFile"
- "/keyfile"
- "--auth"
ports:
- '127.0.0.1:20004:27017'
volumes:
- mongo-community:/data/db:delegated
configs:
- source: mongo-rs-config.js
target: /docker-entrypoint-initdb.d/mongo-rs-config.js
- source: mongo-user-config.js
target: /docker-entrypoint-initdb.d/mongo-user-config.js
- source: keyfile
target: /keyfile
mode: 0400
uid: "999"
gid: "999"
healthcheck:
test: >
mongosh --quiet "localhost/test" --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'
interval: 10s
timeout: 5s
retries: 10
start_period: 40s
mongo-community-search:
container_name: search-ast-helper-mongo-community-search
hostname: mongo-community-search
image: mongodb/mongodb-community-search:0.55.0
ports:
- '127.0.0.1:20005:27027'
volumes:
- mongo-community-search:/data/mongot:delegated
configs:
- source: config.default.yml
target: /mongot-community/config.default.yml
- source: passwordFile
target: /etc/mongot/secrets/passwordFile
mode: 0400
uid: "999"
gid: "999"
stop_grace_period: 1s
depends_on:
mongo-community:
condition: service_healthy
configs:
mongo-rs-config.js:
# language=javascript
content: |
print("\n\n\nStarting Replica Set Configuration\n\n\n");
rs.initiate({
_id: "rs0",
members: [
{ _id: 0, host: `mongo-community:27017` }
]
});
while (!rs.status().members.some(m => m.stateStr === "PRIMARY")) {
print("Waiting for primary...");
sleep(1000); // sleep 1 second
}
print("\n\n\nReplica Set Configuration Completed\n\n\n");
mongo-user-config.js:
# language=javascript
content: |
print("\n\n\nCreating Users\n\n\n");
var db = db.getSiblingDB("admin");
db.createUser(
{
user: "admin",
pwd: "admin",
mechanisms: ["SCRAM-SHA-256"],
roles: [
{
role: "root",
db: "admin"
}
]
},
{
w: "majority",
wtimeout: 5000
}
);
db.createUser(
{
user: "search",
pwd: "search",
mechanisms: ["SCRAM-SHA-256"],
roles: [ "searchCoordinator" ]
}
);
print("\n\n\nUsers created\n\n\n");
keyfile:
content: |
helloworld
passwordFile:
content: "search"
config.default.yml:
# language=yaml
content: |
syncSource:
replicaSet:
hostAndPort: "mongo-community:27017"
username: "search"
passwordFile: "/etc/mongot/secrets/passwordFile"
tls: false
storage:
dataPath: "/data/mongot"
server:
grpc:
address: "0.0.0.0:27027"
tls:
mode: "disabled"
metrics:
enabled: true
address: "0.0.0.0:9946"
healthCheck:
address: "0.0.0.0:8080"
logging:
verbosity: INFO