-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
302 lines (282 loc) · 14.2 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
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
#
# PLEASE READ https://ovh.github.io/cds/hosting/ready-to-run/docker-compose/
#
version: '3'
services:
cds-db:
image: postgres:14.0
environment:
POSTGRES_PASSWORD: cds
POSTGRES_USER: cds
POSTGRES_DB: cds
volumes:
- cds-postgres-volume:/var/lib/postgresql/data
cds-db-init:
image: postgres:14.0
command: >
sh -exc "PGPASSWORD=cds psql -h cds-db -p 5432 -U cds -d cds -c \"CREATE SCHEMA IF NOT EXISTS cdn AUTHORIZATION cds;\";"
links:
- cds-db
cds-cache:
image: redis:alpine
command: redis-server --requirepass cds --save 60 1
restart: always
volumes:
- cds-redis-volume:/data
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.7.2
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- cds-elasticsearch-volume:/usr/share/elasticsearch/data
restart: always
cds-migrate:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: >
sh -c "
/app/cds-engine-linux-amd64 database upgrade --db-host cds-db --db-user cds --db-password cds --db-name cds --db-schema public --db-sslmode disable --migrate-dir /app/sql/api;
/app/cds-engine-linux-amd64 database upgrade --db-host cds-db --db-user cds --db-password cds --db-name cds --db-schema cdn --db-sslmode disable --migrate-dir /app/sql/cdn;"
links:
- cds-db
cds-prepare:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: >
bash -c "
if [ ! -f /app/conf/conf.toml ]; then
/app/cds-engine-linux-amd64 config new api cdn ui hooks repositories vcs elasticsearch hatchery:local hatchery:swarm > /app/conf/conf.toml;
else
echo '/!\\ Config file already exists';
fi;
chown -R cds:cds /app/conf /app/artifacts /app/repositories /app/cdn-buffer /app/cdn-storage;
/app/cds-engine-linux-amd64 config new > /app/conf/conf.toml;
mkdir -p /app/artifacts /app/repositories /app/hatchery-local;
chown -R cds:cds /app/conf /app/artifacts /app/repositories /app/hatchery-local /app/cdn-buffer /app/cdn-storage;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.artifact.local.baseDirectory=/app/artifacts;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.cache.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.cache.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.database.host=cds-db;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.download.directory=/app;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml api.log.level=info;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.cache.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.cache.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.database.host=cds-db;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.publicTCP=${HOSTNAME}:8090;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.storageUnits.buffers.local-buffer.local.path=/app/cdn-buffer;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.storageUnits.buffers.redis.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.storageUnits.buffers.redis.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.storageUnits.storages.local.local.path=/app/cdn-storage;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml cdn.URL=http://cds-cdn:8089;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.elasticsearch.indexEvents=cds-index-events;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.elasticsearch.indexMetrics=cds-index-metrics;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.elasticsearch.url=http://elasticsearch:9200;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.name=cds-elasticsearch;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml elasticsearch.URL=http://cds-elasticsearch:8088;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.local.basedir=/app/hatchery-local;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.local.commonConfiguration.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.local.commonConfiguration.url=http://cds-hatchery-local:8086;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.swarm.commonConfiguration.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.swarm.commonConfiguration.url=http://cds-hatchery-swarm:8086;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.swarm.commonConfiguration.provision.workerApiHttp.url=http://$HOSTNAME:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.swarm.dockerEngines.sample-docker-engine.host=tcp://dockerhost:2375;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hatchery.swarm.dockerEngines.sample-docker-engine.maxContainers=4;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hooks.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hooks.cache.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hooks.cache.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml hooks.url=http://cds-hooks:8083;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml repositories.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml repositories.basedir=/app/repositories;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml repositories.cache.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml repositories.cache.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml repositories.URL=http://cds-repositories:8085;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml ui.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml ui.cdnURL=http://cds-cdn:8089;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml ui.enableServiceProxy=true;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml ui.hooksURL=http://cds-hooks:8083;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml vcs.api.http.url=http://cds-api:8081;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml vcs.cache.redis.host=cds-cache:6379;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml vcs.cache.redis.password=cds;
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml vcs.URL=http://cds-vcs:8084;
echo '';
echo '/!\\ Please run the export command BELOW, this will be useful to create admin user';
echo '';
TOKEN=`/app/cds-engine-linux-amd64 config init-token --config /app/conf/conf.toml`;
echo 'export INIT_TOKEN='$$TOKEN;
echo '';
echo '/!\\ Please run the export command ABOVE, this will be useful to create admin user';
echo '';"
user: root
volumes:
- cds-conf-volume:/app/conf
- cds-artifacts-volume:/app/artifacts
- cds-repositories-volume:/app/repositories
- cds-hatchery-local-volume:/app/hatchery-local
- cds-cdn-buffer-volume:/app/cdn-buffer
- cds-cdn-storage-volume:/app/cdn-storage
cds-api:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start api --config /app/conf/conf.toml"
volumes:
- cds-artifacts-volume:/app/artifacts
- cds-conf-volume:/app/conf
ports:
- "8081:8081"
links:
- cds-db
- cds-cache
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8081/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-ui:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start ui --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
ports:
- "8080:8080"
links:
- cds-api
- cds-hooks
- cds-cdn
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8080/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-hatchery-swarm:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start hatchery:swarm --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8086/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-cdn:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start cdn --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
- cds-cdn-buffer-volume:/app/cdn-buffer
- cds-cdn-storage-volume:/app/cdn-storage
ports:
- "8089:8089"
- "8090:8090"
links:
- cds-db
- cds-cache
- cds-api
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8089/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-hatchery-local:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start hatchery:local --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
- cds-hatchery-local-volume:/app/hatchery-local
links:
- cds-api
ports:
- "127.0.0.1:8086:8086"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8086/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-hooks:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start hooks --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
links:
- cds-api
- cds-cache
ports:
- "127.0.0.1:8083:8083"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8083/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-vcs:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start vcs --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
links:
- cds-api
- cds-cache
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8084/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-repositories:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start repositories --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
- cds-repositories-volume:/app/repositories
links:
- cds-api
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8085/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-elasticsearch:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: sh -c "/app/cds-engine-linux-amd64 start elasticsearch --config /app/conf/conf.toml"
volumes:
- cds-conf-volume:/app/conf
links:
- cds-api
- elasticsearch
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8088/mon/version"]
interval: 30s
timeout: 10s
retries: 6
cds-edit-config:
image: ${CDS_DOCKER_IMAGE:-ovhcom/cds-engine:latest}
command: >
sh -c "
/app/cds-engine-linux-amd64 config edit /app/conf/conf.toml --output /app/conf/conf.toml ${CDS_EDIT_CONFIG}";
volumes:
- cds-conf-volume:/app/conf
dockerhost:
image: bobrik/socat
command: TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "127.0.0.1:2375:2375"
kibana:
image: docker.elastic.co/kibana/kibana-oss:6.7.2
ports:
- "127.0.0.1:5601:5601"
links:
- elasticsearch
volumes:
cds-postgres-volume:
cds-redis-volume:
cds-elasticsearch-volume:
cds-conf-volume:
cds-artifacts-volume:
cds-repositories-volume:
cds-hatchery-local-volume:
cds-cdn-buffer-volume:
cds-cdn-storage-volume: