Deploy an Azure VM to help Folding@Home
This is an Azure VM template which deploys a GPU-enabled VM of your choice to help the Folding@Home project find ways to combat COVID-19.
Deploy an Azure VM to help Folding@Home
This is an Azure VM template which deploys a GPU-enabled VM of your choice to help the Folding@Home project find ways to combat COVID-19.
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"name": { | |
"type": "string", | |
"defaultValue": "covid19folding", | |
"metadata": { | |
"description": "The name used to identify your virtual machine." | |
} | |
}, | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "The location in which your virtual machine will be deployed." | |
} | |
}, | |
"sku": { | |
"type": "string", | |
"defaultValue": "Standard_NC6_Promo", | |
"allowedValues": [ | |
"Standard_NC6_Promo", | |
"Standard_NC12_Promo", | |
"Standard_NC24_Promo", | |
"Standard_NC6", | |
"Standard_NC12", | |
"Standard_NC24", | |
"Standard_NC6s_v2", | |
"Standard_NC12s_v2", | |
"Standard_NC24s_v2", | |
"Standard_NC6s_v3", | |
"Standard_NC12s_v3", | |
"Standard_NC24s_v3" | |
], | |
"metadata": { | |
"description": "The virtual machine SKU to use when running F@H." | |
} | |
}, | |
"fah_team": { | |
"type": "int", | |
"defaultValue": 240772, | |
"minValue": 0, | |
"metadata": { | |
"description": "The ID of the Folding@Home team you wish to contribute towards." | |
} | |
}, | |
"ssh_key": { | |
"type": "securestring", | |
"metadata": { | |
"description": "Your SSH public key" | |
} | |
} | |
}, | |
"variables": { | |
"adminUsername": "folding", | |
"cloudinit-lines": [ | |
"#cloud-config\n", | |
"package_upgrade: true\n", | |
"\n", | |
"runcmd:\n", | |
" - [ wget, 'https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.5/fahclient_7.5.1_amd64.deb' , -O, '/tmp/fahclient.deb' ]\n", | |
" - [ dpkg, -i, --force-depends, /tmp/fahclient.deb ]\n", | |
"\n", | |
"write_files:\n", | |
" - path: /etc/fahclient/config.xml\n", | |
" content: |\n", | |
" <config>\n", | |
" <!-- Client Control -->\n", | |
" <fold-anon v='true' />\n", | |
" \n", | |
" <!-- Folding Slot Configuration -->\n", | |
" <gpu v='true' />\n", | |
" \n", | |
" <!-- Slot Control -->\n", | |
" <power v='full' />\n", | |
" \n", | |
" <!-- User Information -->\n", | |
" <user v='Anonymous' />\n", | |
"[concat(' <team v=\"', parameters('fah_team'), '\" />\n')]", | |
" \n", | |
" <!-- Folding Slots -->\n", | |
" <slot id='0' type='CPU' />\n", | |
" <slot id='1' type='GPU' />\n", | |
" \n", | |
" </config>\n" | |
], | |
"cloudinit": "[utils.join(variables('cloudinit-lines'))]", | |
"nsgName": "[concat(parameters('name'), '_nsg')]", | |
"nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', variables('nsgName'))]", | |
"nicName": "[concat(parameters('name'), '_nic')]", | |
"ipName": "[concat(parameters('name'), 'ip')]", | |
"vnetName": "[concat(parameters('name'), '-vnet')]", | |
"subnetName": "default", | |
"vnetId": "[resourceId(resourceGroup().name, 'Microsoft.Network/virtualNetworks', variables('vnetName'))]", | |
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]", | |
"nvidiaExtensionName": "[concat('micorosft.nvidia-gpu-driver-linux.', parameters('name'))]" | |
}, | |
"functions": [ | |
{ | |
"namespace": "utils", | |
"members": { | |
"join": { | |
"parameters": [ | |
{ | |
"name": "lines", | |
"type": "array" | |
} | |
], | |
"output": { | |
"type": "string", | |
"value": "[replace(replace(replace(string(parameters('lines')), '[\"', ''), '\"]', ''), '\",\"', '')]" | |
} | |
} | |
} | |
} | |
], | |
"resources": [ | |
{ | |
"type": "Microsoft.Network/virtualNetworks", | |
"apiVersion": "2019-11-01", | |
"name": "[variables('vnetName')]", | |
"location": "[parameters('location')]", | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"10.27.0.0/24" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[variables('subnetName')]", | |
"properties": { | |
"addressPrefix": "10.27.0.0/24", | |
"delegations": [ | |
], | |
"privateEndpointNetworkPolicies": "Enabled", | |
"privateLinkServiceNetworkPolicies": "Enabled" | |
} | |
} | |
], | |
"virtualNetworkPeerings": [ | |
], | |
"enableDdosProtection": false, | |
"enableVmProtection": false | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/virtualNetworks/subnets", | |
"apiVersion": "2019-11-01", | |
"name": "[concat(variables('vnetName'), '/', variables('subnetName'))]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]" | |
], | |
"properties": { | |
"addressPrefix": "10.27.0.0/24", | |
"delegations": [ | |
], | |
"privateEndpointNetworkPolicies": "Enabled", | |
"privateLinkServiceNetworkPolicies": "Enabled" | |
} | |
}, | |
{ | |
"name": "[variables('nicName')]", | |
"type": "Microsoft.Network/networkInterfaces", | |
"apiVersion": "2019-07-01", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetName'), variables('subnetName'))]", | |
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]", | |
"[concat('Microsoft.Network/publicIpAddresses/', variables('ipName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
}, | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIpAddress": { | |
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', variables('ipName'))]" | |
} | |
} | |
} | |
], | |
"networkSecurityGroup": { | |
"id": "[variables('nsgId')]" | |
} | |
} | |
}, | |
{ | |
"name": "[variables('nsgName')]", | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"apiVersion": "2019-02-01", | |
"location": "[parameters('location')]", | |
"properties": { | |
"securityRules": [ | |
{ | |
"name": "SSH", | |
"properties": { | |
"priority": 300, | |
"protocol": "TCP", | |
"access": "Allow", | |
"direction": "Inbound", | |
"sourceAddressPrefix": "*", | |
"sourcePortRange": "*", | |
"destinationAddressPrefix": "*", | |
"destinationPortRange": "22" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"name": "[variables('ipName')]", | |
"type": "Microsoft.Network/publicIpAddresses", | |
"apiVersion": "2019-02-01", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAddressVersion": "IPv4", | |
"publicIpAllocationMethod": "Dynamic", | |
"idleTimeoutInMinutes": 4 | |
}, | |
"sku": { | |
"name": "Basic" | |
} | |
}, | |
{ | |
"name": "[parameters('name')]", | |
"type": "Microsoft.Compute/virtualMachines", | |
"apiVersion": "2019-07-01", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "[parameters('sku')]" | |
}, | |
"storageProfile": { | |
"osDisk": { | |
"createOption": "fromImage", | |
"managedDisk": { | |
"storageAccountType": "Standard_LRS" | |
} | |
}, | |
"imageReference": { | |
"publisher": "Canonical", | |
"offer": "UbuntuServer", | |
"sku": "18.04-LTS", | |
"version": "latest" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" | |
} | |
] | |
}, | |
"osProfile": { | |
"computerName": "[parameters('name')]", | |
"adminUsername": "[variables('adminUsername')]", | |
"linuxConfiguration": { | |
"disablePasswordAuthentication": true, | |
"ssh": { | |
"publicKeys": [ | |
{ | |
"path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", | |
"keyData": "[parameters('ssh_key')]" | |
} | |
] | |
} | |
}, | |
"customData": "[base64(variables('cloudinit'))]" | |
} | |
} | |
}, | |
{ | |
"name": "[variables('nvidiaExtensionName')]", | |
"apiVersion": "2015-01-01", | |
"type": "Microsoft.Resources/deployments", | |
"properties": { | |
"mode": "incremental", | |
"templateLink": { | |
"uri": "https://gallery.azure.com/artifact/20161101/microsoft.nvidia-gpu-driver-linux-arm.1.2.0/Artifacts/MainTemplate.json" | |
}, | |
"parameters": { | |
"vmName": { | |
"value": "[parameters('name')]" | |
}, | |
"location": { | |
"value": "[parameters('location')]" | |
} | |
} | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Compute/virtualMachines/', parameters('name'))]" | |
] | |
} | |
], | |
"outputs": { | |
"foldingAtHomeTeam": { | |
"type": "string", | |
"value": "[parameters('fah_team')]" | |
}, | |
"adminUsername": { | |
"type": "string", | |
"value": "[variables('adminUsername')]" | |
} | |
} | |
} |