Docker PI Cluster
Well today is close to two months that my Pi cluster has been up and running. For the most part it has worked without any issues. Once Portainer was up and running I went about installing the different functions I wanted to have on each node. The first thing I thought of was a new Nagios container. I have used Nagios on my own network and at a data center where I worked. This was by far the most difficult of the installs. To get the current version you have to build it from source and then go about configuring. Here is an old but good guide to building a Nagios server. HERE I took the config files I had from my other Nagios server to lower the time it would take to manually enter everything. To get everything to talk to the Nagios server you either use ssh checks, nrpe, or nsclient. I setup an password less ssh for the nagios user to run the checks. I also build a few scripts that it would run to get the temperature, load average, drive space, and memory usage. Below is the screen shot of the clusters status.
The next node I built an web server that has it’s own instance of WordPress on it. This one is pretty straight forward I just didn’t want to use MySQL on the Pi. So it is connected to an external db server. I’m not going to go over that part but It works and I set it up to replicate this site to test plugins. I haven’t gotten that far with it but is does work.
The next one I setup an AWSTAT server. This one I had never used before but wanted to see the difference between Webalizer and it. I didn’t want it to just use it’s own traffic, which would be light. I used the traffic from my production web server. This one had some challenges but it worked out great. I used this guide for the initial setup. HERE Once the page functioned I had to get the info into the docker container. So I setup an rsync from my web servers to the Pi node. It syncs the access.log file every 30 minutes. To allow the container to use this I had decide where in the container I wanted it to be and then bring up the container using the -v switch. This allows the web server to sync the file and AWSTAT to process it to create the output stat pages. You will also have to build some crons to make this automated but no big deal either.
Finally I wanted something that would truly test the power of the Pi 4. So I created a MineOS server. This is a Minecraft server GUI that allow for easy administration. This one is easy and you can find the instructions HERE. I built it on Ubuntu and used the package manager to install most of it. I do realize that this isn’t a high end server so I limited the Minecraft server to 1.2 Gigs of memory and only 5 users. Need less to say it worked fine. I even added in the plugin called Dynmap that draws a webpage map of the world. So when it is doing a lot of updates you may get some lag but not much. I have built Minecraft Pi servers in the past and this one functions really well. I did have one time where it over loaded the processor and filled up the memory. However it had been running for about 2 weeks and with the heap slowly growing larger I basically rebooted itself. So I fixed this with a cron that would reboot the system at midnight. I have not had a problem since. Below is the GUI and the Dynmap of the world.
At this point the cluster has been running for almost 3 months. The only issue I had was with the cluster manager. The microSD started having errors. This card was reused from another project and I replaced it. Then I created a new instance of Portainer and created the cluster again. To finish this all up I am looking at transitioning to SSDs for the file system. I purchased 4 San Disk 160G drives and some Vantec USB 3.0 SATA adapters. I know you can’t boot directly from the USB but moving the file system to the SSD and keeping the boot partition on the SD card should solve any future issues. I will do a write up on the SSD transition, but you can find how to do it on YouTube or various web pages.