Home server on a Raspberry Pi
2 min read

Home server on a Raspberry Pi

Like most of the World, I'm too staying at Home for the greater good #Lockdown has made me crazy and I'm doing things I've been bailing on as Low-Priority for a long time. One of those included a Raspberry Pi AQI monitor cum weather station which was the first challenge I took back in march. It went well but I still had a few more decomissioned Raspberry Pi (2nd & 3rd Generation) which were just laying around for a while since I upgraded to Raspberry Pi 4 late last year. Now, I have plans for using the Raspberry Pi 3 as smart Access points which is a totally separate project but for now, I'm going to discuss how I used a Raspberry Pi 2 (a device essentially 8 Years old) to host an adblocker (pi-hole) and my personal homepage using a platform called Grav.

It took me about an hour to get everything running. What I already had was a Static IP address, Firewall & Router that has support for forwarding requests to an internal device on the network. I'll try to make an infographic and update it later but for now, it looks somewhat like this:

Internet <=> Firewall <=> (Router/DHCP Server) <= Raspberry Pi

So the internet connection I have is more than enough to take the load of a static webpage. The configuration works in a fashion that my firewall filters out all the incoming requests except those made to my domain name. Now, all the requests made to my domain (home.bhanu.xyz in this case) get routed to raspberry pi. On the pi side, I have nginx running which is configured to serve my website and drop everything else on the public network. it still allows me to access the pi-hole page on local network to manage adblocking etc.

In the last 1 week of testing, what I can make out is that the system is good to host fairly low traffic/low volume websites and services. I eventually plan to run something like a NUC or a self-hosted Dell server in my storage attic to additionally host services like mail server and uptime monitoring of my servers. This way, I will always have some headroom to expand plus a system that I can use as a backup & monitoring unit to keep all my online assets (website content/database etc.) backed up. This is a future planning of course to ensure that best practices are used. Everyone on the internet can be seen suggesting that there should be at least 3 Discreet backup copies of all the critical assets with two of those being in the same location (i.e. data center) and one additional copy being off site. This is done to ensure that in case the data center gets shut down due to any reason, we still get to retain our data.

The raspberry pi I used was earlier being used in my Pi Cluster that I've made over time to run various microservices for maintaining a sandbox of my projects for clients. That device became obsolete when I upgraded to Raspberry pi 3 (and those have been obsoleted by Raspberry Pi 4) So I can easily say it was an upcycling initiative to give these old devices a new lease of life when they've been decomissioned of their primary use.

In a nutshell, The lockdown is making me do things that were just not happening because I was too busy with the other things that we do. So it's been a Great learning experience so far. I hope to continue it and explore even more such fun little experiments to keep myself engaged into things I love and alleviate the sickening feeling of being home-stuck for over a month.