From b2d8fe15d76145bdbfbb79791cfb398d0e7e8d50 Mon Sep 17 00:00:00 2001 From: Daniel Miakotkin <55418063+danielmkn@users.noreply.github.com> Date: Mon, 21 Sep 2020 13:26:57 -0700 Subject: [PATCH] Azure xray 3.8.5 (#42) * ARM templates - Xray config script, added value to support Azure Postgres service * ARM templates - Xray 3.8.5 * ARM templates - Xray, fixed bug in MP submission, removed Postgres workaround from README.md --- .../Xray/MP_submission/createUiDefinition.json | 6 +++++- .../Xray/MP_submission/mainTemplate.json | 8 +++++--- .../Xray/MP_submission/scripts/install_xray.sh | 2 ++ AzureResourceManager/Xray/README.md | 12 +----------- AzureResourceManager/Xray/azuredeploy_xray_vmss.json | 12 +++++++----- AzureResourceManager/Xray/scripts/install_xray.sh | 2 ++ .../Xray/vm_install/install_xray_to_vm.sh | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/AzureResourceManager/Xray/MP_submission/createUiDefinition.json b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json index 80c03e4..d4ca300 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.8.2", + "defaultValue": "3.8.5", "toolTip": "Version of Xray to deploy", "constraints": { "allowedValues": [ @@ -134,6 +134,10 @@ { "label": "3.8.2", "value": "0.0.4" + }, + { + "label": "3.8.5", + "value": "0.0.5" } ], "required": true diff --git a/AzureResourceManager/Xray/MP_submission/mainTemplate.json b/AzureResourceManager/Xray/MP_submission/mainTemplate.json index 391dcd4..4d0b228 100644 --- a/AzureResourceManager/Xray/MP_submission/mainTemplate.json +++ b/AzureResourceManager/Xray/MP_submission/mainTemplate.json @@ -19,10 +19,11 @@ }, "xrayVersion": { "type": "string", - "defaultValue": "0.0.4", + "defaultValue": "0.0.5", "allowedValues": [ "0.0.3", - "0.0.4" + "0.0.4", + "0.0.5" ], "metadata": { "description": "Xray-vm image version to deploy." @@ -182,6 +183,7 @@ "publicIPAddressType": "Dynamic", "db_server": "[parameters('db_server')]", "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "actual_db_user": "[parameters('db_user')]", "db_password": "[parameters('db_password')]", "db_location": "[parameters('location')]", "db_name": "[parameters('databases').properties[0].name]", @@ -351,7 +353,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'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\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'),'\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 95db4a2..f2195cf 100644 --- a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh +++ b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh @@ -1,6 +1,7 @@ #!/bin/bash DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +ACTUAL_DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ACTUAL_DB_ADMIN_USER=" | sed "s/ACTUAL_DB_ADMIN_USER=//") DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") @@ -25,6 +26,7 @@ EOF HOSTNAME=$(hostname -i) yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.url postgres://${DB_SERVER}.postgres.database.azure.com: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 yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.jfrogUrl ${ARTIFACTORY_URL} diff --git a/AzureResourceManager/Xray/README.md b/AzureResourceManager/Xray/README.md index 6c6a61e..766cc75 100644 --- a/AzureResourceManager/Xray/README.md +++ b/AzureResourceManager/Xray/README.md @@ -14,7 +14,7 @@ This template can help you setup [JFrog Xray](https://jfrog.com/xray/) on Azure 2. Deployed Postgresql instance (if "existing DB" is selected as a parameter). ## Postgresql deployment -Xray could fail to connect to "out of the box" Azure Postgresql. You can deploy a compatible Postgresql instance using this link: +You can deploy a compatible Postgresql instance using this link: @@ -33,16 +33,6 @@ In the Databases field, use the object: ] } ``` -Before deploying Xray, please do following steps: -1. Use the admin role given by Azure that you initially connected with to PSDB (for example xray) - Remember the password of this role to connect when setting up with Xray. - -2. Create a new role named xray@{hostname}, where {hostname} is a DB server name. - -3. Add xray@{hostname} membership to the base Azure user. In the client tab (PgAdmin for example) right click on properties of role "azure_pg_admin" and under Membership tab, add the relevant "xray@{hostname}", click on the checkbox on the tag, save. - -4. Change ownership of Xray database. Right click On the name of the database and change owner to "xray@{hostname}" - -After these steps are done, run Xray deployment. ## Installation 1. Click "Deploy to Azure" button. If you don't have an Azure subscription, it will guide you on how to signup for a free trial. diff --git a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json index a495022..e8c4339 100644 --- a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json +++ b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json @@ -19,10 +19,11 @@ }, "xrayVersion": { "type": "string", - "defaultValue": "0.0.4", + "defaultValue": "0.0.5", "allowedValues": [ "0.0.3", - "0.0.4" + "0.0.4", + "0.0.5" ], "metadata": { "description": "Xray-vm image version to deploy." @@ -182,6 +183,7 @@ "publicIPAddressType": "Dynamic", "db_server": "[parameters('db_server')]", "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "actual_db_user": "[parameters('db_user')]", "db_password": "[parameters('db_password')]", "db_location": "[parameters('location')]", "db_name": "[parameters('databases').properties[0].name]", @@ -189,7 +191,7 @@ "joinKey": "[parameters('joinKey')]", "osType": { "publisher": "jfrog", - "offer": "x-ray-vm-preview", + "offer": "x-ray-vm", "sku": "x-ray-vm", "version": "[parameters('xrayVersion')]" }, @@ -325,7 +327,7 @@ "plan": { "name": "x-ray-vm", "publisher": "jfrog", - "product": "x-ray-vm-preview" + "product": "x-ray-vm" }, "sku": { "name": "[parameters('virtualMachineSize')]", @@ -351,7 +353,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'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\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'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ diff --git a/AzureResourceManager/Xray/scripts/install_xray.sh b/AzureResourceManager/Xray/scripts/install_xray.sh index 95db4a2..f2195cf 100644 --- a/AzureResourceManager/Xray/scripts/install_xray.sh +++ b/AzureResourceManager/Xray/scripts/install_xray.sh @@ -1,6 +1,7 @@ #!/bin/bash DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +ACTUAL_DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ACTUAL_DB_ADMIN_USER=" | sed "s/ACTUAL_DB_ADMIN_USER=//") DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") @@ -25,6 +26,7 @@ EOF HOSTNAME=$(hostname -i) yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.url postgres://${DB_SERVER}.postgres.database.azure.com: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 yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.jfrogUrl ${ARTIFACTORY_URL} diff --git a/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh index 6827c90..191d4ab 100644 --- a/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh +++ b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh @@ -1,7 +1,7 @@ #!/bin/bash # Upgrade version for every release -XRAY_VERSION=3.8.2 +XRAY_VERSION=3.8.5 export DEBIAN_FRONTEND=noninteractive