This repository has been archived by the owner on Mar 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest.jps
467 lines (459 loc) · 17.7 KB
/
manifest.jps
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
jpsVersion: 1.3
jpsType: install
application:
id: shopozor-ci
name: Shopozor Continuous Integration
version: 0.0
baseUrl: https://raw.githubusercontent.com/shopozor/ci/master
# if a local private registry is necessary, then add to the current manifest the manifest code from here: https://github.com/HidoraSwiss/manifest-registry/blob/master/manifest.jps
settings:
fields:
- type: space
caption: Environments
- name: nginxVersion
caption: Nginx version
type: string
required: true
default: 1.16.1
- name: jenkinsPort
caption: Jenkins port
type: string
required: true
default: 8080
- type: spacer
caption: Product
- name: productName
caption: Product name
type: string
required: true
- type: spacer
caption: softozor.ch credentials
- name: softozorUsername
caption: Username
type: string
required: true
- name: softozorPassword
caption: Password
type: string
inputType: password
required: true
- type: spacer
caption: Github credentials
- name: githubUsername
caption: Full permissions user
type: string
required: true
- name: githubPassword
caption: Password
type: string
inputType: password
required: true
- name: ghprbSecret
caption: GHPRB Secret
type: string
required: true
- type: spacer
caption: Docker credentials
- name: dockerUsername
caption: User
type: string
required: true
- name: dockerPassword
caption: Password
type: string
inputType: password
required: true
- type: spacer
caption: Jelastic credentials
- name: jelasticUrl
caption: Hoster URL
type: string
required: true
- name: jelasticAppId
caption: AppId
type: string
required: true
- name: jelasticUsername
caption: User
type: string
required: true
- name: jelasticPassword
caption: Password
type: string
inputType: password
required: true
- type: spacer
caption: E2E JPS
- name: jpsBaseUrl
caption: BE Url
type: string
required: true
default: https://raw.githubusercontent.com/shopozor/services/dev/
- type: spacer
caption: User accounts
- name: username1
caption: Username 1
type: string
required: true
default: zadigus
globals:
JENKINS_PLUGINS_FILENAME: listOfJenkinsPlugins.txt
CREDENTIAL_FILENAME: credential.xml
SECRET_CREDENTIAL_FILENAME: secret.xml
GITHUB_CREDENTIAL_FILENAME: github-credentials.xml
SOFTOZOR_CREDENTIAL_FILENAME: softozor-credentials.xml
DOCKER_CREDENTIAL_FILENAME: docker-credentials.xml
JELASTIC_USER_CREDENTIAL_FILENAME: jelastic-credentials.xml
JELASTIC_APP_CREDENTIAL_FILENAME: jelastic-app-credentials.xml
SERVICES_CREDENTIAL_FILENAME: services-name-credentials.xml
CREDENTIAL_SCRIPT: CreateCredential.sh
USER_ACCOUNT_CREATION_SCRIPT: CreateUserAccount.sh
GITHUB_CREDENTIALS_ID: github-credentials
SOFTOZOR_CREDENTIALS_ID: softozor-credentials
DOCKER_CREDENTIALS_ID: docker-credentials
JELASTIC_USER_CREDENTIALS_ID: jelastic-credentials
JELASTIC_APP_CREDENTIALS_ID: jelastic-app-credentials
SERVICES_CREDENTIALS_ID: services-baseurl-credentials
GHPRBTRIGGER_PLUGIN_CONFIG: org.jenkinsci.plugins.ghprb.GhprbTrigger.xml
GLOBAL_LIBRARIES_PLUGIN_CONFIG: org.jenkinsci.plugins.workflow.libs.GlobalLibraries.xml
USER_PASSWORD1: ${fn.password(10)}
PRODUCT_CREDENTIAL_FILENAME: product-credentials.xml
PRODUCT_CREDENTIALS_ID: product-name-credentials
DHPARAM_FILENAME: /var/lib/nginx/dhparam.pem
env:
topology:
nodes:
- nodeGroup: bl
nodeType: nginx-dockerized
tag: ${settings.nginxVersion}
displayName: Node balancing
count: 1
fixedCloudlets: 1
cloudlets: 32
env:
DOCKER_EXPOSED_PORT: 22,80,443
- image: jenkins/jenkins:lts
count: 1
fixedCloudlets: 1
cloudlets: 32
nodeGroup: cp
env:
# By default, Jelastic redirects Jenkins port 8080 to port 80;
# this has the side-effect that docker can't get access to the internet,
# therefore requiring the option --network=host in the docker build command.
# To avoid that, we disable that redirection by setting the following variable
JELASTIC_EXPOSE: DISABLED
onInstall:
- installDocker
- installPlugins
- installAptPackages
- createUserAccounts
- setupCredentials
- setupJobs
- setupJobViews
- secure
- restart
- sendEmailWithPasswords
actions:
installDocker:
- cmd [cp]:
- curl -fsSL ${baseUrl}/scripts/InstallDocker.sh | /bin/bash
installPlugins:
- cmd [cp]:
- cd /tmp
- wget --quiet ${baseUrl}/config/plugins/${globals.JENKINS_PLUGINS_FILENAME}
- curl -fsSL ${baseUrl}/scripts/InstallPlugins.sh | /bin/bash -s ${globals.JENKINS_PLUGINS_FILENAME}
- upload:
- nodeGroup: cp
sourcePath: ${baseUrl}/config/plugins/${globals.GHPRBTRIGGER_PLUGIN_CONFIG}
destPath: /var/jenkins_home/${globals.GHPRBTRIGGER_PLUGIN_CONFIG}
- nodeGroup: cp
sourcePath: ${baseUrl}/config/plugins/${globals.GLOBAL_LIBRARIES_PLUGIN_CONFIG}
destPath: /var/jenkins_home/${globals.GLOBAL_LIBRARIES_PLUGIN_CONFIG}
- api:
- method: environment.file.ReplaceInBody
params:
path: /var/jenkins_home/${globals.GHPRBTRIGGER_PLUGIN_CONFIG}
pattern: GITHUB_CREDENTIAL_ID
replacement: ${globals.GITHUB_CREDENTIALS_ID}
nodeGroup: cp
- method: environment.file.ReplaceInBody
params:
path: /var/jenkins_home/${globals.GHPRBTRIGGER_PLUGIN_CONFIG}
pattern: GHPRB_SHARED_SECRET
replacement: ${settings.ghprbSecret}
nodeGroup: cp
- method: environment.file.ReplaceInBody
params:
path: /var/jenkins_home/${globals.GLOBAL_LIBRARIES_PLUGIN_CONFIG}
pattern: GITHUB_CREDENTIAL_ID
replacement: ${globals.GITHUB_CREDENTIALS_ID}
nodeGroup: cp
- restart
installAptPackages:
- installTools
installTools:
- cmd [cp]:
- apt install -y jq dos2unix sshpass
- installYarn
- installPickles
- installHasuraClient
- installPrecommit
installYarn:
cmd [cp]:
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- apt update
- apt install -y yarn nodejs
installPickles:
cmd [cp]:
- apt install -y mono-runtime mono-complete
- wget https://github.com/picklesdoc/pickles/releases/download/v2.20.1/Pickles-exe-2.20.1.zip
- unzip Pickles-exe-2.20.1.zip -d /opt/pickles
installHasuraClient:
cmd [cp]:
- wget https://github.com/hasura/graphql-engine/releases/download/v1.0.0-beta.9/cli-hasura-linux-amd64 -O /usr/local/bin/hasura
- chmod a+x /usr/local/bin/hasura
- hasura update-cli
installPrecommit:
cmd [cp]:
- apt install -y python3-pip
- pip3 install pre-commit
fillPasswordCredentials:
- api:
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: GLOBAL_OR_SYSTEM
replacement: ${this.globalOrSystem}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: CREDENTIAL_ID
replacement: ${this.credentialID}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: USERNAME
replacement: ${this.username}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: PASSWORD
replacement: ${this.password}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: DESCRIPTION
replacement: ${this.description}
nodeGroup: ${this.nodeGroup}
fillSecretCredentials:
- api:
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: GLOBAL_OR_SYSTEM
replacement: ${this.globalOrSystem}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: CREDENTIAL_ID
replacement: ${this.credentialID}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: SECRET
replacement: ${this.secret}
nodeGroup: ${this.nodeGroup}
- method: environment.file.ReplaceInBody
params:
path: ${this.filename}
pattern: DESCRIPTION
replacement: ${this.description}
nodeGroup: ${this.nodeGroup}
setupCredentials:
- cmd [cp]:
- cd /tmp
- wget --quiet ${baseUrl}/config/${globals.CREDENTIAL_FILENAME}
- cp ${globals.CREDENTIAL_FILENAME} ${globals.GITHUB_CREDENTIAL_FILENAME}
- cp ${globals.CREDENTIAL_FILENAME} ${globals.SOFTOZOR_CREDENTIAL_FILENAME}
- cp ${globals.CREDENTIAL_FILENAME} ${globals.DOCKER_CREDENTIAL_FILENAME}
- cp ${globals.CREDENTIAL_FILENAME} ${globals.JELASTIC_USER_CREDENTIAL_FILENAME}
- cp ${globals.CREDENTIAL_FILENAME} ${globals.JELASTIC_APP_CREDENTIAL_FILENAME}
- wget --quiet ${baseUrl}/config/${globals.SECRET_CREDENTIAL_FILENAME}
- cp ${globals.SECRET_CREDENTIAL_FILENAME} ${globals.SERVICES_CREDENTIAL_FILENAME}
- cp ${globals.SECRET_CREDENTIAL_FILENAME} ${globals.PRODUCT_CREDENTIAL_FILENAME}
- fillPasswordCredentials:
filename: /tmp/${globals.GITHUB_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.GITHUB_CREDENTIALS_ID}
username: ${settings.githubUsername}
password: ${settings.githubPassword}
description: Github credentials
nodeGroup: cp
- fillPasswordCredentials:
filename: /tmp/${globals.SOFTOZOR_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.SOFTOZOR_CREDENTIALS_ID}
username: ${settings.softozorUsername}
password: ${settings.softozorPassword}
description: Softozor.ch credentials
nodeGroup: cp
- fillPasswordCredentials:
filename: /tmp/${globals.DOCKER_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.DOCKER_CREDENTIALS_ID}
username: ${settings.dockerUsername}
password: ${settings.dockerPassword}
description: Docker hub credentials
nodeGroup: cp
- fillPasswordCredentials:
filename: /tmp/${globals.JELASTIC_USER_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.JELASTIC_USER_CREDENTIALS_ID}
username: ${settings.jelasticUsername}
password: ${settings.jelasticPassword}
description: Jelastic user credentials
nodeGroup: cp
- fillPasswordCredentials:
filename: /tmp/${globals.JELASTIC_APP_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.JELASTIC_APP_CREDENTIALS_ID}
username: ${settings.jelasticUrl}
password: ${settings.jelasticAppId}
description: Jelastic app credentials (hoster url and app id)
nodeGroup: cp
- fillSecretCredentials:
filename: /tmp/${globals.SERVICES_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.SERVICES_CREDENTIALS_ID}
secret: ${settings.jpsBaseUrl}
description: Base raw jps url of the services repo
nodeGroup: cp
- fillSecretCredentials:
filename: /tmp/${globals.PRODUCT_CREDENTIAL_FILENAME}
globalOrSystem: GLOBAL
credentialID: ${globals.PRODUCT_CREDENTIALS_ID}
secret: ${settings.productName}
description: Product name
nodeGroup: cp
- cmd [cp]:
- wget --quiet ${baseUrl}/scripts/${globals.CREDENTIAL_SCRIPT} -O /tmp/${globals.CREDENTIAL_SCRIPT}
- chmod u+x /tmp/${globals.CREDENTIAL_SCRIPT}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.GITHUB_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.SOFTOZOR_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.DOCKER_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.JELASTIC_USER_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.JELASTIC_APP_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.SERVICES_CREDENTIAL_FILENAME}
- /tmp/${globals.CREDENTIAL_SCRIPT} /tmp/${globals.PRODUCT_CREDENTIAL_FILENAME}
createUserAccounts:
- createUserAccount:
username: ${settings.username1}
password: ${globals.USER_PASSWORD1}
createUserAccount:
- cmd [cp]:
- cd /tmp
- wget --quiet ${baseUrl}/scripts/${globals.USER_ACCOUNT_CREATION_SCRIPT} -O /tmp/${globals.USER_ACCOUNT_CREATION_SCRIPT}
- chmod u+x /tmp/${globals.USER_ACCOUNT_CREATION_SCRIPT}
- /tmp/${globals.USER_ACCOUNT_CREATION_SCRIPT} "${this.username}" "${this.password}" "admin" "$(cat /var/jenkins_home/secrets/initialAdminPassword)"
secure:
- redirectHttpToHttps
- secureJenkinsConfiguration
- configureSSL
- installTrustedCertificate
redirectHttpToHttps:
- cmd [bl]:
- wget https://raw.githubusercontent.com/shopozor/jelastic-configuration/master/nginx/${settings.nginxVersion}/nginx-jelastic.conf -O /etc/nginx/nginx-jelastic.conf
user: root
secureJenkinsConfiguration:
- cmd [cp]:
- wget https://raw.githubusercontent.com/shopozor/jelastic-configuration/master/jenkins/web.xml -O /var/jenkins_home/war/WEB-INF/web.xml
configureSSL:
- installAddon:
id: letsencrypt
- cmd [bl]:
- wget https://raw.githubusercontent.com/shopozor/jelastic-configuration/master/nginx/${settings.nginxVersion}/conf.d/ssl.conf -O /etc/nginx/conf.d/ssl.conf
- replaceJenkinsPlaceholders:
filename: /etc/nginx/conf.d/ssl.conf
- cmd [bl]:
- openssl dhparam -out ${globals.DHPARAM_FILENAME} 4096
- replaceDhparamPlaceholders:
filename: /etc/nginx/conf.d/ssl.conf
replaceJenkinsPlaceholders:
- replaceInFile:
path: ${this.filename}
replacements:
- pattern: JENKINS_IP_ADDRESS
replacement: ${nodes.cp.intIP}
- pattern: JENKINS_PORT
replacement: ${settings.jenkinsPort}
nodeType: bl
replaceDhparamPlaceholders:
- replaceInFile:
path: ${this.filename}
replacements:
- pattern: PATH_TO_PEM_FILE
replacement: ${globals.DHPARAM_FILENAME}
nodeType: bl
installTrustedCertificate:
- installCertbot
# - getAndInstallCertificate
installCertbot:
- cmd [bl]:
- wget https://dl.eff.org/certbot-auto
- mv certbot-auto /usr/local/bin/certbot-auto
- chown root /usr/local/bin/certbot-auto
- chmod 0755 /usr/local/bin/certbot-auto
user: root
getAndInstallCertificate:
- cmd [bl]:
# This needs further arguments apparently + ssl.conf adaption?
- /usr/local/bin/certbot-auto --nginx
user: root
setupJobs:
# It was necessary to put the job setup in a separate jps.
# Putting the code written in the job-setup.jps here directly
# always fails for an unknown reason.
- install:
jps: ${baseUrl}/config/job-setup.jps
envName: ${env.envName}
settings:
username: admin
password: doYouReallyBelieveThisIsTheAdminPassword?
setupJobViews:
- cmd [cp]:
- mv /var/jenkins_home/config.xml /var/jenkins_home/config.xml.bak
- upload:
- nodeGroup: cp
sourcePath: ${baseUrl}/config/main-config.xml
destPath: /var/jenkins_home/config.xml
sendEmailWithPasswords:
return:
result: success
email: |
# User accounts
* **${settings.username1}**: ${globals.USER_PASSWORD1}
restart:
- restartContainers:
- nodeGroup: cp
- nodeGroup: bl
addons:
- id: letsencrypt
name: letsencrypt
onInstall:
- install:
envName: ${env.envName}
jps: https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps
settings:
nodeGroup: bl
customDomains: ${env.envName}.hidora.com
success: |
**Your environment Jenkins has been installed successfully.**