{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "nodeFullName": { "type": "string", "metadata": { "description": "Node full name (publicly visible)" } }, "nodeAdminEmail": { "type": "string", "metadata": { "description": "Node admin email (publicly visible)" } }, "adminUsername": { "type": "string", "metadata": { "description": "Username for the Virtual Machine" } }, "vmSize": { "type": "string", "metadata": { "description": "VM Resources" }, "defaultValue": "Standard_A4m_v2", "allowedValues": [ "Standard_A1_v2", "Standard_A2_v2", "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", "Standard_A4m_v2", "Standard_A8m_v2" ] }, "sshPublicKey": { "type": "string", "metadata": { "description": "SSH public key for the Virtual Machine" } }, }, "variables": { "TEMPLATES_BRANCH": "dev-mainnet", "MAIN_REPO_FETCH": "oraclesorg", "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]", "imagePublisher": "Canonical", "imageOffer": "UbuntuServer", "nicName": "myVMNic", "addressPrefix": "10.0.0.0/16", "subnetName": "Subnet", "subnetPrefix": "10.0.0.0/24", "storageAccountType": "Standard_LRS", "publicIPAddressName": "myPublicIP", "publicIPAddressType": "Static", "vmName": "MyUbuntuVM", "vmSize": "[parameters('vmSize')]", "virtualNetworkName": "MyVNET", "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "ubuntuOSVersion": "16.04.0-LTS", "dnsLabelPrefix": "[concat('oracles-ns-', uniqueString(resourceGroup().id, parameters('nodeFullName')))]", "adminUsername": "[trim(toLower(parameters('adminUsername')))]", "sshPublicKey": "[trim(parameters('sshPublicKey'))]", "nodeFullName": "[trim(parameters('nodeFullName'))]", "nodeAdminEmail": "[trim(parameters('nodeAdminEmail'))]", "networkSecurityGroupName": "Oracles-NSG-1" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "name": "[variables('storageAccountName')]", "apiVersion": "2017-06-01", "location": "[resourceGroup().location]", "sku": { "name": "[variables('storageAccountType')]" }, "kind": "Storage", "properties": {} }, { "apiVersion": "2017-04-01", "type": "Microsoft.Network/publicIPAddresses", "name": "[variables('publicIPAddressName')]", "location": "[resourceGroup().location]", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[variables('dnsLabelPrefix')]" } } }, { "apiVersion": "2017-04-01", "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[resourceGroup().location]", "properties": { "addressSpace": { "addressPrefixes": [ "[variables('addressPrefix')]" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { "addressPrefix": "[variables('subnetPrefix')]" } } ] } }, { "apiVersion": "2017-04-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicName')]", "location": "[resourceGroup().location]", "dependsOn": [ "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]", "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ], "networkSecurityGroup": { "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]" } } }, { "apiVersion": "2017-03-30", "type": "Microsoft.Compute/virtualMachines", "name": "[variables('vmName')]", "location": "[resourceGroup().location]", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[variables('vmSize')]" }, "osProfile": { "computerName": "[variables('vmName')]", "adminUsername": "[variables('adminUsername')]", "adminPassword": "", "linuxConfiguration": { "disablePasswordAuthentication": true, "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[variables('sshPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "publisher": "[variables('imagePublisher')]", "offer": "[variables('imageOffer')]", "sku": "[variables('ubuntuOSVersion')]", "version": "latest" }, "osDisk": { "createOption": "FromImage" }, "dataDisks": [ { "diskSizeGB": "128", "lun": 0, "createOption": "Empty" } ] }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" } ] }, "diagnosticsProfile": { "bootDiagnostics": { "enabled": "true", "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]" } } }, "resources": [ { "apiVersion": "2015-06-15", "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.0", "autoUpgradeMinorVersion": true, "settings": { "fileUris": [ "[concat('https://raw.githubusercontent.com/',variables('MAIN_REPO_FETCH'),'/deployment-azure/', variables('TEMPLATES_BRANCH'), '/nodes/explorer/install.sh')]" ] }, "protectedSettings": { "commandToExecute": "[concat('cp install.sh /home/', variables('adminUsername'), '/; cd /home/', variables('adminUsername'), '; chown ', variables('adminUsername'), ':', variables('adminUsername'), ' install.sh; chmod +x install.sh; TEMPLATES_BRANCH=\"', variables('TEMPLATES_BRANCH'), '\" ADMIN_USERNAME=\"', variables('adminUsername'), '\" NODE_FULLNAME=\"', variables('nodeFullName'), '\" NODE_ADMIN_EMAIL=\"', variables('nodeAdminEmail'),'\" MAIN_REPO_FETCH=\"', variables('MAIN_REPO_FETCH'), '\" sudo -u ', variables('adminUsername'), ' -E -H ./install.sh')]" } } } ] }, { "name": "[variables('networkSecurityGroupName')]", "type": "Microsoft.Network/networkSecurityGroups", "apiVersion": "2016-09-01", "location": "[resourceGroup().location]", "comments": "Network Security Group (NSG) for your Primary NIC", "properties": { "securityRules": [ { "name": "allow-ssh", "properties": { "priority": 1000, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "Tcp", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "22" } }, { "name": "allow-rpc", "properties": { "priority": 1100, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "Tcp", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "8545" } }, { "name": "allow-discovery", "properties": { "priority": 1200, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "*", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "30303" } }, { "name": "allow-https", "properties": { "priority": 1300, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "*", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "443" } }, { "name": "access-dashboard", "properties": { "priority": 1400, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "Tcp", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "3000" } }, { "name": "access-explorer", "properties": { "priority": 1500, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "Tcp", "access": "Allow", "destinationAddressPrefix": "*", "destinationPortRange": "4000" } }, { "name": "disallow-other", "properties": { "priority": 2000, "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "protocol": "*", "access": "Deny", "destinationAddressPrefix": "*", "destinationPortRange": "*" } } ] } } ], "outputs": { "hostname": { "type": "string", "value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]" }, "sshCommand": { "type": "string", "value": "[concat('ssh ', variables('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]" } } }