Running a node on Microsoft Azure
How to run a Presearch Node on a Micrsoft Azure VPS
Last updated
How to run a Presearch Node on a Micrsoft Azure VPS
Last updated
Below we document the steps to install an Ubuntu Server 20.04 LTS virtual machine on Microsoft Azure, add Docker Community Edition and finally the Presearch node.
Right now, for a node with 1000 PREs staked on the test-net, this is not a cost-effective solution; the running cost for a single node is around EUR 7 per month. This can be brought down slightly by going for an even smaller instance but that takes a performance hit on the below setup; as described we need a single core with more than just 512Mb RAM to function best
However, it does result in a machine with optimal Reliability score and weβre in it for the long term so gaining the maximum result in PREβs per PRE staked seems the way forward.
Active Azure subscription and at least $9 per node per month credit.
Active Node-Dashboard and Node registration code.
A basic understanding of Microsoft Azure.
Azure lets you easily run any VM as part of their βCompute Resourcesβ. This can be done programmatically, using ARM templates, or simply using the Azure Portal, as detailed below.
To create the Ubuntu Server platform for Docker and your Presearch node, follow these steps:
Goto portal.azure.com and log on with your Azure account. This account should have an active Azure subscription, and the rights to create the VM.
From the menu on your left, select βVirtual machinesβ. If this option is not available, simply type βVirtual machinesβ in the search box on top.
From the menu, choose βAddβ and then βVirtual machineβ.
The options in this first screen:
Subscription: Choose any active Azure subscription connected to your account.
Resource group: All the resources created for this VM (CPU, disks, virtual network,...) will be grouped under this Resource group, so it makes sense to use a separate resource group for each node since this helps when inspecting costs and performance per node.
Virtual machine name: Any name you like, as long as it is unique in your subscription.
Region: You can choose any region you want, this is the cloud. However, in this phase of the testnet all gateways are US based and from experience, nodes in US-West currently perform best.
Availability options: As there really is not much data to safeguard for your node and all disks in Azure offer at least some sort of redundancy, we choose βNo infrastructure redundancy requiredβ to save cost.
Image: Select βUbuntu Server 20.04 LTS - Gen 1β as your base image.
Size: The cheapest size that still runs a Presearch node well is currently a βStandard_B1sβ, offering 1 vcpu and 1Gb of RAM. You could theoretically select the βStandard_B1msβ which is even cheaper and offers a mere 512Mg of RAM but these did not perform as well for me, gaining a much lower Node Reliability score.
Note: the price you see calculated here is going to drop a little when we go for the cheaper hard-disks below.
Authentication type: Because at least during setup we will have to reach the VMβs console, we need SSH access to the machine. For any publicly addressable device on the internet we should always protect access with an SSH public key. This key will be auto-generated and we will retrieve it later.
Username: You can leave this default (azuser) or use any name you prefer.
SSH public key source: Generate a new pair, unless you have your own SSH key and prefer to use that.
Key pair name: will be auto generated; leave as-is or adjust to your preferred naming scheme.
Public inbound ports: Allow selected ports (when the node is running you can close port 22 if you wish, we will need it now to continue the setup.
Select inbound ports: this should be set to SSH (22).
Now, click βNext : Disksβ, and change the default disk type to either Standard SSD or Standard HDD, the latter option being even cheaper and not impacting the node performance in this test-net phase.
Selecting a cheaper disk option
Click the βManagementβ tab, and ensure the checkbox βEnable auto shutdownβ is unchecked, as per image below.
Thatβs it! Now, click βReview + createβ. Your selected options are checked and if all is okay, the βCreateβ button will become active.
Click βCreateβ, and after a few seconds a pop-up will appear, offering you to download the generated keys. Click βDownload private key and create resourceβ and a private key will be downloaded.
Note where you save this key and keep it secure! Anyone in possession of this private key can access your server.
Download the private key
The system will now be deployed and a progress screen will appear. When all resources have been deployed you will be presented with a screen as below.
Deployment is complete
Your Ubuntu Server is now running. To access it, click βGo to resourceβ.
From the Virtual Machine overview screen, select βConnectβ and then βSSHβ from the menu.
Connect via SSH
You are now shown instructions, as per image below. Note the username and IP address listed under point 4, and then use your preferred SSH client (such as Putty) to connect to the new virtual server.
From there, continue as with a standard Ubuntu VM below.
First, make sure your Ubuntu Server is up-to-date, and install supporting libraries needed for Docker.
Add the relevant Docker Community Edition repository, and refresh the repository cache.
Then, install Docker CE and add your user to the Docker group (replace [username] below with your Ubuntu username).
Now log-out and login again to ensure your default user has been added to the docker group.
You can test this by running Dockerβs equivalent of hello-world (without prefixing sudo):
First, goto your Node's dashboard page and note down personal Node registration code. You will need this later to start the presearch-node container.
Click on βCopyβ to copy the code to your clipboard.
Now, we install the presearch-node and an automatic updater. To ensure the presearch node always runs the latest image we are using the the Presearch Auto-updater image to check the presearch-node image every 900 seconds (15 minutes) for an updated version and if found, to automatically update it.
And finally, we download, and then start a presearch-node container.
Execute the below in your terminal, making sure you replace [YOUR_REGISTRATION_CODE] with the code you picked up from your node-control panel.
[NODE_DESCRIPTION] with the descriptive name of your node
Since version 0.9.21, there are additional parameters you can enter at startup to pre-set some parameters for your node. These are:
DESCRIPTION : this will be the descriptive text for your node,
URL : to find out still, from the upcoming medium post ;-)
STAKE : to stake an amount of PRE from node startup.
This would make the full command something like:
If all works as planned, you should see something like the below. You can get back to the command prompt by pressing CTRL+C.
Once back at the command prompt, type EXIT to close your terminal session.
Thank you so much to our Presearch Community member Niels for putting this together for us.