* ARM templates - 7.7.3 support added. Pro and JCR

* ARM templates - Xray 3.8.2 support

* ARM templates - Nginx configuration changed for JCR

* ARM templates - Xray ARM extension script, yq added, Rabbitmq default password added

* ARM templates - Xray, Extension script changes

* ARM templates - RT readme updated, branch for extensions scripts switched back to master

* ARM templates - JCR, updated API, best practives

* ARM templates - Nginx configuration changed for JCR

* ARM templates - MP submissions, Xray installation script changes, master key minimun char number added in JCR

* ARM templates - Parameters draft
This commit is contained in:
Daniel Miakotkin
2020-09-08 13:35:04 -07:00
committed by GitHub
parent 31a0a8b830
commit d56935b274
25 changed files with 185 additions and 492 deletions

View File

@@ -123,13 +123,17 @@
"name": "xrayVersion",
"type": "Microsoft.Common.DropDown",
"label": "Xray-vm image version to deploy.",
"defaultValue": "3.6.2",
"defaultValue": "3.8.2",
"toolTip": "Version of Xray to deploy",
"constraints": {
"allowedValues": [
{
"label": "3.6.2",
"value": "0.0.3"
},
{
"label": "3.8.2",
"value": "0.0.4"
}
],
"required": true
@@ -158,7 +162,7 @@
"toolTip": "Master key for Xray instance. Generate master.key using command '$openssl rand -hex 16'",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,32}$",
"regex": "^[a-z0-9A-Z]{12,32}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
},
"options": {
@@ -175,7 +179,7 @@
"toolTip": "Join key from Artifactory cluster. You can copy Join key from the Artifactory UI, Security -> Settings -> Connection details",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,32}$",
"regex": "^[a-z0-9A-Z]{12,32}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
},
"options": {

View File

@@ -19,9 +19,10 @@
},
"xrayVersion": {
"type": "string",
"defaultValue": "0.0.3",
"defaultValue": "0.0.4",
"allowedValues": [
"0.0.3"
"0.0.3",
"0.0.4"
],
"metadata": {
"description": "Xray-vm image version to deploy."

View File

@@ -9,6 +9,11 @@ ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY
export DEBIAN_FRONTEND=noninteractive
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
# Create master.key on each node
sudo mkdir -p /opt/jfrog/xray/var/etc/security/
cat <<EOF >/opt/jfrog/xray/var/etc/security/master.key
@@ -18,13 +23,13 @@ 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)
sed -i -e "s/ip:..*/ip: ${HOSTNAME}/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s#jfrogUrl:..*#jfrogUrl: \"${ARTIFACTORY_URL}\"#" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/joinKey:..*/joinKey: ${JOIN_KEY}/" /var/opt/jfrog/xray/etc/system.yaml
# DB configuration
sed -i -e "s/url: postgres:..*/url: \"postgres:\/\/${DB_SERVER}.postgres.database.azure.com:5432\/${DB_NAME}?sslmode=disable\"/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/username:..*/username: \"${DB_USER}\"/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/password:..*/password: \"${DB_PASSWORD}\"/" /var/opt/jfrog/xray/etc/system.yaml
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.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}
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.node.ip ${HOSTNAME}
chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/

View File

