This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathinit-win10.bat
555 lines (477 loc) · 19.1 KB
/
init-win10.bat
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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
@ECHO OFF
setlocal
set PROJECT_HOME=%~dp0
set DOCKER_MAJOR_VER=17
set DOCKER_MINOR_VER=06
set OC_MAJOR_VER=v3
set OC_MINOR_VER=9
set OC_MINI_VER=14
set OCP_VERSION=%OC_MAJOR_VER%.%OC_MINOR_VER%
set STREAM_BRMS_63="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/decisionserver63-image-stream.json"
set STREAM_BRMS_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/decisionserver64-image-stream.json"
set STREAM_EAP_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/eap64-image-stream.json"
set STREAM_EAP_70="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/eap70-image-stream.json"
set STREAM_EAP_71="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/eap71-image-stream.json"
set STREAM_FUSE="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/fis-image-streams.json"
set STREAM_OPENJDK18="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/openjdk18-image-stream.json"
set STREAM_BPMS_63="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/processserver63-image-stream.json"
set STREAM_BPMS_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-streams/processserver64-image-stream.json"
set STREAM_DOTNET="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/image-streams/dotnet_imagestreams.json"
set STREAM_RHEL="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/image-streams/image-streams-rhel7.json"
set TEMPLATE_EAP70="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-templates/eap70-basic-s2i.json"
set TEMPLATE_EAP71="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-templates/eap71-basic-s2i.json"
set TEMPLATE_BRMS_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-templates/decisionserver64-basic-s2i.json"
set TEMPLATE_BPM_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-templates/processserver64-postgresql-s2i.json"
set TEMPLATE_BPM_DB_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.10/xpaas-templates/processserver64-postgresql-persistent-s2i.json"
REM uncomment amount memory needed, sets RAM usage limit for OCP, default 6 GB.
REM set VM_MEMORY=10240
set VM_MEMORY=6144
REM set VM_MEMORY=3072
REM wipe screen.
cls
echo.
echo ##############################################################
echo ## ##
echo ## Setting up your very own ##
echo ## ##
echo ## ### #### ##### # # #### # # ##### ##### ##### ##
echo ## # # # # # ## # # # # # # # ##
echo ## # # #### ### # # # ### ##### # #### # ##
echo ## # # # # # ## # # # # # # ##
echo ## ### # ##### # # #### # # ##### # # ##
echo ## ##
echo ## #### ### # # ##### ### ##### # # ##### ##### ##
echo ## # # # ## # # # # # ## # # # # ##
echo ## # # # # # # # ##### # # # # ### ##### ##
echo ## # # # # ## # # # # # ## # # # ##
echo ## #### ### # # # # # ##### # # ##### # # ##
echo ## ##
echo ## #### # ### ##### ##### ### ##### # # ##
echo ## # # # # # # # # # # # ## ## ##
echo ## #### # ##### # #### # # ##### # # # ##
echo ## # # # # # # # # # # # # ##
echo ## # ##### # # # # ### # # # # ##
echo ## ##
echo ## https://github.com/redhatdemocentral/ocp-install-demo ##
echo ## ##
echo ##############################################################
echo.
REM Ensure OpenShift command line tools available.
call oc help >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo OpenShift CLI tooling is required but not installed yet... download %OCP_VERSION% here: https://access.redhat.com/downloads/content/290
GOTO :EOF
) else (
echo OpenShift command line tools installed... checking for valid version...
echo.
)
REM Ensure docker-machine tool available.
call docker-machine -v >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Docker-machine tooling is required but not installed yet... instructions here: https://docs.docker.com/machine/install-machine/#install-machine-directly
GOTO :EOF
) else (
echo Docker-machine command line tools installed...
echo.
)
for /f "delims=*" %%i in ('oc version ^| findstr -i oc') do (
for /F "tokens=2 delims= " %%A in ('echo %%i') do (
set verFull=%%A
)
)
for /F "tokens=1,2,3 delims=." %%a in ('echo %verFull%') do (
set verone=%%a
set vertwo=%%b
set verthree=%%c
)
if %OC_MAJOR_VER% EQU %verone% if %OC_MINOR_VER% EQU %vertwo% if %OC_MINI_VER% EQU %verthree% (
echo Version of installed OpenShift command line tools correct... %verfull%
echo.
GOTO :passOcTestContinue
)
echo Version of installed OpenShift command line tools is %verone%.%vertwo%.%verthree%, must be %OC_MAJOR_VER%.%OC_MINOR_VER%.%OC_MINI_VER%...
echo.
echo Download for Windows here: https://access.redhat.com/downloads/content/290
GOTO :EOF
:passOcTestContinue
echo Setting up OpenShift docker machine...
echo.
call docker-machine create --driver hyperv --hyperv-cpu-count "2" --hyperv-memory %VM_MEMORY% --engine-insecure-registry 172.30.0.0/16 --hyperv-virtual-switch ocpNET --hyperv-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.13.1/boot2docker.iso openshift
if %ERRORLEVEL% EQU 0 (
echo.
echo Docker-Machine Install Good...
echo.
GOTO GoodMachine
)
echo.
echo Error occurred during openshift docker machine creation...
echo.
echo Cleaning out existing 'openshift' machine...
echo.
call docker-machine rm -f openshift
echo Setting up new OpenShift docker machine...
call docker-machine create --driver hyperv --hyperv-cpu-count "2" --hyperv-memory %VM_MEMORY% --engine-insecure-registry 172.30.0.0/16 --hyperv-virtual-switch ocpNET --hyperv-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.13.1/boot2docker.iso openshift
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with docker machine creation that I can't resolve, validate network configuration and/or please raise an issue and add error output:
echo.
echo https://github.com/redhatdemocentral/ocp-install-demo/issues/new
echo.
GOTO :EOF
)
:GoodMachine
echo Installing OCP with cluster up...
echo.
call oc cluster up --image=registry.access.redhat.com/openshift3/ose --host-data-dir=/var/lib/boot2docker/ocp-data --docker-machine=openshift --host-config-dir=/var/lib/boot2docker/ocp-config --use-existing-config=true --host-pv-dir=/var/lib/boot2docker/ocp-pv
if %ERRORLEVEL% EQU 0 (
echo.
echo OCP Good...
echo.
GOTO OCPGood
)
echo.
echo There was an issue starting OCP. Trying to recover...
echo.
call oc cluster down --docker-machine=openshift
call oc cluster up --image=registry.access.redhat.com/openshift3/ose --host-data-dir=/var/lib/boot2docker/ocp-data --docker-machine=openshift --host-config-dir=/var/lib/boot2docker/ocp-config --use-existing-config=true --host-pv-dir=/var/lib/boot2docker/ocp-pv
if %ERRORLEVEL% NEQ 0 (
echo.
echo There was an issue starting OCP. If you feel the need, raise an issue and add error output:
echo.
echo https://github.com/redhatdemocentral/ocp-install-demo/issues/new
echo.
GOTO :EOF
)
:OCPGood
echo.
echo Logging in as admin user...
echo.
oc login -u system:admin
for /f "delims=" %%i in ('oc status ^| findstr -i -c:"My Project"') do (
for /F "tokens=8 delims= " %%A in ('echo %%i') do (
set OCP_IP=%%A
)
)
echo Granting admin user full cluster-admin rights...
echo.
call oc adm policy add-cluster-role-to-user cluster-admin admin
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem granting admin user full cluster-admin rights.
echo.
GOTO :EOF
)
echo.
echo Granting rights to service catalog access...
echo.
oc adm policy add-cluster-role-to-group system:openshift:templateservicebroker-client system:unauthenticated system:authenticated
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem granting service catalog rights.
echo.
GOTO :EOF
)
echo.
echo Updating JBoss image streams.
REM Updating JBoss BRMS 6.3 image stream.
call oc delete -n openshift -f %STREAM_BRMS_63%
call oc create -n openshift -f %STREAM_BRMS_63%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BRMS 63 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_BRMS_63%
call oc create -n openshift -f %STREAM_BRMS_63%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating JBoss BPMS 6.3 image stream.
call oc delete -n openshift -f %STREAM_BPMS_63%
call oc create -n openshift -f %STREAM_BPMS_63%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BPMS 63 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_BPMS_63%
call oc create -n openshift -f %STREAM_BPMS_63%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating JBoss BRMS 6.4 image stream.
call oc delete -n openshift -f %STREAM_BRMS_64%
call oc create -n openshift -f %STREAM_BRMS_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BRMS 64 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_BRMS_64%
call oc create -n openshift -f %STREAM_BRMS_64%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating JBoss BPMS 6.4 image stream.
call oc delete -n openshift -f %STREAM_BPMS_64%
call oc create -n openshift -f %STREAM_BPMS_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BPMS 64 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_BPMS_64%
call oc create -n openshift -f %STREAM_BPMS_64%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating JBoss EAP 7.0 image stream.
call oc delete -n openshift -f %STREAM_EAP_70%
call oc create -n openshift -f %STREAM_EAP_70%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP 70 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_EAP_70%
call oc create -n openshift -f %STREAM_EAP_70%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating JBoss EAP 7.1 image stream.
call oc delete -n openshift -f %STREAM_EAP_71%
call oc create -n openshift -f %STREAM_EAP_71%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP 71 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_EAP_71%
call oc create -n openshift -f %STREAM_EAP_71%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating Fuse image streams.
call oc delete -n openshift -f %STREAM_FUSE%
call oc create -n openshift -f %STREAM_FUSE%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing Fuse Integration product streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_FUSE%
call oc create -n openshift -f %STREAM_FUSE%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating OPENJDK18 image stream.
call oc delete -n openshift -f %STREAM_OPENJDK18%
call oc create -n openshift -f %STREAM_OPENJDK18%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing OPENJDK18 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_OPENJDK18%
call oc create -n openshift -f %STREAM_OPENJDK18%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating EAP 7.0 template.
call oc delete -n openshift -f %TEMPLATE_EAP70%
call oc create -n openshift -f %TEMPLATE_EAP70%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP 70 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_EAP70%
call oc create -n openshift -f %TEMPLATE_EAP70%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating EAP 7.1 template.
call oc delete -n openshift -f %TEMPLATE_EAP71%
call oc create -n openshift -f %TEMPLATE_EAP71%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP 71 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_EAP71%
call oc create -n openshift -f %TEMPLATE_EAP71%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating Decision Server 6.4 template.
call oc delete -n openshift -f %TEMPLATE_BRMS_64%
call oc create -n openshift -f %TEMPLATE_BRMS_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BRMS 64 stream for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_BRMS_64%
call oc create -n openshift -f %TEMPLATE_BRMS_64%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating Process Server 6.4 template.
call oc delete -n openshift -f %TEMPLATE_BPM_64%
call oc create -n openshift -f %TEMPLATE_BPM_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BPM Suite 64 template for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_BPM_64%
call oc create -n openshift -f %TEMPLATE_BPM_64%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
REM Updating Process Server DB 6.4 template.
call oc delete -n openshift -f %TEMPLATE_BPM_DB_64%
call oc create -n openshift -f %TEMPLATE_BPM_DB_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BPM Suite DB 64 template for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_BPM_DB_64%
call oc create -n openshift -f %TEMPLATE_BPM_DB_64%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
echo.
echo Updating RHEL 7 image streams...
call oc delete -n openshift -f %STREAM_RHEL%
call oc create -n openshift -f %STREAM_RHEL%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing RHEL product streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_RHEL%
call oc create -n openshift -f %STREAM_RHEL%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
echo.
echo Update .Net image streams...
call oc delete -n openshift -f %STREAM_DOTNET%
call oc create -n openshift -f %STREAM_DOTNET%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing .Net image streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_DOTNET%
call oc create -n openshift -f %STREAM_DOTNET%
if %ERRORLEVELS% NEQ 0 (
echo Failed again, exiting, check output messages and network connectivity before running install again.
echo.
call docker-machine rm -f openshift
GOTO :EOF
)
)
echo.
echo ====================================================
echo = =
echo = Install complete, get ready to rock your Cloud. =
echo = Look for information at end of OSE install. =
echo = =
echo = The server is accessible via web console at: =
echo = =
echo = %OCP_IP% =
echo = =
echo = Log in as user: openshift-dev =
echo = password: devel =
echo = =
echo = Admin log in as: admin =
echo = password: admin =
echo = =
echo = Now get your Red Hat Demo Central example =
echo = projects here: =
echo = =
echo = https://github.com/redhatdemocentral =
echo = =
echo = To stop and restart your OCP cluster with =
echo = installed containers, see Readme.md in the =
echo = NOTES section for details. =
echo = =
echo = When finished, clean up your demo with: =
echo = =
echo = $ docker-machine rm -f openshift =
echo = =
echo ====================================================