-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitlab.yaml
430 lines (430 loc) · 12.3 KB
/
gitlab.yaml
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
kind: Template
apiVersion: v1
metadata:
name: gitlab-ce
annotations:
iconClass: fa fa-git
description: 'GitLab. Collaboration and source control management: code, test,
and deploy together!'
tags: instant-app,gitlab,VCS
labels:
createdBy: gitlab-ce-template
parameters:
- description: The name for the application. The service will be named like the application.
displayName: Application name.
name: APPLICATION_NAME
value: gitlab-ce
- description: 'Custom hostname for service routes. e.g.: <application-name>.<project>.<default-domain-suffix>'
displayName: Gitlab instance hostname
name: APPLICATION_HOSTNAME
required: true
- name: GITLAB_ROOT_PASSWORD
displayName: GitLab Root User Password
description: Password for the GitLab 'root' user. Must be at least 8 characters
long. Leave blank if you would rather configure the password using the website
during first use.
- name: POSTGRESQL_USER
displayName: PostgreSQL User
description: Username for PostgreSQL user that will be used for accessing the database.
generate: expression
from: user[A-Z0-9]{3}
required: true
- name: POSTGRESQL_PASSWORD
displayName: PostgreSQL Password
description: Password for the PostgreSQL user.
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: POSTGRESQL_ADMIN_PASSWORD
displayName: PostgreSQL Admin User Password
description: Password for the PostgreSQL Admin user.
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: POSTGRESQL_DATABASE
displayName: PostgreSQL Database Name
description: Name of the PostgreSQL database accessed.
value: gitlabhq_production
required: true
- description: Volume size for /etc
displayName: "/etc/gitlab volume size"
name: ETC_VOL_SIZE
value: 100Mi
- description: Volume size for GitLab data
displayName: GitLab data volume size
name: GITLAB_DATA_VOL_SIZE
value: 5Gi
- description: Volume size for postgresql data
displayName: postgresql volume size
name: POSTGRESQL_VOL_SIZE
value: 2Gi
- description: Volume size for redis data
displayName: redis volume size
name: REDIS_VOL_SIZE
value: 512Mi
objects:
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}"
labels:
app: "${APPLICATION_NAME}"
spec:
strategy:
type: Rolling
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 600
maxUnavailable: 25%
maxSurge: 25%
resources: {}
triggers:
- type: ConfigChange
replicas: 1
test: false
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
template:
metadata:
labels:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
spec:
volumes:
- name: gitlab-ce-volume-1
persistentVolumeClaim:
claimName: "${APPLICATION_NAME}-etc"
- name: gitlab-ce-volume-2
persistentVolumeClaim:
claimName: "${APPLICATION_NAME}-data"
containers:
- name: gitlab-ce
image: gitlab/gitlab-ce
ports:
- containerPort: 22
protocol: TCP
- containerPort: 80
protocol: TCP
env:
- name: GITLAB_OMNIBUS_CONFIG
value: external_url 'http://${APPLICATION_HOSTNAME}/'; root_pass='${GITLAB_ROOT_PASSWORD}';
gitlab_rails['initial_root_password']=root_pass unless root_pass.to_s
== ''; postgresql['enable']=false; gitlab_rails['db_host'] = '${APPLICATION_NAME}-postgresql';
gitlab_rails['db_password']='${POSTGRESQL_PASSWORD}'; gitlab_rails['db_username']='${POSTGRESQL_USER}';
gitlab_rails['db_database']='${POSTGRESQL_DATABASE}'; redis['enable']
= false; gitlab_rails['redis_host']='${APPLICATION_NAME}-redis'; unicorn['worker_processes']
= 2; manage_accounts['enable'] = true; manage_storage_directories['manage_etc']
= false; gitlab_shell['auth_file'] = '/gitlab-data/ssh/authorized_keys';
git_data_dir '/gitlab-data/git-data'; gitlab_rails['shared_path'] =
'/gitlab-data/shared'; gitlab_rails['uploads_directory'] = '/gitlab-data/uploads';
gitlab_ci['builds_directory'] = '/gitlab-data/builds';
resources:
limits:
cpu: '1'
memory: 2Gi
requests:
cpu: 500m
memory: 1Gi
volumeMounts:
- name: gitlab-ce-volume-1
mountPath: "/etc/gitlab"
- name: gitlab-ce-volume-2
mountPath: "/gitlab-data"
livenessProbe:
httpGet:
path: "/help"
port: 80
scheme: HTTP
initialDelaySeconds: 480
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: "/help"
port: 80
scheme: HTTP
initialDelaySeconds: 20
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: "/dev/termination-log"
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-redis"
labels:
app: "${APPLICATION_NAME}"
spec:
strategy:
type: Rolling
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 600
maxUnavailable: 25%
maxSurge: 25%
resources: {}
triggers:
- type: ConfigChange
replicas: 1
test: false
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-redis"
template:
metadata:
labels:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-redis"
spec:
volumes:
- name: gitlab-ce-volume-4
persistentVolumeClaim:
claimName: "${APPLICATION_NAME}-redis-data"
containers:
- name: gitlab-ce-redis
image: redis:3.2.3-alpine
ports:
- containerPort: 6379
protocol: TCP
resources:
limits:
cpu: '1'
memory: 512Mi
requests:
cpu: 100m
memory: 300Mi
volumeMounts:
- name: gitlab-ce-volume-4
mountPath: "/data"
terminationMessagePath: "/dev/termination-log"
imagePullPolicy: IfNotPresent
securityContext:
privileged: false
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-postgresql"
labels:
app: "${APPLICATION_NAME}"
spec:
strategy:
type: Rolling
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 600
maxUnavailable: 25%
maxSurge: 25%
post:
failurePolicy: Abort
execNewPod:
containerName: gitlab-ce-postgresql
command:
- "/usr/bin/scl"
- enable
- rh-postgresql94
- export PGPASSWORD='${POSTGRESQL_ADMIN_PASSWORD}'; psql -h '${APPLICATION_NAME}-postgresql'
-U postgres -d ${POSTGRESQL_DATABASE} -c 'CREATE EXTENSION IF NOT EXISTS
pg_trgm;'
env:
- name: HOME
value: "/var/lib/pgsql"
- name: PGDATA
value: "/var/lib/pgsql/data/userdata"
- name: CONTAINER_SCRIPTS_PATH
value: "/usr/share/container-scripts/postgresql"
volumes:
- gitlab-ce-volume-3
resources: {}
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- gitlab-ce-postgresql
from:
kind: ImageStreamTag
name: postgresql:9.4
namespace: openshift
replicas: 1
test: false
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-postgresql"
template:
metadata:
labels:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-postgresql"
spec:
volumes:
- name: gitlab-ce-volume-3
persistentVolumeClaim:
claimName: "${APPLICATION_NAME}-postgresql"
containers:
- name: gitlab-ce-postgresql
image: gitlab-ce-postgresql
ports:
- containerPort: 5432
protocol: TCP
readinessProbe:
timeoutSeconds: 1
initialDelaySeconds: 5
exec:
command:
- "/bin/sh"
- "-i"
- "-c"
- psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c
'SELECT 1'
livenessProbe:
timeoutSeconds: 1
initialDelaySeconds: 480
tcpSocket:
port: 5432
env:
- name: POSTGRESQL_USER
value: "${POSTGRESQL_USER}"
- name: POSTGRESQL_PASSWORD
value: "${POSTGRESQL_PASSWORD}"
- name: POSTGRESQL_DATABASE
value: "${POSTGRESQL_DATABASE}"
- name: POSTGRESQL_ADMIN_PASSWORD
value: "${POSTGRESQL_ADMIN_PASSWORD}"
resources:
limits:
cpu: '1'
memory: 512Mi
requests:
cpu: 300m
memory: 300Mi
volumeMounts:
- name: gitlab-ce-volume-3
mountPath: "/var/lib/pgsql/data"
terminationMessagePath: "/dev/termination-log"
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
- kind: Service
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}"
labels:
app: "${APPLICATION_NAME}"
spec:
ports:
- name: 22-ssh
protocol: TCP
port: 22
targetPort: 22
- name: 80-http
protocol: TCP
port: 80
targetPort: 80
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}"
type: ClusterIP
sessionAffinity: None
- kind: Service
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-redis"
labels:
app: "${APPLICATION_NAME}"
spec:
ports:
- name: 6379-redis
protocol: TCP
port: 6379
targetPort: 6379
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-redis"
type: ClusterIP
sessionAffinity: None
- kind: Service
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-postgresql"
labels:
app: "${APPLICATION_NAME}"
spec:
ports:
- name: 5432-postgresql
protocol: TCP
port: 5432
targetPort: 5432
selector:
app: "${APPLICATION_NAME}"
deploymentconfig: "${APPLICATION_NAME}-postgresql"
type: ClusterIP
sessionAffinity: None
- kind: Route
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}"
labels:
app: "${APPLICATION_NAME}"
spec:
host: "${APPLICATION_HOSTNAME}"
to:
kind: Service
name: "${APPLICATION_NAME}"
port:
targetPort: 80-http
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-redis-data"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${REDIS_VOL_SIZE}"
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-etc"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${ETC_VOL_SIZE}"
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-data"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${GITLAB_DATA_VOL_SIZE}"
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${APPLICATION_NAME}-postgresql"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${POSTGRESQL_VOL_SIZE}"