JavaScript is required to view this page.
Skip to content
Get 50% OFF 2x Smart Devices with your HA Yellow Kit + CM4
Get 50% OFF 2x Smart Devices with your HA Yellow Kit + CM4
How-To: Set Up A Round-Robin Webserver On Your SBC Cluster

How-To: Set Up A Round-Robin Webserver On Your SBC Cluster


SOEdge Module
(release date Q3 2019)

By Miguel Alatorre, ameriDroid Technician

In earlier articles, we showed our new file server project and how we configured RAID on it, seen here and here respectively. Today we have another update! Since we have many people accessing our intranet (local network) webserver at once, leaving the ROCKPro64 to process it all seemed a bit cruel. So we decided to setup a reverse proxy to forward traffic to the SOPine modules we have installed. For those who don’t know, a reverse proxy allows a user to connect to a device which will then forward it to another host to process.

In order to set up Lighttpd (our choice of webserver), we followed this guide by Mohd Sohail on Linux and Ubuntu. To configure a reverse proxy, the Mod_Proxy module needs to be enabled. To do so, add mod_proxy”, to the server.modules section. Next the following code snippet needs to be added to the end of the lighttpd.conf file:

$HTTP["host"] == "RockPro IP" {
    proxy.balance = "round-robin"
    proxy.server = ( "" => ( 
        ( "host" => "SOPine 1 IP" ),
        ( "host" => "SOPine 2 IP" )
    ))
}

To simplify it, the starting line, $HTTP["host"] == "RockPro IP" lets Lighttpd know that the host device is the RockPro64 and that all traffic going to it is to be modified somehow (replace "RockPro IP" with the IP address or hostname of your device). Next is proxy.balance = "round-robin". The round-robin parameter is what tells Lighttpd to forward traffic somewhere. Finally, the proxy.server section is the list of hosts that the RockPro64 will send its traffic to in round-robin fashion.

We tested this by adding a 2nd SOPine module to our Clusterboard, configuring it identically to the 1st SOPine module, and changing the background page color of the index.html file (the default web page) on each SOPine module. When reloading, we noticed the page background would alternate, demonstrating that the page was being served by alternating SOPine modules.

It is important to note that in order for this to work correctly, the nodes of the cluster (in this case, the SOPine modules) should all have an identical file structure so web navigation works as expected. But it is entirely possible and nearly as easy to mix-and-match as many different SBCs and other computers as you'd like as long as they are all running a webserver with an identical file structure!

Robbie Ferguson of Category5.tv added the following suggestion:

Very nice. So many great uses for this setup, thanks! I could also see removing all files from /var/www/html, making it immutable, and mounting a NAS share via fstab. That way you can edit the files in one place (on your NAS) and it is the same on all.

Previous article New Shelly Kits

Comments

Bo - August 16, 2019

Richard: Apache is capable of handling round-robin reverse-proxy functionality. However, we’ve found Apache is often more difficult to configure than Lighttpd. But we haven’t tried it in many years as we’ve standardized on Lighttpd here.

On the RPro64, as well as the SOPine modules, we are running the latest version of Armbian.

Richard - August 16, 2019

Thanks for this example. This is a great and simple way to set this up. Is this limited to lighttpd or can the same be done with apache? Also, what OS (version) are you running on the RPro64?

Leave a comment

Comments must be approved before appearing

* Required fields

x