Deploying a Mysterium VPN Node with DigitalOcean in one command
What is Mysterium?
Mysterium is a decentralized VPN powered by Blockchain. It’s an Open Sourced Network allowing anyone to rent their unused Network traffic, while providing a secure connection for those in need.
Mysterium is currently undergoing an open TestNet where anyone with the necessary software can set up a Node within the network to act as an endpoint for users traffic. You can see stats of the current TestNet here. This shows the current status of Nodes on the network, where they are based, and how much traffic the network is pushing.
What is DigitalOcean?
DigitalOcean is a cloud hosting platform that allows you to create Linux virtual machines (VMs) in a range of sizes, these are referred to as Droplets. Not only can you create virtual machines in minutes all around the world, you can automate it!
This is a continuation of my cloud automation series where I show how to deploy Mysterium Nodes on various cloud infrastructures.
This guide will show you how to deploy a Mysterium Node on DigitalOcean all with one command.
Deploying a DigitalOcean Mysterium Node
- A Digital Ocean Account
- The Doctl (DigitalOcean Control) API CLI
- My Mysterium Node configuration file
- This command “doctl compute droplet create [Droplet Label ] — region [Region Name] — image ubuntu-16–04-x64 — [Droplet Size]— user-data-file ./DOMysteriumConfig.yml — wait”
Account and API Setup
To begin we will need to create a DigitalOcean account. Signing up takes only a few minutes, then you will be on your way to deploying a Node.
Much like many cloud providers, DigitalOcean offer free credit promo codes for new users. Follow the following link to find a list of them, or have a search online for them.
The next step is retrieving your API Key. This allows the doctl CLI to connect to your account and create your Mysterium Node(s). Once your account is created go to this location in your account setting and create a new API key.
Select “Generate New Token”, then select the following settings in the below screenshot.
Once this is created it will display your API key. Note this down in a secure location, you will only be displayed it once.
Once you have signed up and made an API key it is now time to install doctl. I would recommend using snap or homebrew, depending on your OS of either Linux of macOS. There is also steps for installing doctl on Windows. Doctl is a CLI program that allows you to interact with the DigitalOcean API from your terminal.
The DigitalOcean Mysterium Node Command
This section will run through the command used, what the sections mean, and how you can customize it.
Below is an outline of the command we will run, with the three sections where you can choose your own parameters, if you want. And the final DOMysteriumConfig configuration file, which contains the instructions on how the Droplet will install and configure the Mysterium Node automatically.
doctl compute droplet create [Droplet Name] — region [Droplet Location] — image ubuntu-16–04-x64 — [Droplet Type] — user-data-file ./DOMysteriumConfig.yml — wait
The three parameters are as follows:
[Droplet Name] — This is very straightforward, this is the name you want your Droplet to be called, it can be anything you want.
[Droplet Location] — This is what region, or data center you want your Droplet to reside in. The available region types and their corresponding API names are below:
AMS2 — Amsterdam 2
AMS3 — Amsterdam 3
BLR1 — Bangalore 1
FRA1 — Frankfurt 1
LON1 — London 1
NYC1 — New York 1
NYC2 — New York 2
NYC3 — New York 3
SFO1 — San Francisco 1
SFO2 — San Francisco 2
SGP1 — Singapore 1
TOR1 — Toronto 1
[Droplet Type] — This is where you can select what size of Droplet you want to create, the larger the Droplet, the more expensive it is. The available node types and their corresponding API IDs (slug) are below:
DOMysteriumConfig cloud-config script
DigitalOcean allow you have custom scripts ran upon creation of new Droplets, this is called their cloud-config scripts. For this guide I will be providing the configuration script below. When you run the doctl command in the example you can point it to the location of the .yml script created.
- sysctl -w net.ipv4.ip_forward=1
- iptables -P FORWARD ACCEPT
- apt install apt-transport-https ca-certificates curl software-properties-common -y
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
- apt update
- apt-cache policy docker-ce
- apt install docker-ce -y
- docker pull mysteriumnetwork/mysterium-node
- docker run --cap-add NET_ADMIN --net host --publish "1194:1194" --name mysterium-node -d mysteriumnetwork/mysterium-node --agreed-terms-and-conditions
Copy this text and save it to a file called DOMysteriumConfig.yml in a convenient location.
doctl compute droplet create MysteriumNode --region blr1 --image ubuntu-16-04-x64 --size s-1vcpu-1gb --user-data-file ./DOMysteriumConfig.yml --wait
This command creates a Ubuntu 16.04 Droplet called MysteriumNode, in Bangalore, uses the cloud-config script called DOMysteriumConfig.yml I created. This script updates the new Droplet, configures the firewall, installs docker, then deploys the Mysterium Node container.
It will ask you for your API key, then deploy the node for you. The whole process from running the doctl command to having your fully configured and working Mysterium Node should be around 7 minutes.
You can then SSH onto your Droplet with the credentials emailed to you upon creation of your Droplet, and run the following command to find your Node ID.
docker logs -f mysterium-node
You will be able to see your Mysterium Node appear on the network by visiting the following link.
Important Further Configuration
The Droplet created using this method has very basic security and account configuration completed.
IT IS STRONGLY RECOMMENDED YOU RUN THROUGH THE STEPS IN THE BELOW GUIDE:
I will be looking to update the cloud-config script so it automates the majority of these steps for you, in the future.
Need more help?
If you need more help with specifics to running a Mysterium Node, there is a wiki with common issues on the Mysterium Github, located here.
You can also join our Telegram community for help from our community!
Please be sure to follow and subscribe to the following:
Website — https://mysterium.network
Twitter — https://twitter.com/MysteriumNet
Medium — https://medium.com/mysterium-network
Reddit — https://www.reddit.com/r/MysteriumNetwork
Facebook — https://www.facebook.com/MysteriumNet
Slack — https://mysterium-network.slack.com
Bitcointalk — https://bitcointalk.org/index.php?topic=1895626.0
Steemit — https://steemit.com/@mysteriumnetwork
GitHub — https://github.com/MysteriumNetwork
Newsletter — http://www.subscribepage.com/MysteriumNetwork
Whitepaper — https://mysterium.network/whitepaper.pdf
English — https://t.me/Mysterium_Network
Rules & FAQ — https://t.me/MysteriumRulesAndFAQ
Announcements — https://t.me/MysteriumOfficialAnnouncements
中文 / Chinese — https://t.me/MysteriumChineseChat
Español / Spanish — https://t.me/mysterium_network_espanol