@@ -1,389 +0,0 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
},
"vmName": {
"type": "string",
"metadata": {
"title": "VM Name",
"description": "This is the name of the your VM"
}
},
"xrayVersion": {
"type": "string",
"defaultValue": "3.5.2",
"allowedValues": [
"3.5.2"
],
"metadata": {
"description": "Xray-vm image version to deploy."
}
},
"artifactoryURL": {
"type": "string",
"metadata": {
"description": "Artifactory URL"
}
},
"masterKey": {
"type": "securestring",
"maxLength": 64,
"metadata": {
"description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'"
}
},
"joinKey": {
"type": "securestring",
"maxLength": 64,
"metadata": {
"description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'"
}
},
"adminUsername": {
"type": "string",
"defaultValue": "testadmin",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"virtualNetworkName": {
"type": "string",
"metadata": {
"description": "New or Existing VNet Name"
}
},
"virtualNetworkNewOrExisting": {
"type": "string",
"metadata": {
"description": "Boolean indicating whether the VNet is new or existing"
}
},
"virtualNetworkAddressPrefix": {
"type": "string",
"metadata": {
"description": "VNet address prefix"
}
},
"virtualNetworkResourceGroup": {
"type": "string",
"metadata": {
"description": "Resource group of the VNet"
}
},
"virtualMachineSize": {
"type": "string",
"metadata": {
"description": "The size of the VM"
}
},
"subnetName": {
"type": "string",
"metadata": {
"description": "New or Existing subnet Name"
}
},
"subnetAddressPrefix": {
"type": "string",
"metadata": {
"description": "Subnet address prefix"
}
},
"db_type": {
"type": "string",
"defaultValue": "Postgresql_deploy.json",
"allowedValues": [
"Postgresql_deploy.json",
"Postgresql_existing.json"
],
"metadata": {
"description": "Deploy new Postgresql, MSSQL or use existing DB"
}
},
"manual_db_url": {
"type": "string",
"metadata": {
"description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)"
}
},
"db_server": {
"type": "string",
"metadata": {
"description": "DB server name, if pre-existing DB is used"
}
},
"db_user": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database Admin user name"
}
},
"db_password": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Database Admin password"
}
},
"databases": {
"type": "object",
"defaultValue": {
"properties": [
{
"name": "xray",
"charset": "UTF8",
"collation": "English_United States.1252"
}
]
}
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
},
"defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/arm-xray/AzureResourceManager/Xray/"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
},
"defaultValue": ""
}
},
"variables": {
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]",
"publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]",
"vmName": "[parameters('vmName')]",
"nicName": "[concat(parameters('vmName'),'Nic')]",
"vnetId": {
"new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
"existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]"
},
"subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]",
"publicIPAddressType": "Dynamic",
"db_server": "[parameters('db_server')]",
"db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]",
"db_password": "[parameters('db_password')]",
"db_location": "[parameters('location')]",
"db_name": "[parameters('databases').properties[0].name]",
"masterKey": "[parameters('masterKey')]",
"joinKey": "[parameters('joinKey')]",
"osType": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"imageReference": "[variables('osType')]",
"dbTemplate": "[parameters('db_type')]",
"dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"artifactoryURL": "[parameters('artifactoryURL')]"
},
"resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"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",
"apiVersion": "2017-09-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('virtualNetworkAddressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetAddressPrefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"apiVersion": "2015-06-15",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"apiVersion": "2016-03-30",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetId')]"
}
}
}
],
"enableIPForwarding": true
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
]
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-11-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {}
},
{
"type": "Microsoft.Resources/deployments",
"name": "deploySQLDB",
"apiVersion": "2018-07-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('dbTemplateLocation')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"db_user": {
"value": "[parameters('db_user')]"
},
"db_password": {
"value": "[variables('db_password')]"
},
"db_server": {
"value": "[variables('db_server')]"
},
"db_location": {
"value": "[variables('db_location')]"
},
"databases": {
"value": "[parameters('databases')]"
},
"manual_db_url": {
"value": "[parameters('manual_db_url')]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2018-10-01",
"name": "[variables('vmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\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'))]"
},
"storageProfile": {
"imageReference": "[variables('imageReference')]",
"osDisk": {
"createOption": "FromImage"
},
"dataDisks": [
{
"diskSizeGB": 1023,
"lun": 0,
"createOption": "Empty"
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob]"
}
}
},
"resources": [
{
"apiVersion": "2019-03-01",
"type": "extensions",
"name": "config-app",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"tags": {
"displayName": "config-app"
},
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": true,
"settings": {
},
"protectedSettings": {
"commandToExecute": "echo 'hello!' >> /opt/installation_log.txt",
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('vm_install/install_xray_to_vm.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]"
]
}
}
}
]
}
]
}

View File

@@ -33,7 +33,7 @@
"value": "10.0.1.0/24"
},
"xrayVersion": {
"value": "0.0.3"
"value": "0.0.4"
},
"artifactoryURL": {
"value": "http://artifactory-url.cloudapp.azure.com"

View File

@@ -19,9 +19,10 @@
},
"xrayVersion": {
"type": "string",
"defaultValue": "0.0.3",
"defaultValue": "0.0.4",
"allowedValues": [
"0.0.3"
"0.0.3",
"0.0.4"
],
"metadata": {
"description": "Xray-vm image version to deploy."
@@ -156,7 +157,7 @@
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
},
"defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/arm-xray/AzureResourceManager/Xray/"
"defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/AzureResourceManager/Xray/"
},
"_artifactsLocationSasToken": {
"type": "securestring",
@@ -188,7 +189,7 @@
"joinKey": "[parameters('joinKey')]",
"osType": {
"publisher": "jfrog",
"offer": "x-ray-vm",
"offer": "x-ray-vm-preview",
"sku": "x-ray-vm",
"version": "[parameters('xrayVersion')]"
},
@@ -324,7 +325,7 @@
"plan": {
"name": "x-ray-vm",
"publisher": "jfrog",
"product": "x-ray-vm"
"product": "x-ray-vm-preview"
},
"sku": {
"name": "[parameters('virtualMachineSize')]",

View File

@@ -9,6 +9,11 @@ ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY
export DEBIAN_FRONTEND=noninteractive
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
# Create master.key on each node
sudo mkdir -p /opt/jfrog/xray/var/etc/security/
cat <<EOF >/opt/jfrog/xray/var/etc/security/master.key
@@ -18,13 +23,13 @@ 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)
sed -i -e "s/ip:..*/ip: ${HOSTNAME}/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s#jfrogUrl:..*#jfrogUrl: \"${ARTIFACTORY_URL}\"#" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/joinKey:..*/joinKey: ${JOIN_KEY}/" /var/opt/jfrog/xray/etc/system.yaml
# DB configuration
sed -i -e "s/url: postgres:..*/url: \"postgres:\/\/${DB_SERVER}.postgres.database.azure.com:5432\/${DB_NAME}?sslmode=disable\"/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/username:..*/username: \"${DB_USER}\"/" /var/opt/jfrog/xray/etc/system.yaml
sed -i -e "s/password:..*/password: \"${DB_PASSWORD}\"/" /var/opt/jfrog/xray/etc/system.yaml
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.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}
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.node.ip ${HOSTNAME}
chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Upgrade version for every release
XRAY_VERSION=3.6.2
XRAY_VERSION=3.8.2
export DEBIAN_FRONTEND=noninteractive
@@ -20,6 +20,7 @@ cd jfrog-xray-${XRAY_VERSION}-deb
cat <<EOF >/opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt
/var/opt/jfrog/xray
http://
Y
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
replace_with_host_ip
N