Skip to content

Commit 65f6b87

Browse files
authored
Merge pull request #106 from majguo/timestamps-for-different-deployment-stages
Add timestamps for profile creation, cluster creation and ihs configuration
2 parents 493c27d + c53fb92 commit 65f6b87

File tree

5 files changed

+71
-25
lines changed

5 files changed

+71
-25
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<groupId>com.ibm.websphere.azure</groupId>
2222
<artifactId>azure.websphere-traditional.cluster</artifactId>
23-
<version>1.3.19</version>
23+
<version>1.3.20</version>
2424

2525
<parent>
2626
<groupId>com.microsoft.azure.iaas</groupId>

src/main/arm/mainTemplate.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,23 @@
486486
"product": "${twasnd.image.offer}"
487487
}
488488
},
489+
{
490+
"type": "Microsoft.Resources/deployments",
491+
"apiVersion": "${azure.apiVersion}",
492+
"name": "clusterVMsCreated",
493+
"dependsOn": [
494+
"virtualMachineLoop"
495+
],
496+
"properties": {
497+
"mode": "Incremental",
498+
"template": {
499+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
500+
"contentVersion": "1.0.0.0",
501+
"resources": [
502+
]
503+
}
504+
}
505+
},
489506
{
490507
"type": "Microsoft.Compute/virtualMachines/extensions",
491508
"apiVersion": "${azure.apiVersion}",
@@ -649,6 +666,23 @@
649666
"product": "${ihs.image.offer}"
650667
}
651668
},
669+
{
670+
"type": "Microsoft.Resources/deployments",
671+
"apiVersion": "${azure.apiVersion}",
672+
"name": "ihsVMCreated",
673+
"dependsOn": [
674+
"[resourceId('Microsoft.Compute/virtualMachines/', variables('name_ihsVM'))]"
675+
],
676+
"properties": {
677+
"mode": "Incremental",
678+
"template": {
679+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
680+
"contentVersion": "1.0.0.0",
681+
"resources": [
682+
]
683+
}
684+
}
685+
},
652686
{
653687
"condition": "[parameters('configureIHS')]",
654688
"type": "Microsoft.Compute/virtualMachines/extensions",

src/main/scripts/configure-ihs-on-dmgr.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ storageAccountKey=$5
2828
fileShareName=$6
2929
mountpointPath=$7
3030

31+
echo "$(date): Start to configure IHS on dmgr."
32+
3133
source /datadrive/virtualimage.properties
3234

3335
# Mount Azure File Share system
@@ -40,7 +42,7 @@ echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpoint
4042

4143
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
4244
if [[ $? != 0 ]]; then
43-
echo "Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath"
45+
echo "$(date): Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath."
4446
exit 1
4547
fi
4648

@@ -52,15 +54,14 @@ do
5254
done
5355
mv $mountpointPath/configurewebserver1.sh $WAS_ND_INSTALL_DIRECTORY/bin
5456
if [[ $? != 0 ]]; then
55-
echo "Failed to move $mountpointPath/configurewebserver1.sh to $WAS_ND_INSTALL_DIRECTORY/bin"
57+
echo "$(date): Failed to move $mountpointPath/configurewebserver1.sh to $WAS_ND_INSTALL_DIRECTORY/bin."
5658
exit 1
5759
fi
5860

5961
# Get node name of IHS server
6062
read -r -a cmds <<<`(tail -n1) <$WAS_ND_INSTALL_DIRECTORY/bin/configurewebserver1.sh`
6163
nodeName=${cmds[14]}
6264
63-
echo "Configure IHS on the DMgr"
6465
$WAS_ND_INSTALL_DIRECTORY/bin/configurewebserver1.sh -profileName $profile -user $wasUser -password $wasPassword >/dev/null 2>&1
6566
rm -rf $WAS_ND_INSTALL_DIRECTORY/bin/configurewebserver1.sh
6667
@@ -73,3 +74,5 @@ $WAS_ND_INSTALL_DIRECTORY/bin/pluginutil.sh generate webserver1 $nodeName
7374
$WAS_ND_INSTALL_DIRECTORY/bin/pluginutil.sh propagate webserver1 $nodeName
7475
$WAS_ND_INSTALL_DIRECTORY/bin/pluginutil.sh propagateKeyring webserver1 $nodeName
7576
$WAS_ND_INSTALL_DIRECTORY/bin/pluginutil.sh restart webserver1 $nodeName
77+
78+
echo "$(date): Complete to configure IHS on dmgr."

src/main/scripts/configure-ihs.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,20 @@ EOF
4040
systemctl enable "$srvName"
4141
}
4242

