Webcluster Project Concept

Hey G33ks,So, as you may or may not know from this Facebook post, I want to deploy web services on Raspberry pi's to decrease power consumption and heat generation in my house. Right now, I'm using LXC for easy management of the sites. However, the Raspberry Pi's do not support LXC as far as I know.So, I started my quest on some epic management tool to do this. I came along stuff like Kubernetes, Docker, Hadoop and Mesos... but none of them suited the job I had for my devices. No, I wanted a simple web interface to assign a site to a pi. So, I started to develop my own software for this (it's still nowhere near functional)!

The parts/servers

In this example, I'll just simplify it with only 4 servers, 1 load balancer, a controller and a NAS. For simplicity sake we call them: - S02 (server 2) - S03 (server 3) - S04 (server 4) - L01 (load balancer) - C01 (Controller) - N01 (NAS)They are either connected with only the Loadbalancer, NAS (maybe with FTP only?) and Controller WebUI sticking out, or all together in one big happy LAN. Now that we have that, let's get to a few scenarios!

Booting up the whole cluster

This is nothing major of a scenario, this is just booting up your cluster. (for example, after maintenance, moving out etc.)Once your cluster has been booted up and the controller will try to check all servers if they are ready (or the servers will check in at the controller?) After this is done the controller will randomly assign websites to all servers. (might be done with weighing to, for example, put less heavy sites on weaker servers, and put more heavy sites on stronger servers) So let's say we have these sites:
  • example1.com
  • example2.com
  • example3.com
  • example4.com
  • example5.com
The controller would randomly assign websites to each server in the cluster.
  • S01: example2.com
  • S02: example3.com
  • S03: example1.com
  • S04: example4.com
Now, those who can count should be able to figure out that we're missing example5.com. But, the controller would just assign this site to a random node in the cluster:
  • S01: example2.com
  • S02: example3.com + example5.com
  • S03: example1.com
  • S04: example4.com
After all servers have been assigned, the controller will give each server a signal. All servers will not download their files from N01 (or maybe just get them as needed/stream them from N01?) and configure themselves with vhosts. L01 will also start to configure itself so the right domain name gets sent to the right server.After this process is done, the websites are now reachable from the outside through the load balancer.

A server fails

It's not uncommon for a server to fail, this is what this scenario covers: Let's say S03 fails. Then, the controller would assign the site that ran on S03 to the server with the LEAST load. So let's say: S03 died, and S04 is doing pretty much nothing. Then the controller would assign example1.com to S04 like so:
  • S01: example2.com
  • S02: example3.com + example5.com
  • S03: DEAD
  • S04: example4.com + example1.com
Once S03 comes back online again, it will check-in at the controller, and resume its duties, or get another duty depending on the workloads.
  • S01: example2.com
  • S02: example3.com + example5.com
  • S03: example1.com
  • S04: example4.com

A New Server

So, you've got a new server that you want to pop in the cluster? great! All you have to do is set it up (maybe we use a little script for this?) and it will be in the cluster in no-time. We call this server S05 for the time being. S02 was handling 2 websites, so we can put one of them on S05 (depending on loads, weight etc.):
  • S01: example2.com
  • S02: example5.com
  • S03: example1.com
  • S04: example4.com
  • S05: example3.com

Server overloaded

Let's say, one of your sites is REALLY popular all of the sudden, and you didn't have time to get your hands on a new server yet? No problem! The cluster should automatically send out a help signal. The controller will assign a server that isn't doing a lot (again, depending on load and weight) to help out. This means we get something like this:
  • S01: example2.com
  • S02: example5.com
  • S03: example1.com
  • S04: example4.com + example2.com
  • S05: example3.com + example2.com
This way, you will have a bit more time to get a new server and pop in in the cluster.

A New Website

Let's say, you're starting a new website. All you'd have to do with this cluster is add the site to the cluster, and one of the servers will start serving it!
  • S01: example2.com + awesomenewwebsite.com
  • S02: example5.com
  • S03: example1.com
  • S04: example4.com + example2.com
  • S05: example3.com + example2.com

Website obsolete

It happens a lot, a website you made is obsolete (nobody uses it anymore, or you don't support it anymore, or it has served its purpose). All you'd have to do is tell the controller what site to remove and it will tell all servers serving it to stop serving it.
  • S01: example2.com + awesomenewwebsite.com
  • S02: example5.com
  • S03: example1.com
  • S04: example2.com
  • S05: example3.com + example2.com

Now, there are probably already some solutions out there that basically work like this, but they have some major problems for me: - They are a pain in the buttocks to setup - They are a pain in the buttocks to use and manage - They are a pain in the buttocks to findI hope I can get started on something like this myself soon, but it will take a LONG time... it might even be forgotten by that time, so let's see...anyways, for now [g33kout]

Comments


Leave a comment


Please login to leave comment!