forked from jbossdemocentral/bpms-install-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.ps1
177 lines (153 loc) · 8.07 KB
/
init.ps1
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
# wipe screen
Clear-Host
$PROJECT_HOME = $PSScriptRoot
$DEMO="Install Demo"
$AUTHORS="Andrew Block, Eric D. Schabell"
$PROJECT="git@github.com:jbossdemocentral/bpms-install-demo.git"
$PRODUCT="JBoss BPM Suite"
$TARGET="$PROJECT_HOME\target"
$JBOSS_HOME="$TARGET\jboss-eap-7.0"
$SERVER_DIR="$JBOSS_HOME\standalone\deployments\"
$SERVER_CONF="$JBOSS_HOME\standalone\configuration\"
$SERVER_BIN="$JBOSS_HOME\bin"
$SRC_DIR="$PROJECT_HOME\installs"
$SUPPORT_DIR="$PROJECT_HOME\support"
$PRJ_DIR="$PROJECT_HOME\projects"
$BPMS="jboss-bpmsuite-6.4.0.GA-deployable-eap7.x.zip"
$EAP="jboss-eap-7.0.0-installer.jar"
#$EAP_PATCH="jboss-eap-6.4.7-patch.zip"
$VERSION="6.4"
set NOPAUSE=true
Write-Host "#################################################################"
Write-Host "## ##"
Write-Host "## Setting up the %DEMO% ##"
Write-Host "## ##"
Write-Host "## ##"
Write-Host "## #### #### # # ### # # ##### ##### ##### ##"
Write-Host "## # # # # # # # # # # # # # # ##"
Write-Host "## #### #### # # # ## # # # # ### ##"
Write-Host "## # # # # # # # # # # # ##"
Write-Host "## #### # # # ### ##### ##### # ##### ##"
Write-Host "## ##"
Write-Host "## ##"
Write-Host "## brought to you by, ##"
Write-Host "## %AUTHORS% ##"
Write-Host "## %AUTHORS2% ##"
Write-Host "## ##"
Write-Host "## %PROJECT%##"
Write-Host "## ##"
Write-Host "#################################################################`n"
If (Test-Path "$SRC_DIR\$EAP") {
Write-Host "Product sources are present...`n"
} Else {
Write-Host "Need to download $EAP package from the Customer Support Portal"
Write-Host "and place it in the $SRC_DIR directory to proceed...`n"
exit
}
#If (Test-Path "$SRC_DIR\$EAP_PATCH") {
# Write-Host "Product patches are present...`n"
#} Else {
# Write-Host "Need to download $EAP_PATCH package from the Customer Support Portal"
# Write-Host "and place it in the $SRC_DIR directory to proceed...`n"
# exit
#}
If (Test-Path "$SRC_DIR\$BPMS") {
Write-Host "Product sources are present...`n"
} Else {
Write-Host "Need to download $BPMS package from the Customer Support Portal"
Write-Host "and place it in the $SRC_DIR directory to proceed...`n"
exit
}
#Test whether Java is available.
if ((Get-Command "java.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "The 'java' command is required but not available. Please install Java and add it to your PATH.`n"
exit
}
if ((Get-Command "javac.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "The 'javac' command is required but not available. Please install Java and add it to your PATH.`n"
exit
}
# Test whether 7Zip is available.
# We use 7Zip because it seems to be one of the few ways to extract the BPM Suite zip file without hitting the 260 character limit problem of the Windows API.
# This is definitely not ideal, but I can't unzip without problems when using the default Powershell unzip utilities.
# 7-Zip can be downloaded here: http://www.7-zip.org/download.html
if ((Get-Command "7z.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "The '7z.exe' command is required but not available. Please install 7-Zip.`n"
Write-Host "7-Zip is used to overcome the Windows 260 character limit on paths while extracting the JBoss BPM Suite ZIP file.`n"
Write-Host "7-Zip can be donwloaded here: http://www.7-zip.org/download.html`n"
Write-Host "Please make sure to add '7z.exe' to your 'PATH' after installation.`n"
exit
}
# Remove the old installation if it exists
If (Test-Path "$JBOSS_HOME") {
Write-Host "Removing existing installation.`n"
# The "\\?\" prefix is a trick to get around the 256 path-length limit in Windows.
# If we don't do this, the Remove-Item command fails when it tries to delete files with a name longer than 256 characters.
Remove-Item "\\?\$JBOSS_HOME" -Force -Recurse
}
#Run installers.
Write-Host "EAP installer running now...`n"
$argList = "-jar $SRC_DIR\$EAP $SUPPORT_DIR\installation-eap -variablefile $SUPPORT_DIR\installation-eap.variables"
$process = (Start-Process -FilePath java.exe -ArgumentList $argList -Wait -PassThru)
Write-Host "Process finished with return code: " $process.ExitCode
Write-Host "`n"
If ($process.ExitCode -ne 0) {
Write-Error "Error installing JBoss EAP."
exit
}
<#
Write-Host "Applying JBoss EAP patch now...`n"
Write-Host "The patch process will run in a separate window. Please wait for the 'Press any key to continue ...' message...`n"
$argList = '--command="patch apply ' + "$SRC_DIR\$EAP_PATCH" + ' --override-all"'
$patchProcess = (Start-Process -FilePath "$JBOSS_HOME\bin\jboss-cli.bat" -ArgumentList $argList -Wait -PassThru)
Write-Host "Process finished with return code: " $patchProcess.ExitCode
Write-Host ""
If ($patchProcess.ExitCode -ne 0) {
Write-Error "Error occurred during JBoss EAP patch installation."
exit
}
Write-Host "JBoss EAP patch applied succesfully!`n"
#>
Write-Host "Deploying JBoss BPM Suite now..."
# Using 7-Zip. This currently seems to be the only way to overcome the Windows 260 character path limit.
$argList = "x -o$TARGET -y $SRC_DIR\$BPMS"
$unzipProcess = (Start-Process -FilePath 7z.exe -ArgumentList $argList -Wait -PassThru -NoNewWindow)
If ($unzipProcess.ExitCode -ne 0) {
Write-Error "Error occurred during JBoss BPM Suite installation."
exit
}
Write-Host ""
Write-Host "- enabling demo accounts setup ...`n"
$argList1 = "-a -r ApplicationRealm -u bpmsAdmin -p 'bpmsuite1!' -ro 'analyst,admin,manager,user,kie-server,kiemgmt,rest-all' --silent"
$argList2 = "-a -r ApplicationRealm -u erics -p 'bpmsuite1!' -ro 'analyst,admin,manager,user,kie-server,kiemgmt,rest-all' --silent"
try {
Invoke-Expression "$JBOSS_HOME\bin\add-user.ps1 $argList1"
Invoke-Expression "$JBOSS_HOME\bin\add-user.ps1 $argList2"
} catch {
Write-Error "Error occurred during user account setup."
exit
}
Write-Host "- setting up standalone.xml configuration adjustments...`n"
Copy-Item "$SUPPORT_DIR\standalone.xml" "$SERVER_CONF" -force
Write-Host "- setup email task notification user...`n"
Copy-Item "$SUPPORT_DIR\userinfo.properties" "$SERVER_DIR\business-central.war\WEB-INF\classes\" -force
Write-Host "============================================================================"
Write-Host "= ="
Write-Host "= You can now start the $PRODUCT with: ="
Write-Host "= ="
Write-Host "= $SERVER_BIN\standalone.ps1 ="
Write-Host "= or ="
Write-Host "= $SERVER_BIN\standalone.bat ="
Write-Host "= ="
Write-Host "= Login into business central at: ="
Write-Host "= ="
Write-Host "= http://localhost:8080/business-central (u:bpmsAdmin / p:bpmsuite1!) ="
Write-Host "= ="
Write-Host "= See README.md for general details to run the various demo cases. ="
Write-Host "= ="
Write-Host "= $PRODUCT $VERSION $DEMO Setup Complete. ="
Write-Host "= ="
Write-Host "============================================================================"