43+
# Get IHS installation properties
44+
source /datadrive/virtualimage.properties
45+
4346
# Check whether the user is entitled or not
44-
while [ ! -f "/var/log/cloud-init-was.log" ]
47+
while [ ! -f "$WAS_LOG_PATH" ]
4548
do
4649
sleep 5
4750
done
4851

4952
isDone=false
5053
while [ $isDone = false ]
5154
do
52-
result=`(tail -n1) </var/log/cloud-init-was.log`
53-
if [[ $result = Entitled ]] || [[ $result = Unentitled ]] || [[ $result = Undefined ]]; then
55+
result=`(tail -n1) <$WAS_LOG_PATH`
56+
if [[ $result = $ENTITLED ]] || [[ $result = $UNENTITLED ]] || [[ $result = $UNDEFINED ]]; then
5457
isDone=true
5558
else
5659
sleep 5
@@ -61,8 +64,8 @@ done
6164
cloud-init clean --logs
6265

6366
# Terminate the process for the un-entitled or undefined user
64-
if [ ${result} != Entitled ]; then
65-
if [ ${result} = Unentitled ]; then
67+
if [ ${result} != $ENTITLED ]; then
68+
if [ ${result} = $UNENTITLED ]; then
6669
echo "The provided IBM ID does not have entitlement to install WebSphere Application Server. Please contact the primary or secondary contacts for your IBM Passport Advantage site to grant you access or follow steps at IBM eCustomer Care (https://ibm.biz/IBMidEntitlement) for further assistance."
6770
else
6871
echo "No WebSphere Application Server installation packages were found. This is likely due to a temporary issue with the installation repository. Try again and open an IBM Support issue if the problem persists."
@@ -85,8 +88,7 @@ storageAccountKey=$6
8588
fileShareName=$7
8689
mountpointPath=$8
8790

88-
# Get IHS installation properties
89-
source /datadrive/virtualimage.properties
91+
echo "$(date): Start to configure IHS."
9092

9193
# Open ports
9294
firewall-cmd --zone=public --add-port=80/tcp --permanent
@@ -138,13 +140,15 @@ echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpoint
138140

139141
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
140142
if [[ $? != 0 ]]; then
141-
echo "Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath"
143+
echo "$(date): Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath."
142144
exit 1
143145
fi
144146

145147
# Move the IHS confguration script to Azure File Share system
146148
mv $PLUGIN_INSTALL_DIRECTORY/bin/configurewebserver1.sh $mountpointPath
147149
if [[ $? != 0 ]]; then
148-
echo "Failed to move $PLUGIN_INSTALL_DIRECTORY/bin/configurewebserver1.sh to $mountpointPath"
150+
echo "$(date): Failed to move $PLUGIN_INSTALL_DIRECTORY/bin/configurewebserver1.sh to $mountpointPath."
149151
exit 1
150152
fi
153+
154+
echo "$(date): Complete to configure IHS."

src/main/scripts/install.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ create_dmgr_profile() {
4242
adminUserName=$5
4343
adminPassword=$6
4444

45+
echo "$(date): Start to create deployment manager profile."
4546
${WAS_ND_INSTALL_DIRECTORY}/bin/manageprofiles.sh -create -profileName ${profileName} -hostName $hostName \
4647
-templatePath ${WAS_ND_INSTALL_DIRECTORY}/profileTemplates/management -serverType DEPLOYMENT_MANAGER \
4748
-nodeName ${nodeName} -cellName ${cellName} -enableAdminSecurity true -adminUserName ${adminUserName} -adminPassword ${adminPassword}
49+
echo "$(date): Deployment manager profile created."
4850
}
4951

