Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion weblogic-azure-aks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.oracle.weblogic.azure</groupId>
<artifactId>wls-on-aks-azure-marketplace</artifactId>
<version>1.0.20</version>
<version>1.0.21</version>

<parent>
<groupId>com.microsoft.azure.iaas</groupId>
Expand Down
123 changes: 117 additions & 6 deletions weblogic-azure-aks/src/main/arm/createUiDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,10 @@
{
"label": "Azure SQL",
"value": "sqlserver"
},
{
"label": "Other",
"value": "otherdb"
}
],
"required": true
Expand All @@ -1685,7 +1689,7 @@
"toolTip": "The JNDI name for the database JDBC connection",
"defaultValue": "",
"constraints": {
"required": "[bool(steps('section_database').enableDB)]",
"required": true,
"regex": "^[a-zA-Z0-9./_-]{1,30}$",
"validationMessage": "The value must be 1-30 characters long and must only contain letters, numbers, hyphens (-), underscores (_), periods (.) and slashes (/)."
},
Expand All @@ -1698,10 +1702,62 @@
"toolTip": "The JDBC connection string for the database",
"defaultValue": "",
"constraints": {
"required": "[bool(steps('section_database').enableDB)]",
"required": true,
"regex": "[concat('^jdbc:', coalesce(steps('section_database').databaseConnectionInfo.databaseType, ''), '.*$')]",
"validationMessage": "A valid JDBC URL for the chosen database type must be provided"
},
"visible": "[and(bool(steps('section_database').enableDB), not(equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb')))]"
},
{
"name": "dsConnectionURL2",
"type": "Microsoft.Common.TextBox",
"label": "DataSource Connection String",
"toolTip": "The JDBC connection string for the database",
"defaultValue": "",
"constraints": {
"required": true,
"regex": "^jdbc:.*$",
"validationMessage": "A valid JDBC URL for the chosen database type must be provided"
},
"visible": "[and(bool(steps('section_database').enableDB), equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb'))]"
},
{
"name": "dbGlobalTranPro",
"type": "Microsoft.Common.DropDown",
"label": "Global transactions protocol",
"defaultValue": "EmulateTwoPhaseCommit",
"multiLine": true,
"toolTip": "Determines the transaction protocol (global transaction processing behavior) for the data source.",
"constraints": {
"allowedValues": [
{
"label": "TwoPhaseCommit",
"description": "Standard XA transaction processing. Requires an XA driver.",
"value": "TwoPhaseCommit"
},
{
"label": "LoggingLastResource",
"description": "A performance enhancement for one non-XA resource.",
"value": "LoggingLastResource"
},
{
"label": "EmulateTwoPhaseCommit",
"description": "Enables one non-XA resource to participate in a global transaction, but has some risk to data.",
"value": "EmulateTwoPhaseCommit"
},
{
"label": "OnePhaseCommit",
"description": "One-phase XA transaction processing using a non-XA driver. This is the default setting.",
"value": "OnePhaseCommit"
},
{
"label": "None",
"description": "Support for local transactions only.",
"value": "None"
}
],
"required": true
},
"visible": true
},
{
Expand All @@ -1711,7 +1767,7 @@
"toolTip": "Use only letters and numbers",
"defaultValue": "",
"constraints": {
"required": "[bool(steps('section_database').enableDB)]",
"required": true,
"regex": "^(?=.{1,128}$)[a-zA-Z](?!.*--)(?!.*@@)(?!.*-@)(?!.*@-)[a-zA-Z0-9-@]*[a-zA-Z0-9]$",
"validationMessage": "The value must be 1-128 characters long and must only contain letters, numbers, hyphen(-) and the at sign, no hyphen allowed at the beginning and the end of database username."
},
Expand All @@ -1726,14 +1782,65 @@
},
"toolTip": "Database Password",
"constraints": {
"required": "[bool(steps('section_database').enableDB)]",
"required": true,
"regex": "^((?=.*[0-9])(?=.*[a-zA-Z!@#$%^&*])).{5,128}$",
"validationMessage": "The password must be between 5 and 128 characters long and have at least one number."
},
"options": {
"hideConfirmation": false
},
"visible": true
},
{
"name": "dbDriverLibraries",
"type": "Microsoft.Common.FileUpload",
"label": "DataSource driver (.jar)",
"toolTip": "The datasource driver jar package for the specified database.",
"constraints": {
"required": true,
"accept": ".jar"
},
"options": {
"multiple": true,
"uploadMode": "url",
"openMode": "binary"
},
"visible": "[and(bool(steps('section_database').enableDB), equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb'))]"
},
{
"name": "dbDriverInfoBox",
"type": "Microsoft.Common.InfoBox",
"options": {
"icon": "Info",
"text": "WebLogic Server provides support for application data access to any database using a JDBC-compliant driver. Select here for more details.",
"uri": "https://aka.ms/wls-aks-dbdriver"
},
"visible": "[and(bool(steps('section_database').enableDB), equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb'))]"
},
{
"name": "dbDriverName",
"type": "Microsoft.Common.TextBox",
"label": "DataSource driver name",
"toolTip": "The driver name for the database",
"placeholder": "com.informix.jdbc.IfxDriver",
"constraints": {
"required": true,
"regex": "^[a-zA-Z_][a-zA-Z0-9_]+(\\.[a-zA-Z_][a-zA-Z0-9_]+){1,50}$",
"validationMessage": "A valid driver name for the chosen database type must be provided"
},
"visible": "[and(bool(steps('section_database').enableDB), equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb'))]"
},
{
"name": "dbTestTableName",
"type": "Microsoft.Common.TextBox",
"label": "Test table name",
"toolTip": "The name of the database table to use when testing physical database connections. ",
"constraints": {
"required": true,
"regex": "^.*$",
"validationMessage": "A test table name for the chosen database type must be provided"
},
"visible": "[and(bool(steps('section_database').enableDB), equals(steps('section_database').databaseConnectionInfo.databaseType, 'otherdb'))]"
}
],
"visible": "[bool(steps('section_database').enableDB)]"
Expand All @@ -1758,7 +1865,11 @@
"createACR": "[bool(steps('section_aks').imageInfo.oracleCreateACR)]",
"createAKSCluster": "[bool(steps('section_aks').clusterInfo.createAKSCluster)]",
"createDNSZone": "[not(bool(steps('section_dnsConfiguration').bringDNSZone))]",
"dbDriverLibrariesUrls": "[steps('section_database').databaseConnectionInfo.dbDriverLibraries]",
"dbDriverName": "[steps('section_database').databaseConnectionInfo.dbDriverName]",
"dbGlobalTranPro": "[steps('section_database').databaseConnectionInfo.dbGlobalTranPro]",
"dbPassword": "[steps('section_database').databaseConnectionInfo.dbPassword]",
"dbTestTableName": "[steps('section_database').databaseConnectionInfo.dbTestTableName]",
"dbUser": "[steps('section_database').databaseConnectionInfo.dbUser]",
"databaseType": "[steps('section_database').databaseConnectionInfo.databaseType]",
"dnszoneAdminConsoleLabel": "[steps('section_dnsConfiguration').dnszoneAdminConsoleLabel]",
Expand All @@ -1767,7 +1878,7 @@
"dnszoneClusterT3ChannelLabel": "[steps('section_dnsConfiguration').dnszoneClusterT3ChannelLabel]",
"dnszoneName": "[steps('section_dnsConfiguration').dnszoneName]",
"dnszoneRGName": "[steps('section_dnsConfiguration').dnsZoneResourceGroup]",
"dsConnectionURL": "[steps('section_database').databaseConnectionInfo.dsConnectionURL]",
"dsConnectionURL": "[coalesce(steps('section_database').databaseConnectionInfo.dsConnectionURL, steps('section_database').databaseConnectionInfo.dsConnectionURL2, 'null')]",
"enableAppGWIngress": "[steps('section_appGateway').appgwIngress.enableAppGateway]",
"enableAzureMonitoring": "[bool(steps('section_aks').clusterInfo.enableAzureMonitoring)]",
"enableAzureFileShare": "[bool(steps('section_aks').clusterInfo.enableAzureFileShare)]",
Expand Down Expand Up @@ -1823,4 +1934,4 @@
"wlsUserName": "[basics('basicsRequired').wlsUserName]"
}
}
}
}
37 changes: 36 additions & 1 deletion weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function read_sensitive_parameters_from_stdin() {

#Function to display usage message
function usage() {
echo "<azureACRPassword> <ocrSSOPSW> ./buildWLSDockerImage.sh ./buildWLSDockerImage.sh <wlsImagePath> <azureACRServer> <azureACRUserName> <imageTag> <appPackageUrls> <ocrSSOUser> <wlsClusterSize> <enableSSL> <enableAdminT3Tunneling> <enableClusterT3Tunneling>"
echo "<azureACRPassword> <ocrSSOPSW> | ./buildWLSDockerImage.sh <wlsImagePath> <azureACRServer> <azureACRUserName> <imageTag> <appPackageUrls> <ocrSSOUser> <wlsClusterSize> <enableSSL> <enableAdminT3Tunneling> <enableClusterT3Tunneling> <dbDriversUrls>"
if [ $1 -eq 1 ]; then
exit 1
fi
Expand Down Expand Up @@ -95,6 +95,11 @@ function validate_inputs() {
echo_stderr "enableClusterT3Tunneling is required. "
usage 1
fi

if [ -z "${dbDriversUrls}" ]; then
echo_stderr "dbDriversUrls is required. "
usage 1
fi
}

function initialize() {
Expand Down Expand Up @@ -169,6 +174,32 @@ function install_utilities() {
validate_status "Install mssql driver."
}

function install_db_drivers() {
if [ "${dbDriversUrls}" == "[]" ] || [ -z "${dbDriversUrls}" ]; then
return
fi

local dbDriversUrls=$(echo "${dbDriversUrls:1:${#dbDriversUrls}-2}")
local dbDriversUrlsArray=$(echo $dbDriversUrls | tr "," "\n")

for item in $dbDriversUrlsArray; do
echo ${item}
# e.g. https://wlsaksapp.blob.core.windows.net/japps/mariadb-java-client-2.7.4.jar?sp=r&se=2021-04-29T15:12:38Z&sv=2020-02-10&sr=b&sig=7grL4qP%2BcJ%2BLfDJgHXiDeQ2ZvlWosRLRQ1ciLk0Kl7M%3D
local urlWithoutQueryString="${item%\?*}"
echo $urlWithoutQueryString
local fileName="${urlWithoutQueryString##*/}"
echo $fileName

curl -m ${curlMaxTime} -fL "$item" -o ${scriptDir}/model-images/wlsdeploy/domainLibraries/${fileName}
if [ $? -ne 0 ];then
echo "Failed to download $item"
exit 1
fi

dbDriverPaths="${dbDriverPaths},'wlsdeploy/domainLibraries/${fileName}'"
done
}

# Login in OCR
# Pull weblogic image
function get_wls_image_from_ocr() {
Expand Down Expand Up @@ -288,8 +319,10 @@ export enableSSL=$8
export enableAdminT3Tunneling=$9
export enableClusterT3Tunneling=${10}
export useOracleImage=${11}
export dbDriversUrls=${12}

export acrImagePath="$azureACRServer/aks-wls-images:${imageTag}"
export dbDriverPaths=""
export ocrLoginServer="container-registry.oracle.com"
export wdtDownloadURL="https://github.com/oracle/weblogic-deploy-tooling/releases/download/release-1.9.17/weblogic-deploy.zip"
export witDownloadURL="https://github.com/oracle/weblogic-image-tool/releases/download/release-1.9.16/imagetool.zip"
Expand All @@ -304,6 +337,8 @@ initialize

install_utilities

install_db_drivers

if [[ "${useOracleImage,,}" == "${constTrue}" ]]; then
get_wls_image_from_ocr
else
Expand Down
15 changes: 12 additions & 3 deletions weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ function read_sensitive_parameters_from_stdin() {
read azureACRPassword ocrSSOPSW
}

function initialize() {
# initialize URL_3RD_DATASOURCE
if [ -z "${URL_3RD_DATASOURCE}" ];then
URL_3RD_DATASOURCE="[]"
fi
}

function cleanup_vm() {
#Remove VM resources
az extension add --name resource-graph
Expand Down Expand Up @@ -89,19 +96,19 @@ function build_docker_image() {
if [[ "${useOracleImage,,}" == "${constTrue}" ]]; then
wlsImagePath="${ocrLoginServer}/middleware/weblogic:${wlsImageTag}"
else
wlsImagePath="${userProvidedImagePath}"
wlsImagePath="${userProvidedImagePath}"
fi

echo "wlsImagePath: ${wlsImagePath}"

URL_3RD_DATASOURCE=$(echo $URL_3RD_DATASOURCE | tr -d "\"") # remove " from the string
az vm extension set --name CustomScript \
--extension-instance-name wls-image-script \
--resource-group ${currentResourceGroup} \
--vm-name ${vmName} \
--publisher Microsoft.Azure.Extensions \
--version 2.0 \
--settings "{ \"fileUris\": [\"${scriptURL}model.properties\",\"${scriptURL}genImageModel.sh\",\"${scriptURL}buildWLSDockerImage.sh\",\"${scriptURL}common.sh\"]}" \
--protected-settings "{\"commandToExecute\":\"echo ${azureACRPassword} ${ocrSSOPSW} | bash buildWLSDockerImage.sh ${wlsImagePath} ${azureACRServer} ${azureACRUserName} ${newImageTag} \\\"${appPackageUrls}\\\" ${ocrSSOUser} ${wlsClusterSize} ${enableCustomSSL} ${enableAdminT3Tunneling} ${enableClusterT3Tunneling} ${useOracleImage} \"}"
--protected-settings "{\"commandToExecute\":\"echo ${azureACRPassword} ${ocrSSOPSW} | bash buildWLSDockerImage.sh ${wlsImagePath} ${azureACRServer} ${azureACRUserName} ${newImageTag} \\\"${appPackageUrls}\\\" ${ocrSSOUser} ${wlsClusterSize} ${enableCustomSSL} ${enableAdminT3Tunneling} ${enableClusterT3Tunneling} ${useOracleImage} \\\"${URL_3RD_DATASOURCE}\\\" \"}"

cleanup_vm
}
Expand Down Expand Up @@ -132,6 +139,8 @@ export userProvidedImagePath=${14}

read_sensitive_parameters_from_stdin

initialize

build_docker_image


Expand Down
4 changes: 4 additions & 0 deletions weblogic-azure-aks/src/main/arm/scripts/dbUtility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function generate_ds_model() {
elif [[ "${databaseType}" == "${dbTypeSQLServer}" ]]; then
databaseDriver=${driverSQLServer}
databaseTestTableName=${testTableSQLServer}
elif [[ "${databaseType}" == "${dbTypeOthers}" ]]; then
databaseDriver=${DB_DRIVER_NAME}
databaseTestTableName=${TEST_TABLE_NAME}
fi

echo "generate data source model file"
Expand Down Expand Up @@ -152,6 +155,7 @@ export clusterName="cluster-1"
export dbTypeOracle="oracle"
export dbTypePostgre="postgresql"
export dbTypeSQLServer="sqlserver"
export dbTypeOthers="otherdb"
export driverOracle="oracle.jdbc.OracleDriver"
export driverPostgre="org.postgresql.Driver"
export driverSQLServer="com.microsoft.sqlserver.jdbc.SQLServerDriver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resources:
JNDIName: [
${jndiName}
]
GlobalTransactionsProtocol: EmulateTwoPhaseCommit
GlobalTransactionsProtocol: ${GLOBAL_TRANSATION_PROTOCOL}
JDBCDriverParams:
DriverName: ${driver}
URL: '@@SECRET:${secretName}:url@@'
Expand Down
2 changes: 1 addition & 1 deletion weblogic-azure-aks/src/main/arm/scripts/genImageModel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ domainInfo:
AdminUserName: "@@SECRET:__weblogic-credentials__:username@@"
AdminPassword: "@@SECRET:__weblogic-credentials__:password@@"
ServerStartMode: "prod"
domainLibraries: [ 'wlsdeploy/domainLibraries/postgresql-42.2.8.jar', 'wlsdeploy/domainLibraries/mssql-jdbc-7.4.1.jre8.jar']
domainLibraries: [ 'wlsdeploy/domainLibraries/postgresql-42.2.8.jar', 'wlsdeploy/domainLibraries/mssql-jdbc-7.4.1.jre8.jar'${dbDriverPaths}]

topology:
Name: "@@ENV:CUSTOM_DOMAIN_NAME@@"
Expand Down
Loading