Skip to content

Commit 493c27d

Browse files
authored
Merge pull request #104 from majguo/use-wasservice-create-was-service
Fix issue 12, 96 and 101
2 parents f376a68 + d7c654a commit 493c27d

File tree

7 files changed

+38
-39
lines changed

7 files changed

+38
-39
lines changed

.github/workflows/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# Allows you to run this workflow using GitHub APIs
55
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>
66
# REPO_NAME=WASdev/azure.websphere-traditional.cluster
7-
# curl --verbose -XPOST -u "WASdev:${PERSONAL_ACCESS_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${REPO_NAME}/actions/workflows/package.yml/dispatches --data '{"ref": "master"}'
7+
# curl --verbose -XPOST -u "WASdev:${PERSONAL_ACCESS_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${REPO_NAME}/actions/workflows/package.yaml/dispatches --data '{"ref": "master"}'
88
repository_dispatch:
99
env:
1010
refArmttk: d97aa57d259e2fc8562e11501b1cf902265129d9

pom.xml

Lines changed: 2 additions & 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.18</version>
23+
<version>1.3.19</version>
2424

2525
<parent>
2626
<groupId>com.microsoft.azure.iaas</groupId>
@@ -36,6 +36,7 @@
3636
<test.parameters>-TestParameter '@{&quot;PasswordMinLength&quot;=6}'</test.parameters>
3737
<azure.apiVersion>2020-06-01</azure.apiVersion>
3838
<azure.apiVersion2>2019-06-01</azure.apiVersion2>
39+
<customer.usage.attribution.id>pid-fb16aee1-039d-45dc-a476-806224793a6c-partnercenter</customer.usage.attribution.id>
3940
<cluster.start>c2efe274-0dc2-50f3-b51f-338a3fe01afb</cluster.start>
4041
<cluster.end>9c5dbfce-a6b9-5659-96bc-ca0cf429122a</cluster.end>
4142
<ihs.start>5526bacf-3c35-57b7-8b22-337d78b4f478</ihs.start>

