forked from Sprbb/ocp-install-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-win10.bat
357 lines (309 loc) · 12.4 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
@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=7
set OC_MINI_VER=9
set OCP_VERSION=%OC_MAJOR_VER%.%OC_MINOR_VER%
set STREAM_JBOSS="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/xpaas-streams/jboss-image-streams.json"
set STREAM_FUSE="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/xpaas-streams/fis-image-streams.json"
set STREAM_RHEL="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/image-streams/image-streams-rhel7.json"
set STREAM_DOTNET="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/image-streams/dotnet_imagestreams.json"
set TEMPLATE_EAP="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/xpaas-templates/eap70-basic-s2i.json"
set TEMPLATE_BRMS_63="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.6/xpaas-templates/decisionserver63-basic-s2i.json"
set TEMPLATE_BRMS_64="https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v3.7/xpaas-templates/decisionserver64-basic-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.
)
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...
echo.
call oc delete -n openshift -f %STREAM_JBOSS%
call oc create -n openshift -f %STREAM_JBOSS%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP product streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %STREAM_JBOSS%
call oc create -n openshift -f %STREAM_JBOSS%
if %ERRORLEVEL% 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 Fuse image streams...
echo.
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 %ERRORLEVEL% 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 EAP templates...
echo.
call oc delete -n openshift -f %TEMPLATE_EAP%
call oc create -n openshift -f %TEMPLATE_EAP%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss EAP product streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_EAP%
call oc create -n openshift -f %TEMPLATE_EAP%
if %ERRORLEVEL% 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 Decision Server templates...
echo.
call oc delete -n openshift -f %TEMPLATE_BRMS_63%
call oc delete -n openshift -f %TEMPLATE_BRMS_64%
call oc create -n openshift -f %TEMPLATE_BRMS_63%
call oc create -n openshift -f %TEMPLATE_BRMS_64%
if %ERRORLEVEL% NEQ 0 (
echo.
echo Problem with accessing JBoss BRMS product streams for OCP.
echo.
echo Trying again.
echo.
call oc delete -n openshift -f %TEMPLATE_BRMS_63%
call oc delete -n openshift -f %TEMPLATE_BRMS_64%
call oc create -n openshift -f %TEMPLATE_BRMS_63%
call oc create -n openshift -f %TEMPLATE_BRMS_64%
if %ERRORLEVEL% 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...
echo.
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 %ERRORLEVEL% 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...
echo.
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 %ERRORLEVEL% 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 ====================================================