2017-06-20 13:16:07 -07:00
|
|
|
{
|
|
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
|
|
"contentVersion": "1.0.0.0",
|
|
|
|
"parameters": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"FullName": {
|
2017-06-20 13:16:07 -07:00
|
|
|
"type": "string",
|
|
|
|
"metadata": {
|
|
|
|
"description": "Node full name (publicly visible)"
|
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"AdminEmail": {
|
2017-06-20 13:16:07 -07:00
|
|
|
"type": "string",
|
|
|
|
"metadata": {
|
|
|
|
"description": "Node admin email (publicly visible)"
|
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"AdminUsername": {
|
2017-06-20 13:16:07 -07:00
|
|
|
"type": "string",
|
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "Username for the Virtual Machine"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"SSHPublicKey": {
|
|
|
|
"type": "string",
|
2017-06-20 13:16:07 -07:00
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "SSH public key for the Virtual Machine"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"NetstatsServer": {
|
|
|
|
"type": "string",
|
2017-06-20 13:16:07 -07:00
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "NetStats server IP"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"NetstatsSecret": {
|
|
|
|
"type": "secureString",
|
2017-06-20 13:16:07 -07:00
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "NetStats net code"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
2017-10-18 08:24:43 -07:00
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"MiningKeyAddress": {
|
2017-06-20 13:16:07 -07:00
|
|
|
"type": "string",
|
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "Miner blockchain account address (0x...)"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"MiningKeyPassword": {
|
|
|
|
"type": "secureString",
|
2017-06-20 13:16:07 -07:00
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "Password for the mining key"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
},
|
2017-10-18 08:24:16 -07:00
|
|
|
"MiningJSONKeyFile": {
|
2017-06-20 13:16:07 -07:00
|
|
|
"type": "secureString",
|
|
|
|
"metadata": {
|
2017-10-18 08:24:16 -07:00
|
|
|
"description": "Content of the file with mining key (json string)"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
2017-10-18 08:24:43 -07:00
|
|
|
}
|
2017-06-20 13:16:07 -07:00
|
|
|
},
|
|
|
|
"variables": {
|
|
|
|
"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",
|
2017-06-23 13:06:41 -07:00
|
|
|
"publicIPAddressType": "Static",
|
2017-06-20 13:16:07 -07:00
|
|
|
"vmName": "MyUbuntuVM",
|
|
|
|
"vmSize": "Standard_A1",
|
|
|
|
"virtualNetworkName": "MyVNET",
|
|
|
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
|
|
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
|
|
|
"ubuntuOSVersion": "16.04.0-LTS",
|
2017-10-18 08:24:16 -07:00
|
|
|
"adminUsername": "[trim(toLower(parameters('AdminUsername')))]",
|
|
|
|
"sshPublicKey": "[trim(parameters('SSHPublicKey'))]",
|
|
|
|
"nodeFullName": "[trim(parameters('FullName'))]",
|
|
|
|
"nodeAdminEmail": "[trim(parameters('AdminEmail'))]",
|
|
|
|
"miningAddress": "[trim(parameters('MiningKeyAddress'))]",
|
|
|
|
"miningKeyfile": "[base64(trim(string(parameters('MiningJSONKeyFile'))))]",
|
|
|
|
"miningKeypass": "[trim(parameters('MiningKeyPassword'))]",
|
|
|
|
"netstatsServer": "[trim(parameters('NetstatsServer'))]",
|
2017-10-20 08:47:40 -07:00
|
|
|
"netstatsSecret": "[trim(parameters('NetstatsSecret'))]",
|
|
|
|
"dnsLabelPrefix": "[toLower(concat('oracles-', uniqueString(resourceGroup().id, variables('miningAddress'))))]"
|
2017-06-20 13:16:07 -07:00
|
|
|
},
|
|
|
|
"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/virtualNetworks/', variables('virtualNetworkName'))]"
|
|
|
|
],
|
|
|
|
"properties": {
|
|
|
|
"ipConfigurations": [
|
|
|
|
{
|
|
|
|
"name": "ipconfig1",
|
|
|
|
"properties": {
|
2017-06-23 13:16:44 -07:00
|
|
|
"privateIPAllocationMethod": "Dynamic",
|
2017-06-20 13:16:07 -07:00
|
|
|
"publicIPAddress": {
|
|
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
|
|
|
},
|
|
|
|
"subnet": {
|
|
|
|
"id": "[variables('subnetRef')]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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": [
|
2017-10-03 03:52:19 -07:00
|
|
|
"https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/mining-node/install.sh"
|
2017-06-20 13:16:07 -07:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"protectedSettings": {
|
2017-07-10 10:43:43 -07:00
|
|
|
"commandToExecute": "[concat('cp install.sh /home/', variables('adminUsername'), '/; cd /home/', variables('adminUsername'), '; chown ', variables('adminUsername'), ':', variables('adminUsername'), ' install.sh; chmod +x install.sh; ADMIN_USERNAME=\"', variables('adminUsername'), '\" NETSTATS_SERVER=\"', variables('netstatsServer'), '\" NETSTATS_SECRET=\"', variables('netstatsSecret'), '\" MINING_KEYFILE=\"', variables('miningKeyfile'), '\" MINING_ADDRESS=\"', variables('miningAddress'), '\" MINING_KEYPASS=\"', variables('miningKeypass'), '\" NODE_FULLNAME=\"', variables('nodeFullName'), '\" NODE_ADMIN_EMAIL=\"', variables('nodeAdminEmail'), '\" sudo -u ', variables('adminUsername'), ' -E -H ./install.sh')]"
|
2017-06-20 13:16:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"outputs": {
|
|
|
|
"hostname": {
|
|
|
|
"type": "string",
|
|
|
|
"value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
|
|
|
|
},
|
|
|
|
"sshCommand": {
|
|
|
|
"type": "string",
|
|
|
|
"value": "[concat('ssh ', variables('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]"
|
|
|
|
},
|
|
|
|
"miningAddress": {
|
|
|
|
"type": "string",
|
|
|
|
"value": "[variables('miningAddress')]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|