-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
266 lines (254 loc) · 7.24 KB
/
docker-compose.yml
File metadata and controls
266 lines (254 loc) · 7.24 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
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
networks:
default:
name: cicdlab
volumes:
ciserver_data: {}
dbserver_data: {}
# proxy:
# image: nginx
# volumes:
# - ./nginx.conf:/etc/nginx/conf.d/default.conf
# ports:
# - 80:80
services:
artifactsrepo:
container_name: cicdlab-artifactsrepo
hostname: artifactsrepo
image: sonatype/nexus3:latest
environment:
- NEXUS_CONTEXT=nexus
- NEXUS_SECURITY_INITIAL_PASSWORD=password
volumes:
- ./setup:/setup
- ${ARTIFACTSREPO_VOLUME:-./volume_data/artifactsrepo}:/nexus-data
healthcheck:
test: ["CMD", "curl", "http://localhost:8081/nexus/service/rest/v1/status"]
retries: 20
interval: 1m
start_period: 2m
ports:
- 8081:8081
deploy:
resources:
limits:
memory: 4gb
ciserver:
depends_on:
socat:
condition: service_started
artifactsrepo:
condition: service_healthy
scmserver:
condition: service_healthy
container_name: cicdlab-ciserver
hostname: ciserver
image: mscata/cicdlab-ciserver:latest
environment:
DOCKER_HOST: socat:2375
CASC_JENKINS_CONFIG: /setup/jenkins/jenkins-config.yaml
JENKINS_JAVA_OPTS: -Djenkins.install.runSetupWizard=false
JENKINS_OPTS: --prefix=/jenkins
ports:
- 8080:8080
- 50000:50000
volumes:
- ${CISERVER_VOLUME:-ciserver_data}:/var/jenkins_home
- ${CIJOBS_VOLUME:-./volume_data/cijobs}:/var/jenkins_home/jobs
- //var/run/docker.sock:/var/run/docker.sock
- ./setup:/setup
### Uncomment the following section to make sure the
### plugins are always updated automatically, at the
### expense of a few more minutes of startup time
# command:
# - /bin/bash
# - -c
# - |
# echo "Downloading/updating plugins..."
# jenkins-plugin-cli --plugin-file /setup/jenkins/jenkins-plugins.txt --verbose --skip-failed-plugins
# echo "Starting Jenkins..."
# /usr/local/bin/jenkins.sh
deploy:
resources:
limits:
cpus: '0.75'
memory: 2gb
healthcheck:
test: ["CMD", "curl", "-Ifs", "http://localhost:8080/jenkins/login"]
retries: 10
interval: 1m
start_period: 2m
# codescan:
# depends_on:
# dbserver:
# condition: service_healthy
# container_name: cicdlab-codescan
# hostname: codescan
# image: sonarqube:lts-community
# environment:
# SONAR_JDBC_URL: jdbc:postgresql://dbserver:5432/postgres?currentSchema=sonar
# SONAR_JDBC_USERNAME: postgres
# SONAR_JDBC_PASSWORD: password
# SONAR_WEB_CONTEXT: /sonar
# SONAR_WEB_JAVAADDITIONALOPTS: -Djava.security.egd=file:/dev/./urandom
# ports:
# - "9000:9000"
# volumes:
# - codescan_data:/opt/sonarqube
# deploy:
# resources:
# limits:
# cpus: '1.00'
# memory: 4gb
dbadmin:
depends_on:
dbserver:
condition: service_healthy
container_name: cicdlab-dbadmin
hostname: dbadmin
image: mscata/cicdlab-dbadmin:latest
environment:
PGADMIN_DEFAULT_EMAIL: admin@cicdlabs.org
PGADMIN_DEFAULT_PASSWORD: password
PGADMIN_CONFIG_ENABlE_PSQL: 'True'
PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS: 1000
PGADMIN_CONFIG_CONFIG_DATABASE_URI: '''postgresql://postgres:password@cicdlab-dbserver:5432/postgres?options=-csearch_path=pgadmin'''
ports:
- 5050:80
volumes:
- ./setup:/setup
- ${DBADMIN_VOLUME:-./data/dbadmin}:/var/lib/pgadmin
deploy:
resources:
limits:
cpus: '0.25'
memory: 256m
dbserver:
container_name: cicdlab-dbserver
hostname: dbserver
image: mscata/cicdlab-dbserver:latest
environment:
PGDATA: /var/lib/postgresql/data
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
volumes:
- ${DBSERVER_VOLUME:-dbserver_data}:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "psql", "-U", "postgres", "postgresql://postgres:password@cicdlab-dbserver:5432/postgres",
"-c", "select * from information_schema.schemata"]
retries: 10
start_period: 2m
deploy:
resources:
limits:
cpus: '0.75'
memory: 256m
labsetup:
depends_on:
artifactsrepo:
condition: service_healthy
ciserver:
condition: service_healthy
container_name: cicdlab-labsetup
hostname: labsetup
image: alpine:latest
volumes:
- ./setup:/setup
command:
- /bin/sh
- -c
- |
echo "Installing packages..."
apk add curl bash git
echo "Running setup scripts for the CI/CD lab..."
/setup/nexus/setup.sh
/setup/gitea/setup.sh
/setup/jenkins/setup.sh
echo "End of setup."
echo "This container will shut down now."
deploy:
resources:
limits:
cpus: '0.25'
memory: 256m
# projectadmin:
# container_name: cicdlab-projectadmin
# hostname: projectadmin
# image: redmine
# environment:
# - RAILS_ENV=production
# - REDMINE_DB_POSTGRES=dbserver
# - REDMINE_DB_USERNAME=postgres
# - REDMINE_DB_PASSWORD=password
# - REDMINE_LANG=en_GB
# volumes:
# - ${PROJECTADMIN_VOLUME:-./volume_data/projectadmin}:/usr/src/redmine
# - ./setup/redmine/database.yml:/usr/src/redmine/config/database.yml
# healthcheck:
# test: ["CMD", "curl", "http://localhost:3001"]
# retries: 20
# interval: 1m
# start_period: 1m
# ports:
# - 3001:3001
# deploy:
# resources:
# limits:
# memory: 2gb
scmserver:
depends_on:
dbserver:
condition: service_healthy
container_name: cicdlab-scmserver
hostname: scmserver
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=dbserver:5432
- GITEA__database__NAME=postgres
- GITEA__database__SCHEMA=gitea
- GITEA__database__USER=postgres
- GITEA__database__PASSWD=password
- GITEA__security__INSTALL_LOCK=true
volumes:
- ./setup:/setup
- ${SCMSERVER_VOLUME:-./volume_data/scmserver}:/data
- ./setup/gitea/gitea-app.ini:/data/gitea/conf/app.ini
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
retries: 10
start_period: 2m
ports:
- 3000:3000
- 222:22
deploy:
resources:
limits:
cpus: '0.50'
memory: 256m
socat:
# socat allows to run Docker inside Docker in the simplest way, so we
# can use Docker builder nodes in our CI/CD workflow, and we can also
# use them to build Docker images
container_name: cicdlab-socat
hostname: socat
image: alpine/socat
command: tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
user: root
volumes:
- type: bind
source: //var/run/docker.sock
target: //var/run/docker.sock
# monitoringserver:
# container_name: cicdlab-monitoringserver
# hostname: monitoringserver
# image: prom/prometheus
# volumes:
# - ./setup:/setup
## - ./setup/prometheus/prometheus.yml:/etc/prometheus/prom/prometheus.yml
## - prometheus_data:/etc/prometheus/data
# ports:
# - 9090:9090