src/main/arm/mainTemplate.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,20 @@
229229
"ref_virtualNetwork": "[resourceId('Microsoft.Network/virtualNetworks', variables('name_virtualNetwork'))]"
230230
},
231231
"resources": [
232+
{
233+
"type": "Microsoft.Resources/deployments",
234+
"apiVersion": "${azure.apiVersion}",
235+
"name": "${customer.usage.attribution.id}",
236+
"properties": {
237+
"mode": "Incremental",
238+
"template": {
239+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
240+
"contentVersion": "1.0.0.0",
241+
"resources": [
242+
]
243+
}
244+
}
245+
},
232246
{
233247
"type": "Microsoft.Resources/deployments",
234248
"apiVersion": "${azure.apiVersion}",
@@ -251,10 +265,7 @@
251265
"sku": {
252266
"name": "Standard_LRS"
253267
},
254-
"kind": "Storage",
255-
"properties": {
256-
"supportsHttpsTrafficOnly": false
257-
}
268+
"kind": "Storage"
258269
},
259270
{
260271
"condition": "[parameters('configureIHS')]",

src/main/cli/deploy.azcli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fi
6363
if [[ -z "$resourceGroupName" ]]; then
6464
echo "This script will look for an existing resource group, otherwise a new one will be created "
6565
echo "You can create new resource groups with the CLI using: az group create "
66-
echo "Enter a resource group name"
66+
echo "Enter a resource group name:"
6767
read resourceGroupName
6868
[[ "${resourceGroupName:?}" ]]
6969
fi
@@ -113,13 +113,13 @@ set +e
113113
az group show --name $resourceGroupName 1> /dev/null
114114

115115
if [ $? != 0 ]; then
116-
echo "Resource group with name" $resourceGroupName "could not be found. Creating new resource group.."
116+
echo "Resource group with name" $resourceGroupName "could not be found. Creating new resource group..."
117117
set -e
118118
(
119119
set -x
120120
az group create --name $resourceGroupName --location $resourceGroupLocation 1> /dev/null
121121
)
122-
else
122+
else
123123
echo "Using existing resource group..."
124124
fi
125125
resourceGroupLocation=$( az group show --name $resourceGroupName | jq -r '.location' )

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ mkdir /etc/smbcredentials
3636
echo "username=$storageAccountName" > /etc/smbcredentials/${storageAccountName}.cred
3737
echo "password=$storageAccountKey" >> /etc/smbcredentials/${storageAccountName}.cred
3838
chmod 600 /etc/smbcredentials/${storageAccountName}.cred
39-
echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath cifs nofail,vers=2.1,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab
39+
echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath cifs nofail,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab
4040

41-
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o vers=2.1,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
41+
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
4242
if [[ $? != 0 ]]; then
4343
echo "Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath"
4444
exit 1

src/main/scripts/configure-ihs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ mkdir /etc/smbcredentials
134134
echo "username=$storageAccountName" > /etc/smbcredentials/${storageAccountName}.cred
135135
echo "password=$storageAccountKey" >> /etc/smbcredentials/${storageAccountName}.cred
136136
chmod 600 /etc/smbcredentials/${storageAccountName}.cred
137-
echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath cifs nofail,vers=2.1,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab
137+
echo "//${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath cifs nofail,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab
138138

139-
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o vers=2.1,credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
139+
mount -t cifs //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath -o credentials=/etc/smbcredentials/${storageAccountName}.cred,dir_mode=0777,file_mode=0777,serverino
140140
if [[ $? != 0 ]]; then
141141
echo "Failed to mount //${storageAccountName}.file.core.windows.net/${fileShareName} $mountpointPath"
142142
exit 1

src/main/scripts/install.sh

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,18 @@ add_admin_credentials_to_soap_client_props() {
6262
${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/PropFilePasswordEncoder.sh "$soapClientProps" com.ibm.SOAP.loginPassword
6363
}
6464

65-
create_systemd_service() {
66-
srvName=$1
67-
srvDescription=$2
68-
profileName=$3
69-
serverName=$4
70-
71-
# Add systemd unit file
72-
cat <<EOF > /etc/systemd/system/${srvName}.service
73-
[Unit]
74-
Description=${srvDescription}
75-
RequiresMountsFor=/datadrive
76-
[Service]
77-
Type=forking
78-
ExecStart=/bin/sh -c "${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/startServer.sh ${serverName}"
79-
ExecStop=/bin/sh -c "${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/bin/stopServer.sh ${serverName}"
80-
PIDFile=${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}/logs/${serverName}/${serverName}.pid
81-
SuccessExitStatus=143 0
82-
TimeoutStartSec=900
83-
[Install]
84-
WantedBy=default.target
85-
EOF
65+
create_was_service() {
66+
serverName=$1
67+
serviceName=${serverName}
68+
profileName=$2
69+
profilePath=${WAS_ND_INSTALL_DIRECTORY}/profiles/${profileName}
70+
71+
# Configure SELinux so systemctl has access on server start/stop script files
72+
semanage fcontext -a -t bin_t "${profilePath}/bin(/.*)?"
73+
restorecon -r -v ${profilePath}/bin
8674

87-
# Enable service
88-
systemctl daemon-reload
89-
systemctl enable "$srvName"
75+
# Add service
76+
${profilePath}/bin/wasservice.sh -add ${serviceName} -serverName ${serverName} -profilePath ${profilePath}
9077
}
9178

9279
create_cluster() {
@@ -282,7 +269,7 @@ source /datadrive/virtualimage.properties
282269
if [ "$dmgr" = True ]; then
283270
create_dmgr_profile Dmgr001 $(hostname) Dmgr001Node Dmgr001NodeCell "$adminUserName" "$adminPassword"
284271
add_admin_credentials_to_soap_client_props Dmgr001 "$adminUserName" "$adminPassword"
285-
create_systemd_service was_dmgr "IBM WebSphere Application Server ND Deployment Manager" Dmgr001 dmgr
272+
create_was_service dmgr Dmgr001
286273
${WAS_ND_INSTALL_DIRECTORY}/profiles/Dmgr001/bin/startServer.sh dmgr
287274
create_cluster Dmgr001 Dmgr001Node Dmgr001NodeCell MyCluster $members $dynamic
288275

@@ -293,5 +280,5 @@ if [ "$dmgr" = True ]; then
293280
else
294281
create_custom_profile Custom $(hostname) $(hostname)Node01 $dmgrHostName 8879 "$adminUserName" "$adminPassword"
295282
add_admin_credentials_to_soap_client_props Custom "$adminUserName" "$adminPassword"
296-
create_systemd_service was_nodeagent "IBM WebSphere Application Server ND Node Agent" Custom nodeagent
283+
create_was_service nodeagent Custom
297284
fi

0 commit comments

Comments
 (0)