Do you want to build a Load-Balanced Skycoin Node?

Come on — let’s try!

Background

This is a follow-up to an earlier article I wrote about setting up a secure public Skycoin Node — you can fund the original article here.

This article builds on the earlier article with a few simple additional steps.

Recap

So as a brief recap — if you followed the first article you should have the following in place already:

A public IP address

A domain name

The domain managed by a service such as CloudFlare. This is not strictly required — but I suggest it as CloudFlare will help protect your servers and will obfuscate your private IP address.

A single Skycoin Node instance running on your back-end server infrastructure within Docker

Caddy Server acting as a Reverse Proxy for your Skycoin Nodes and also securing the connection to the Skycoin Node API by providing SSL from LetsEncrypt

Where to Next?

With the above assumed to be in place and operational a few additional steps will allow you to add a second(and more) Skycoin Node instance and then update Caddy so that it will load-balance the two.

The steps required to achieve this are as follows:

Create a set of two new Docker Volume to store the instance data from the Skycoin Node — one for the wallets and one for the blockchain data.

User Docker to start a new instance of the Skycoin Node. Key changes from when you started the first instance are to ensure you use the newly created Docker Volumes (don’t share volumes), and make sure each instance has slightly different public port numbers exposed on the host machine. The name of your new node will also need to be unique.

Edit your Caddyfile so that it is configured to load-balance requests from your domain across both Skycoin Node instances. Your new Caddyfile should look something like this:

node.domain.com {

tls {

dns cloudflare

}

proxy / xxx.xxx.xxx.xxx:6420 xxx.xxx.xxx.xxx:6421 {

health_check /api/v1/health

transparent

}

}

The above assumes both Skycoin Nodes are running within Docker on the same machine and therefor are accessible on the same IP address (xxx.xxx.xxx.xxx). Each instance is available on a different port however (6420, 6421).

The use of health_check is optional, however it specifies the Skycoin Node health API endpoint which Caddy will poll periodically to determine if a Node is down — and will avoid sending requests to it.

This setup is useful to help support higher availability of your public facing Skycoin Nodes — as if any single instance goes offline, Caddy will automatically direct all traffic to the remaining good instances. Additionally it can help eliminate outages during upgrades.

Want to know more?

If you would like to find out more about Skycoin, Skywire, CX or any other aspect of these incredible projects, I have compiled a list of links which will help.

Website: https://www.skycoin.com/

Store: https://store.skycoin.com

Skycoin Telegram: https://t.me/Skycoin

Skywire Telegram: https://t.me/Skywire

Skycoin User Group: https://skywug.net/

Twitter: https://twitter.com/Skycoinproject

Skycoin Project GitHub: https://github.com/skycoinproject/

Reddit: https://reddit.com/r/Skycoin

If you found this useful, consider providing a tip of your own!