perlun.eu.org · About the blog · Programming · Select language / Välj språk

Saying goodbye to an old friend: Decommissioning a Raspberry Pi web server

For a good many years, I have been running some of my personal web hosting from a Raspberry Pi in my home. In this post I describe the process of decommissioning this server and the background to why this happened right now. I also share some of the experiences of using a Raspberry Pi as a server this way and my general feelings around it.

The background: "Why host a server locally in the first place?" and how it all started

I don't know the exact time when I started running a Raspberry Pi as a production web server but I think it was on March 26, 2015. At least, that's the date I mention in this Swedish-language blog post.

At this time, I was running it on a Raspberry Pi Model B (first-generation, released in 2012). I had received it as a gift from my kind brother Johannes, and I guess I was trying to find some good use for it. :wink: Also, I was trying out the Jekyll blog engine and I needed somewhere to publish the generated static web site.

I already had a VPS (milou) at this point, but somehow I wanted to host this on my local server instead of putting it there. We already had a public IP address which I could use (shared with our local LAN), by port-forwarding the HTTP port to the internal LAN address of the Raspberry Pi. HTTPS was not enabled at this point.

Also, the coolness factor of being able to host these things on such a small, low-power device can't really be denied. :sunglasses:

The first web site to be moved to the new infrastructure was my personal blog (the one you're currently reading). It had previously been hosted on milou using Wordpress, but I was really not happy with it. Especially the Wordpress control panel was very slow on this VPS with limited resources.

Said and done: I set up the nginx web server, published some content and updated the relevant DNS entry to point at my public IP. The web site http://per.halleluja.nu was now being served from my Raspberry Pi. :tada:

(I didn't yet have the perlun.eu.org domain at this time; it was registered a few years later as you'll see below.)

Hosting milestones

So, a few milestones in the history of this server and blog alike (some of these dates are approximate):

In other words, pi2 had been running with its current configuration for exactly two years before I now started to change it.

Here's what it looks like, by the way:

Raspberry Pi 2 photo

"If it ain't broken, why fix it?"

That's a very good question, well-deserving an answer. There are a couple of reasons actually:

Timeline of events

Here's a rough timeline of how and when the transition was made. Many of these steps were not in any way required to be performed to get the move accomplished, but some of the things (like creating Ansible roles and adding the existing configuration from pi2) simplified things quite significantly.

With this approach, I could make preparations and once I was ready to move a service from one machine to another, I just moved files around in my Ansible inventory and deployed the configuration files to the new server. Very convenient and nice.

So, to summarize things:

In other words, all is well and I'm now prepared to meet the day when I'll loose these static IPs.

Six years of Raspberry Pi-based hosting (first onpi, then on pi2) has now come to an end. It feels both good and bad in a way. It's been an interesting journey and quite fun to host this locally, and I must admit the Raspberry Pi has been extremely reliable (for example, no disk failure yet). At the same time, it's interesting to try out the VPS-based approach again. One advantage is that it's not in any way dependent on my local upstream Internet connection, even though it has been very reliable during the years.

I'll now wrap this blog post up by adding some uptime stats for these machines.

pi2 statistics

Here are the figures that uprecords gives me. We're not talking about 99.9999% SLA or anything like that, but a good 99.9% is perfectly acceptable to me for a "personal web site/personal blog"-oriented web host.

     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1   283 days, 06:50:57 | Linux 4.4.50-v7+          Tue Oct  3 11:50:02 2017
->   2   222 days, 02:04:31 | Linux 4.9.35-v7+          Thu Nov  5 19:32:58 2020
     3    85 days, 12:00:19 | Linux 4.9.35-v7+          Wed Jan  2 04:13:45 2019
     4    65 days, 05:37:58 | Linux 4.9.35-v7+          Fri Apr  3 08:18:21 2020
     5    61 days, 20:00:19 | Linux 4.4.50-v7+          Wed Aug  2 15:40:52 2017
     6    60 days, 11:00:09 | Linux 4.9.35-v7+          Wed Dec 11 16:18:00 2019
     7    59 days, 20:00:08 | Linux 4.9.35-v7+          Mon Oct  7 19:47:19 2019
     8    58 days, 16:00:11 | Linux 4.9.35-v7+          Mon Jul 20 12:20:08 2020
     9    58 days, 04:00:09 | Linux 4.9.35-v7+          Sun Nov  4 17:09:57 2018
    10    53 days, 04:20:17 | Linux 4.4.50-v7+          Tue Jun  6 06:28:34 2017
----------------------------+---------------------------------------------------
no1 in    61 days, 04:46:27 | at                        Mon Aug 16 03:23:55 2021
    up  1571 days, 18:46:38 | since                     Thu Feb 23 16:52:19 2017
  down     1 day , 09:58:32 | since                     Thu Feb 23 16:52:19 2017
   %up               99.910 | since                     Thu Feb 23 16:52:19 2017

coruscant stats

The machine has only been up for about 7 months, so it's not much to brag about yet. The %up sure looks good so far:

     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1   100 days, 09:44:55 | Linux 4.19.0-13-cloud-am  Thu Dec 10 22:55:15 2020
     2    95 days, 14:17:25 | Linux 4.19.0-14-cloud-am  Sun Mar 21 08:40:21 2021
     3    22 days, 02:15:22 | Linux 4.19.0-12-cloud-am  Wed Nov 18 20:39:42 2020
->   4     0 days, 00:03:41 | Linux 4.19.0-17-cloud-am  Thu Jun 24 23:57:57 2021
----------------------------+---------------------------------------------------
1up in    22 days, 02:11:42 | at                        Sat Jul 17 02:13:20 2021
no1 in   100 days, 09:41:15 | at                        Sun Oct  3 09:42:53 2021
    up   218 days, 02:21:23 | since                     Wed Nov 18 20:39:42 2020
  down     0 days, 00:00:33 | since                     Wed Nov 18 20:39:42 2020
   %up              100.000 | since                     Wed Nov 18 20:39:42 2020

Sites affected by this move