diff --git a/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh index b292514..115fccf 100644 --- a/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh @@ -256,6 +256,17 @@ cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk rm /tmp/temp.key fi +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-pro-template/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* # start Artifactory diff --git a/AzureResourceManager/Artifactory/vm_install/vm_deploy.json b/AzureResourceManager/Artifactory/vm_install/vm_deploy.json new file mode 100644 index 0000000..f131e70 --- /dev/null +++ b/AzureResourceManager/Artifactory/vm_install/vm_deploy.json @@ -0,0 +1,265 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "String" + }, + "networkInterfaceName": { + "type": "String" + }, + "networkSecurityGroupName": { + "type": "String" + }, + "networkSecurityGroupRules": { + "type": "Array" + }, + "subnetName": { + "type": "String" + }, + "virtualNetworkName": { + "type": "String" + }, + "addressPrefixes": { + "type": "Array" + }, + "subnets": { + "type": "Array" + }, + "publicIpAddressName": { + "type": "String" + }, + "publicIpAddressType": { + "type": "String" + }, + "publicIpAddressSku": { + "type": "String" + }, + "virtualMachineName": { + "type": "String" + }, + "virtualMachineComputerName": { + "type": "String" + }, + "diskNameSalt": { + "type": "String" + }, + "storageAccountName": { + "type": "String" + }, + "virtualMachineSize": { + "type": "String" + }, + "adminUsername": { + "type": "String" + }, + "adminPassword": { + "type": "SecureString" + }, + "diagnosticsStorageAccountName": { + "type": "String" + }, + "diagnosticsStorageAccountId": { + "type": "String" + }, + "diagnosticsStorageAccountType": { + "type": "String" + }, + "diagnosticsStorageAccountKind": { + "type": "String" + }, + "_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/vm-image-templates/AzureResourceManager/Artifactory/" + }, + "_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": "" + }, + "artifactoryVersion": { + "type": "String" + }, + "scriptName": { + "type": "String" + }, + "baseTime": { + "type": "string", + "defaultValue": "[utcNow()]" + } + }, + "variables": { + "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", + "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", + "storageContainerUri": "[concat(concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/'), 'vhds/')]", + "scriptName": "[parameters('scriptName')]", + "commandToExecute": "[concat('bash ', variables('scriptName'), ' ', parameters('artifactoryVersion'))]", + "fileLocation": "[uri(parameters('_artifactsLocation'), concat('vm_install/', variables('scriptName'), parameters('_artifactsLocationSasToken')))]", + "diskNameSalt": "[concat(parameters('artifactoryVersion'), '-', parameters('baseTime'))]" + + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2019-07-01", + "name": "[parameters('networkInterfaceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", + "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", + "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[variables('subnetRef')]" + }, + "privateIPAllocationMethod": "Dynamic", + "publicIpAddress": { + "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[variables('nsgId')]" + } + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2019-02-01", + "name": "[parameters('networkSecurityGroupName')]", + "location": "[parameters('location')]", + "properties": { + "securityRules": "[parameters('networkSecurityGroupRules')]" + } + }, + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-09-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('addressPrefixes')]" + }, + "subnets": "[parameters('subnets')]" + } + }, + { + "type": "Microsoft.Network/publicIpAddresses", + "apiVersion": "2019-02-01", + "name": "[parameters('publicIpAddressName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('publicIpAddressSku')]" + }, + "properties": { + "publicIpAllocationMethod": "[parameters('publicIpAddressType')]" + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2019-07-01", + "name": "[parameters('virtualMachineName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", + "[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "fromImage", + "vhd": { + "uri": "[concat(variables('storageContainerUri'), parameters('virtualMachineName'), variables('diskNameSalt'), '.vhd')]" + }, + "name": "[parameters('virtualMachineName')]" + }, + "imageReference": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" + } + ] + }, + "osProfile": { + "computerName": "[parameters('virtualMachineComputerName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]" + } + } + }, + "resources":[ + { + "name": "extension1", + "type": "extensions", + "apiVersion": "2015-05-01-preview", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "[variables('fileLocation')]" + ], + "commandToExecute": "[variables('commandToExecute')]" + } + } + + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-06-01", + "name": "[parameters('diagnosticsStorageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('diagnosticsStorageAccountType')]" + }, + "kind": "[parameters('diagnosticsStorageAccountKind')]", + "properties": {} + } + ], + "outputs": { + "adminUsername": { + "type": "String", + "value": "[parameters('adminUsername')]" + }, + "commandTExecute": { + "type": "String", + "value": "[variables('commandToExecute')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/vm_install/vm_parameters.json b/AzureResourceManager/Artifactory/vm_install/vm_parameters.json new file mode 100644 index 0000000..9049765 --- /dev/null +++ b/AzureResourceManager/Artifactory/vm_install/vm_parameters.json @@ -0,0 +1,102 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "value": "westus2" + }, + "networkInterfaceName": { + "value": "rt-nic" + }, + "networkSecurityGroupName": { + "value": "rt-nsg" + }, + "networkSecurityGroupRules": { + "value": [ + { + "name": "SSH", + "properties": { + "priority": 300, + "protocol": "TCP", + "access": "Allow", + "direction": "Inbound", + "sourceAddressPrefix": "*", + "sourcePortRange": "*", + "destinationAddressPrefix": "*", + "destinationPortRange": "22" + } + } + ] + }, + "subnetName": { + "value": "default" + }, + "virtualNetworkName": { + "value": "artifactory-vm-test-vnet" + }, + "addressPrefixes": { + "value": [ + "10.0.0.0/24" + ] + }, + "subnets": { + "value": [ + { + "name": "default", + "properties": { + "addressPrefix": "10.0.0.0/24" + } + } + ] + }, + "publicIpAddressName": { + "value": "rt-public-ip" + }, + "publicIpAddressType": { + "value": "Dynamic" + }, + "publicIpAddressSku": { + "value": "Basic" + }, + "virtualMachineName": { + "value": "artifactory-vm" + }, + "virtualMachineComputerName": { + "value": "rtvm" + }, + "diskNameSalt": { + "value": "20200824153005" + }, + "storageAccountName": { + "value": "mpstoragevhd" + }, + "virtualMachineSize": { + "value": "Standard_B4ms" + }, + + "diagnosticsStorageAccountName": { + "value": "artifactoryvmtestdiag" + }, + "diagnosticsStorageAccountId": { + "value": "Microsoft.Storage/storageAccounts/artifactoryvmtestdiag" + }, + "diagnosticsStorageAccountType": { + "value": "Standard_LRS" + }, + "diagnosticsStorageAccountKind": { + "value": "Storage" + }, + "adminUsername": { + "value": "vmuser" + }, + "adminPassword": { + "value": "OWERWRITE_THE_PASSWORD" + }, + "artifactoryVersion": { + "value": "7.10.2" + }, + "scriptName": { + "value": "install_pro7_to_vm.sh" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh index 9884bae..ba73852 100644 --- a/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh +++ b/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh @@ -160,6 +160,17 @@ cat </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml EOF +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-jcr-template/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem rm /tmp/temp.pem diff --git a/AzureResourceManager/JCR/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/scripts/install_artifactory7.sh index 9884bae..ba73852 100644 --- a/AzureResourceManager/JCR/scripts/install_artifactory7.sh +++ b/AzureResourceManager/JCR/scripts/install_artifactory7.sh @@ -160,6 +160,17 @@ cat </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml EOF +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-jcr-template/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem rm /tmp/temp.pem diff --git a/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh b/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh index 00e3894..fcdc03a 100644 --- a/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh +++ b/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh @@ -1,7 +1,7 @@ #!/bin/bash # Upgrade version for every release -ARTIFACTORY_VERSION=7.7.3 +ARTIFACTORY_VERSION=$1 UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//") export DEBIAN_FRONTEND=noninteractive @@ -25,7 +25,7 @@ apt-get -y install jfrog-artifactory-jcr=${ARTIFACTORY_VERSION} >> /tmp/install- mkdir -p /var/opt/jfrog/artifactory/etc/info cat </var/opt/jfrog/artifactory/etc/info/installer-info.json { - "productId": "ARM_artifactory-jcr/1.0.0", + "productId": "ARM_artifactory-jcr-vm/1.0.0", "features": [ { "featureId": "Partner/ACC-007221" diff --git a/AzureResourceManager/JCR/vm_install/vm_deploy.json b/AzureResourceManager/JCR/vm_install/vm_deploy.json new file mode 100644 index 0000000..035a169 --- /dev/null +++ b/AzureResourceManager/JCR/vm_install/vm_deploy.json @@ -0,0 +1,262 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "String" + }, + "networkInterfaceName": { + "type": "String" + }, + "networkSecurityGroupName": { + "type": "String" + }, + "networkSecurityGroupRules": { + "type": "Array" + }, + "subnetName": { + "type": "String" + }, + "virtualNetworkName": { + "type": "String" + }, + "addressPrefixes": { + "type": "Array" + }, + "subnets": { + "type": "Array" + }, + "publicIpAddressName": { + "type": "String" + }, + "publicIpAddressType": { + "type": "String" + }, + "publicIpAddressSku": { + "type": "String" + }, + "virtualMachineName": { + "type": "String" + }, + "virtualMachineComputerName": { + "type": "String" + }, + "storageAccountName": { + "type": "String" + }, + "virtualMachineSize": { + "type": "String" + }, + "adminUsername": { + "type": "String" + }, + "adminPassword": { + "type": "SecureString" + }, + "diagnosticsStorageAccountName": { + "type": "String" + }, + "diagnosticsStorageAccountId": { + "type": "String" + }, + "diagnosticsStorageAccountType": { + "type": "String" + }, + "diagnosticsStorageAccountKind": { + "type": "String" + }, + "_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/vm-image-templates/AzureResourceManager/JCR/" + }, + "_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": "" + }, + "artifactoryVersion": { + "type": "String" + }, + "scriptName": { + "type": "String" + }, + "baseTime": { + "type": "string", + "defaultValue": "[utcNow()]" + } + }, + "variables": { + "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", + "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", + "storageContainerUri": "[concat(concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/'), 'vhds/')]", + "scriptName": "[parameters('scriptName')]", + "commandToExecute": "[concat('bash ', variables('scriptName'), ' ', parameters('artifactoryVersion'))]", + "fileLocation": "[uri(parameters('_artifactsLocation'), concat('vm_install/', variables('scriptName'), parameters('_artifactsLocationSasToken')))]", + "diskNameSalt": "[concat(parameters('artifactoryVersion'), '-', parameters('baseTime'))]" + + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2019-07-01", + "name": "[parameters('networkInterfaceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", + "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", + "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[variables('subnetRef')]" + }, + "privateIPAllocationMethod": "Dynamic", + "publicIpAddress": { + "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[variables('nsgId')]" + } + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2019-02-01", + "name": "[parameters('networkSecurityGroupName')]", + "location": "[parameters('location')]", + "properties": { + "securityRules": "[parameters('networkSecurityGroupRules')]" + } + }, + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-09-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('addressPrefixes')]" + }, + "subnets": "[parameters('subnets')]" + } + }, + { + "type": "Microsoft.Network/publicIpAddresses", + "apiVersion": "2019-02-01", + "name": "[parameters('publicIpAddressName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('publicIpAddressSku')]" + }, + "properties": { + "publicIpAllocationMethod": "[parameters('publicIpAddressType')]" + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2019-07-01", + "name": "[parameters('virtualMachineName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", + "[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "fromImage", + "vhd": { + "uri": "[concat(variables('storageContainerUri'), parameters('virtualMachineName'), variables('diskNameSalt'), '.vhd')]" + }, + "name": "[parameters('virtualMachineName')]" + }, + "imageReference": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" + } + ] + }, + "osProfile": { + "computerName": "[parameters('virtualMachineComputerName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]" + } + } + }, + "resources":[ + { + "name": "extension1", + "type": "extensions", + "apiVersion": "2015-05-01-preview", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "[variables('fileLocation')]" + ], + "commandToExecute": "[variables('commandToExecute')]" + } + } + + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-06-01", + "name": "[parameters('diagnosticsStorageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('diagnosticsStorageAccountType')]" + }, + "kind": "[parameters('diagnosticsStorageAccountKind')]", + "properties": {} + } + ], + "outputs": { + "adminUsername": { + "type": "String", + "value": "[parameters('adminUsername')]" + }, + "commandTExecute": { + "type": "String", + "value": "[variables('commandToExecute')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/vm_install/vm_parameters.json b/AzureResourceManager/JCR/vm_install/vm_parameters.json new file mode 100644 index 0000000..41388d6 --- /dev/null +++ b/AzureResourceManager/JCR/vm_install/vm_parameters.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "value": "westus2" + }, + "networkInterfaceName": { + "value": "jcr-nic" + }, + "networkSecurityGroupName": { + "value": "jcr-nsg" + }, + "networkSecurityGroupRules": { + "value": [ + { + "name": "SSH", + "properties": { + "priority": 300, + "protocol": "TCP", + "access": "Allow", + "direction": "Inbound", + "sourceAddressPrefix": "*", + "sourcePortRange": "*", + "destinationAddressPrefix": "*", + "destinationPortRange": "22" + } + } + ] + }, + "subnetName": { + "value": "default" + }, + "virtualNetworkName": { + "value": "jcr-vm-test-vnet" + }, + "addressPrefixes": { + "value": [ + "10.0.0.0/24" + ] + }, + "subnets": { + "value": [ + { + "name": "default", + "properties": { + "addressPrefix": "10.0.0.0/24" + } + } + ] + }, + "publicIpAddressName": { + "value": "jcr-public-ip" + }, + "publicIpAddressType": { + "value": "Dynamic" + }, + "publicIpAddressSku": { + "value": "Basic" + }, + "virtualMachineName": { + "value": "jcr-vm" + }, + "virtualMachineComputerName": { + "value": "jcrvm" + }, + "storageAccountName": { + "value": "mpstoragevhd" + }, + "virtualMachineSize": { + "value": "Standard_B4ms" + }, + + "diagnosticsStorageAccountName": { + "value": "jcrvmtestdiag" + }, + "diagnosticsStorageAccountId": { + "value": "Microsoft.Storage/storageAccounts/jcrvmtestdiag" + }, + "diagnosticsStorageAccountType": { + "value": "Standard_LRS" + }, + "diagnosticsStorageAccountKind": { + "value": "Storage" + }, + "adminUsername": { + "value": "vmuser" + }, + "adminPassword": { + "value": "OWERWRITE_THE_PASSWORD" + }, + "artifactoryVersion": { + "value": "7.10.2" + }, + "scriptName": { + "value": "install_jcr7_to_vm.sh" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh index f2195cf..2a4988f 100644 --- a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh +++ b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh @@ -21,6 +21,12 @@ cat </opt/jfrog/xray/var/etc/security/master.key ${MASTER_KEY} EOF +# Add Template Callhome to the Xray instance +cat <>/opt/jfrog/xray/app/bin/xray.default +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) diff --git a/AzureResourceManager/Xray/scripts/install_xray.sh b/AzureResourceManager/Xray/scripts/install_xray.sh index f2195cf..2a4988f 100644 --- a/AzureResourceManager/Xray/scripts/install_xray.sh +++ b/AzureResourceManager/Xray/scripts/install_xray.sh @@ -21,6 +21,12 @@ cat </opt/jfrog/xray/var/etc/security/master.key ${MASTER_KEY} EOF +# Add Template Callhome to the Xray instance +cat <>/opt/jfrog/xray/app/bin/xray.default +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) diff --git a/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh index 191d4ab..e3fc408 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.5 +XRAY_VERSION=$1 export DEBIAN_FRONTEND=noninteractive @@ -33,10 +33,10 @@ EOF # Run interactive installation script with default parameters cat "/opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt" | ./install.sh >> /var/log/install-xray.log 2>&1 -# Add Callhome to the Xray instance +# Add VM image Callhome to the Xray instance cat <>/opt/jfrog/xray/app/bin/xray.default export PARTNER_ID=Partner/ACC-007221 -export INTEGRATION_NAME=ARM_xray/1.0.0 +export INTEGRATION_NAME=ARM_xray-vm/1.0.0 EOF # Remove Xray service from boot up run diff --git a/AzureResourceManager/Xray/vm_install/vm_deploy.json b/AzureResourceManager/Xray/vm_install/vm_deploy.json new file mode 100644 index 0000000..ed1ef10 --- /dev/null +++ b/AzureResourceManager/Xray/vm_install/vm_deploy.json @@ -0,0 +1,262 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "String" + }, + "networkInterfaceName": { + "type": "String" + }, + "networkSecurityGroupName": { + "type": "String" + }, + "networkSecurityGroupRules": { + "type": "Array" + }, + "subnetName": { + "type": "String" + }, + "virtualNetworkName": { + "type": "String" + }, + "addressPrefixes": { + "type": "Array" + }, + "subnets": { + "type": "Array" + }, + "publicIpAddressName": { + "type": "String" + }, + "publicIpAddressType": { + "type": "String" + }, + "publicIpAddressSku": { + "type": "String" + }, + "virtualMachineName": { + "type": "String" + }, + "virtualMachineComputerName": { + "type": "String" + }, + "storageAccountName": { + "type": "String" + }, + "virtualMachineSize": { + "type": "String" + }, + "adminUsername": { + "type": "String" + }, + "adminPassword": { + "type": "SecureString" + }, + "diagnosticsStorageAccountName": { + "type": "String" + }, + "diagnosticsStorageAccountId": { + "type": "String" + }, + "diagnosticsStorageAccountType": { + "type": "String" + }, + "diagnosticsStorageAccountKind": { + "type": "String" + }, + "_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/vm-image-templates/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": "" + }, + "artifactoryVersion": { + "type": "String" + }, + "scriptName": { + "type": "String" + }, + "baseTime": { + "type": "string", + "defaultValue": "[utcNow()]" + } + }, + "variables": { + "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", + "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", + "storageContainerUri": "[concat(concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/'), 'vhds/')]", + "scriptName": "[parameters('scriptName')]", + "commandToExecute": "[concat('bash ', variables('scriptName'), ' ', parameters('artifactoryVersion'))]", + "fileLocation": "[uri(parameters('_artifactsLocation'), concat('vm_install/', variables('scriptName'), parameters('_artifactsLocationSasToken')))]", + "diskNameSalt": "[concat(parameters('artifactoryVersion'), '-', parameters('baseTime'))]" + + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2019-07-01", + "name": "[parameters('networkInterfaceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", + "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", + "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[variables('subnetRef')]" + }, + "privateIPAllocationMethod": "Dynamic", + "publicIpAddress": { + "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[variables('nsgId')]" + } + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2019-02-01", + "name": "[parameters('networkSecurityGroupName')]", + "location": "[parameters('location')]", + "properties": { + "securityRules": "[parameters('networkSecurityGroupRules')]" + } + }, + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-09-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('addressPrefixes')]" + }, + "subnets": "[parameters('subnets')]" + } + }, + { + "type": "Microsoft.Network/publicIpAddresses", + "apiVersion": "2019-02-01", + "name": "[parameters('publicIpAddressName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('publicIpAddressSku')]" + }, + "properties": { + "publicIpAllocationMethod": "[parameters('publicIpAddressType')]" + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2019-07-01", + "name": "[parameters('virtualMachineName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", + "[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "fromImage", + "vhd": { + "uri": "[concat(variables('storageContainerUri'), parameters('virtualMachineName'), variables('diskNameSalt'), '.vhd')]" + }, + "name": "[parameters('virtualMachineName')]" + }, + "imageReference": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" + } + ] + }, + "osProfile": { + "computerName": "[parameters('virtualMachineComputerName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]" + } + } + }, + "resources":[ + { + "name": "extension1", + "type": "extensions", + "apiVersion": "2015-05-01-preview", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "[variables('fileLocation')]" + ], + "commandToExecute": "[variables('commandToExecute')]" + } + } + + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-06-01", + "name": "[parameters('diagnosticsStorageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('diagnosticsStorageAccountType')]" + }, + "kind": "[parameters('diagnosticsStorageAccountKind')]", + "properties": {} + } + ], + "outputs": { + "adminUsername": { + "type": "String", + "value": "[parameters('adminUsername')]" + }, + "commandTExecute": { + "type": "String", + "value": "[variables('commandToExecute')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/vm_install/vm_parameters.json b/AzureResourceManager/Xray/vm_install/vm_parameters.json new file mode 100644 index 0000000..2d58ea8 --- /dev/null +++ b/AzureResourceManager/Xray/vm_install/vm_parameters.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "value": "westus2" + }, + "networkInterfaceName": { + "value": "xray-nic" + }, + "networkSecurityGroupName": { + "value": "xray-nsg" + }, + "networkSecurityGroupRules": { + "value": [ + { + "name": "SSH", + "properties": { + "priority": 300, + "protocol": "TCP", + "access": "Allow", + "direction": "Inbound", + "sourceAddressPrefix": "*", + "sourcePortRange": "*", + "destinationAddressPrefix": "*", + "destinationPortRange": "22" + } + } + ] + }, + "subnetName": { + "value": "default" + }, + "virtualNetworkName": { + "value": "xray-vm-test-vnet" + }, + "addressPrefixes": { + "value": [ + "10.0.0.0/24" + ] + }, + "subnets": { + "value": [ + { + "name": "default", + "properties": { + "addressPrefix": "10.0.0.0/24" + } + } + ] + }, + "publicIpAddressName": { + "value": "xray-public-ip" + }, + "publicIpAddressType": { + "value": "Dynamic" + }, + "publicIpAddressSku": { + "value": "Basic" + }, + "virtualMachineName": { + "value": "xray-vm" + }, + "virtualMachineComputerName": { + "value": "xrayvm" + }, + "storageAccountName": { + "value": "mpstoragevhd" + }, + "virtualMachineSize": { + "value": "Standard_B4ms" + }, + + "diagnosticsStorageAccountName": { + "value": "xrayvmvmtestdiag" + }, + "diagnosticsStorageAccountId": { + "value": "Microsoft.Storage/storageAccounts/xrayvmvmtestdiag" + }, + "diagnosticsStorageAccountType": { + "value": "Standard_LRS" + }, + "diagnosticsStorageAccountKind": { + "value": "Storage" + }, + "adminUsername": { + "value": "vmuser" + }, + "adminPassword": { + "value": "OWERWRITE_THE_PASSWORD" + }, + "artifactoryVersion": { + "value": "3.8.5" + }, + "scriptName": { + "value": "install_xray_to_vm.sh" + } + } +} \ No newline at end of file