diff --git a/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json index 6eddd56..17eb95f 100644 --- a/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json +++ b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json @@ -132,7 +132,7 @@ "name": "artifactoryVersion", "type": "Microsoft.Common.DropDown", "label": "Artifactory-vm image version to deploy.", - "defaultValue": "7.21.8", + "defaultValue": "7.21.12", "toolTip": "Version of Artifactory to deploy", "constraints": { "allowedValues": [ @@ -179,6 +179,10 @@ { "label": "7.21.8", "value": "0.0.22" + }, + { + "label": "7.21.12", + "value": "0.0.23" } ], "required": true diff --git a/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json index d95209b..285706a 100644 --- a/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json +++ b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json @@ -79,7 +79,7 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "0.0.22", + "defaultValue": "0.0.23", "allowedValues": [ "0.0.8", "0.0.9", @@ -91,7 +91,8 @@ "0.0.18", "0.0.19", "0.0.21", - "0.0.22" + "0.0.22", + "0.0.23" ], "metadata": { "description": "Artifactory-vm image version to deploy." diff --git a/AzureResourceManager/Artifactory/azuredeploy.json b/AzureResourceManager/Artifactory/azuredeploy.json index dde2b3a..d6de6bd 100644 --- a/AzureResourceManager/Artifactory/azuredeploy.json +++ b/AzureResourceManager/Artifactory/azuredeploy.json @@ -79,7 +79,7 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "0.0.22", + "defaultValue": "0.0.23", "allowedValues": [ "0.0.8", "0.0.9", @@ -91,7 +91,8 @@ "0.0.18", "0.0.19", "0.0.21", - "0.0.22" + "0.0.22", + "0.0.23" ], "metadata": { "description": "Artifactory-vm image version to deploy." diff --git a/AzureResourceManager/Xray/MP_submission/createUiDefinition.json b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json index 7291b52..b4af6a5 100644 --- a/AzureResourceManager/Xray/MP_submission/createUiDefinition.json +++ b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json @@ -123,7 +123,7 @@ "name": "xrayVersion", "type": "Microsoft.Common.DropDown", "label": "Xray-vm image version to deploy.", - "defaultValue": "3.27.4", + "defaultValue": "3.29.0", "toolTip": "Version of Xray to deploy", "constraints": { "allowedValues": [ @@ -167,14 +167,18 @@ "label": "3.25.1", "value": "0.0.22" }, - { - "label": "3.27.2", - "value": "0.0.23" - }, - { - "label": "3.27.4", - "value": "0.0.24" - } + { + "label": "3.27.2", + "value": "0.0.23" + }, + { + "label": "3.27.4", + "value": "0.0.24" + }, + { + "label": "3.29.0", + "value": "0.0.25" + } ], "required": true }, diff --git a/AzureResourceManager/Xray/MP_submission/mainTemplate.json b/AzureResourceManager/Xray/MP_submission/mainTemplate.json index 83dce1a..2c178c9 100644 --- a/AzureResourceManager/Xray/MP_submission/mainTemplate.json +++ b/AzureResourceManager/Xray/MP_submission/mainTemplate.json @@ -19,20 +19,21 @@ }, "xrayVersion": { "type": "string", - "defaultValue": "0.0.24", + "defaultValue": "0.0.25", "allowedValues": [ "0.0.10", "0.0.11", "0.0.13", "0.0.14", - "0.0.15", - "0.0.17", - "0.0.18", - "0.0.20", - "0.0.21", - "0.0.22", - "0.0.23", - "0.0.24" + "0.0.15", + "0.0.17", + "0.0.18", + "0.0.20", + "0.0.21", + "0.0.22", + "0.0.23", + "0.0.24", + "0.0.25" ], "metadata": { "description": "Xray-vm image version to deploy." @@ -210,6 +211,19 @@ "artifactoryURL": "[parameters('artifactoryURL')]" }, "resources": [ + { + "apiVersion": "2020-06-01", + "name": "pid-650cbcf5-daa5-4038-88f1-aa87d58f8f1a-partnercenter", + "type": "Microsoft.Resources/deployments", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [] + } + } + }, { "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", "type": "Microsoft.Network/virtualNetworks", @@ -349,7 +363,7 @@ "computerNamePrefix": "[variables('namingInfix')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", - "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nACTUAL_DB_ADMIN_USER=',variables('actual_db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nLOCATION=',parameters('location'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nACTUAL_DB_ADMIN_USER=',variables('actual_db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nLOCATION=',parameters('location'),'\nCLUSTER_NAME=',parameters('clusterName'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ diff --git a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh index bee461f..6f0ef34 100644 --- a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh +++ b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh @@ -8,6 +8,7 @@ MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | s JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//") LOCATION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LOCATION=" | sed "s/LOCATION=//") ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_URL=" | sed "s/ARTIFACTORY_URL=//") +CLUSTER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CLUSTER_NAME=" | sed "s/CLUSTER_NAME=//") export DEBIAN_FRONTEND=noninteractive @@ -15,6 +16,7 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64 sudo add-apt-repository ppa:rmescandon/yq -y sudo apt update -y sudo apt install yq -y +sudo apt install nmap -y # Create master.key on each node sudo mkdir -p /opt/jfrog/xray/var/etc/security/ @@ -28,10 +30,7 @@ export PARTNER_ID=Partner/ACC-007221 export INTEGRATION_NAME=ARM_xray-template/1.0.0 EOF -# Xray should have the same join key as the Artifactory instance -# Both application should be deployed in the same Virtual Networks -HOSTNAME=$(hostname -i) - +# Verify if the app is deploying in GovCloud regex_location_gov="usgov.*" regex_location_dod="usdod.*" @@ -41,13 +40,35 @@ else DB_DOMAIN=azure.com fi +# Modify system.yaml file yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.url postgres://${DB_SERVER}.postgres.database.${DB_DOMAIN}:5432/${DB_NAME}?sslmode=disable yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.username ${DB_USER} yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.actualUsername ${ACTUAL_DB_USER} yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.password ${DB_PASSWORD} yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.password JFXR_RABBITMQ_COOKIE + +# RabbitMQ HA configuration for VMSS +HOSTNAME=$(hostname -s) +ACTIVE_NODE_NAME=$(echo "$HOSTNAME" | sed 's/......$/000000/') +printenv + +if [[ $HOSTNAME =~ 000000 ]]; +then + yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.erlangCookie.value JFXR_RABBITMQ_COOKIE +else + # Scan the subnet to verify if there are other Xray nodes + # Get the first Xray node name, modify to met RabbitMQ requirements, add into system.yaml + # Modify system.yaml to make a new RabbitMQ node able to connect to the cluster + ACTIVE_NODE_NAME=$(nmap -sn $(hostname -i)/24 | grep -i ${CLUSTER_NAME} | sort | awk 'NR==1{print $5}') + RABBITMQ_ACTIVE_NODE=$(cat /etc/hostname | sed 's/......$//g')$(echo $ACTIVE_NODE_NAME | cut -f1 -d"." | sed -e 's/\(^.*\)\(......$\)/\2/' | tr '[:lower:]' '[:upper:]') + yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.erlangCookie.value JFXR_RABBITMQ_COOKIE + yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.clean Y + yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.active.node.name ${RABBITMQ_ACTIVE_NODE} +fi +HOSTNAME=$(hostname -i) yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.jfrogUrl ${ARTIFACTORY_URL} yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.security.joinKey ${JOIN_KEY} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.security.masterKeyFile /opt/jfrog/xray/var/etc/security/master.key yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.node.ip ${HOSTNAME} chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/ diff --git a/AzureResourceManager/Xray/azuredeploy_xray.parameters.json b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json index 26822ae..073ad55 100644 --- a/AzureResourceManager/Xray/azuredeploy_xray.parameters.json +++ b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json @@ -33,7 +33,7 @@ "value": "10.0.1.0/24" }, "xrayVersion": { - "value": "0.0.24" + "value": "0.0.25" }, "artifactoryURL": { "value": "http://ARTIFACTORY-URL.cloudapp.azure.com" diff --git a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json index b15e0fa..d16195b 100644 --- a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json +++ b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json @@ -19,7 +19,7 @@ }, "xrayVersion": { "type": "string", - "defaultValue": "0.0.24", + "defaultValue": "0.0.25", "allowedValues": [ "0.0.10", "0.0.11", @@ -31,8 +31,9 @@ "0.0.20", "0.0.21", "0.0.22", - "0.0.23", - "0.0.24" + "0.0.23", + "0.0.24", + "0.0.25" ], "metadata": { "description": "Xray-vm image version to deploy." @@ -210,6 +211,19 @@ "artifactoryURL": "[parameters('artifactoryURL')]" }, "resources": [ + { + "apiVersion": "2020-06-01", + "name": "pid-650cbcf5-daa5-4038-88f1-aa87d58f8f1a-partnercenter", + "type": "Microsoft.Resources/deployments", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [] + } + } + }, { "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", "type": "Microsoft.Network/virtualNetworks", @@ -270,7 +284,7 @@ }, { "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2019-06-01", + "apiVersion": "2021-02-01", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", "sku": {