5052
add_admin_credentials_to_soap_client_props() {
@@ -84,6 +86,7 @@ create_cluster() {
8486
members=$5
8587
dynamic=$6
8688

89+
echo "$(date): Check if all nodes are managed."
8790
nodes=( $(${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/wsadmin.sh -lang jython -c "AdminConfig.list('Node')" \
8891
| grep -Po "(?<=\/nodes\/)[^|]*(?=|.*)" | grep -v $dmgrNode | sed 's/^/"/;s/$/"/') )
8992
while [ ${#nodes[@]} -ne $members ]
@@ -96,14 +99,14 @@ create_cluster() {
9699
sleep 60
97100

98101
if [ "$dynamic" = True ]; then
99-
echo "all nodes are managed, creating dynamic cluster..."
102+
echo "$(date): All nodes are managed, start to create dynamic cluster."
100103
cp create-dcluster.py create-dcluster.py.bak
101104
sed -i "s/\${CLUSTER_NAME}/${clusterName}/g" create-dcluster.py
102105
sed -i "s/\${NODE_GROUP_NAME}/DefaultNodeGroup/g" create-dcluster.py
103106
sed -i "s/\${CORE_GROUP_NAME}/DefaultCoreGroup/g" create-dcluster.py
104107
${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/wsadmin.sh -lang jython -f create-dcluster.py
105108
else
106-
echo "all nodes are managed, creating cluster..."
109+
echo "$(date): All nodes are managed, start to create cluster."
107110
nodes_string=$( IFS=,; echo "${nodes[*]}" )
108111
cp create-cluster.py create-cluster.py.bak
109112
sed -i "s/\${CELL_NAME}/${cellName}/g" create-cluster.py
@@ -112,7 +115,7 @@ create_cluster() {
112115
${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/wsadmin.sh -lang jython -f create-cluster.py
113116
fi
114117

115-
echo "cluster \"${clusterName}\" is successfully created!"
118+
echo "$(date): Cluster \"${clusterName}\" is successfully created."
116119
}
117120

118121
create_custom_profile() {
@@ -185,6 +188,7 @@ create_custom_profile() {
185188
dmgrAdminUserName=$6
186189
dmgrAdminPassword=$7
187190

191+
echo "$(date): Check if dmgr is ready."
188192
curl $dmgrHostName:$dmgrPort --output - >/dev/null 2>&1
189193
while [ $? -ne 56 ]
190194
do
@@ -193,7 +197,7 @@ create_custom_profile() {
193197
curl $dmgrHostName:$dmgrPort --output - >/dev/null 2>&1
194198
done
195199
sleep 60
196-
echo "dmgr is ready to add nodes"
200+
echo "$(date): Dmgr is ready, start to create custom profile."
197201

198202
output=$(${WAS_ND_INSTALL_DIRECTORY}/bin/manageprofiles.sh -create -profileName $profileName -hostName $hostName -nodeName $nodeName \
199203
-profilePath ${WAS_ND_INSTALL_DIRECTORY}/profiles/$profileName -templatePath ${WAS_ND_INSTALL_DIRECTORY}/profileTemplates/managed \
@@ -208,19 +212,23 @@ create_custom_profile() {
208212
-dmgrHost $dmgrHostName -dmgrPort $dmgrPort -dmgrAdminUserName $dmgrAdminUserName -dmgrAdminPassword $dmgrAdminPassword 2>&1)
209213
done
210214
echo $output
215+
echo "$(date): Custom profile created."
211216
}
212217

218+
# Get tWAS installation properties
219+
source /datadrive/virtualimage.properties
220+
213221
# Check whether the user is entitled or not
214-
while [ ! -f "/var/log/cloud-init-was.log" ]
222+
while [ ! -f "$WAS_LOG_PATH" ]
215223
do
216224
sleep 5
217225
done
218226

219227
isDone=false
220228
while [ $isDone = false ]
221229
do
222-
result=`(tail -n1) </var/log/cloud-init-was.log`
223-
if [[ $result = Entitled ]] || [[ $result = Unentitled ]] || [[ $result = Undefined ]]; then
230+
result=`(tail -n1) <$WAS_LOG_PATH`
231+
if [[ $result = $ENTITLED ]] || [[ $result = $UNENTITLED ]] || [[ $result = $UNDEFINED ]]; then
224232
isDone=true
225233
else
226234
sleep 5
@@ -231,8 +239,8 @@ done
231239
cloud-init clean --logs
232240

233241
# Terminate the process for the un-entitled or undefined user
234-
if [ ${result} != Entitled ]; then
235-
if [ ${result} = Unentitled ]; then
242+
if [ ${result} != $ENTITLED ]; then
243+
if [ ${result} = $UNENTITLED ]; then
236244
echo "The provided IBM ID does not have entitlement to install WebSphere Application Server. Please contact the primary or secondary contacts for your IBM Passport Advantage site to grant you access or follow steps at IBM eCustomer Care (https://ibm.biz/IBMidEntitlement) for further assistance."
237245
else
238246
echo "No WebSphere Application Server installation packages were found. This is likely due to a temporary issue with the installation repository. Try again and open an IBM Support issue if the problem persists."
@@ -262,9 +270,6 @@ storageAccountKey=$9
262270
fileShareName=${10}
263271
mountpointPath=${11}
264272

265-
# Get tWAS installation properties
266-
source /datadrive/virtualimage.properties
267-
268273
# Create cluster by creating deployment manager, node agent & add nodes to be managed
269274
if [ "$dmgr" = True ]; then
270275
create_dmgr_profile Dmgr001 $(hostname) Dmgr001Node Dmgr001NodeCell "$adminUserName" "$adminPassword"

0 commit comments

Comments
 (0)