After self-hosting on a Raspberry Pi 4 Model B, I'm back on a free VPS
My time hosting a web server on a Raspberry Pi in the coat closet has come to an end. I’m not unhappy. I don’t need to be inviting ports 80 and 443 into my home network. It was just an experiment. One that went really well.
But I’m OK moving on.
When the self-hosting experiment began with my first Raspberry Pi (a Zero W that was not up to the task), I was surprised to find out that I could use my Spectrum-supplied Arris cable modem/router to open ports 80 and 443 and forward them to a computer on my local network.
None of my sites likely ever got enough traffic for anybody to notice, and I never tried to measure it anyway. I write what I want, and the relative popularity of one entry over another isn’t important to me.
Once I upgraded to a Raspberry Pi 4 Model B, the experiment really began. Using Raspberry Pi OS and the Caddy web server, I was able to host content for a few domains with automatic certificates. All I had to do was lay it out in /etc/caddy/Caddyfile
, and the Caddy executable took care of the rest.
Whether or not Spectrum was looking the other way when I was running the web server, it all ended about a week or so ago when the cable provider offered to “upgrade” us from 300 Mbps to 400 Mbps with new equipment — a separate modem and WiFi 6 router.
I accepted the offer, and the gear arrived a few days later. I hooked everything up and made the switch. It was indeed a lot faster. Before the switch, I never got close to 300 Mbps. I’d be lucky to get 100. But with this new setup, the connection is at or above 400 Mbps all the time. Still only 10 Mbps up, and since I do a lot of work at home with photos and video, it’s not the greatest. But the download speed is amazing.
I would buy my own router and save the $7 extra a month that I’m paying Spectrum for the WiFi portion of my connection, but the range of the router is so much better than the old box that I’m worried I’ll spend $150 and not have as good of a connection.
The new Spectrum router is weird. You don’t “control” it on the local network like a normal router. Instead, you manage it through the Spectrum mobile (phone) app.
Through this app, I set an address on the local network for the Raspberry Pi, then I forwarded ports 80 and 443 to it. After changing my DNS, I verified that the Pi could be reached at both ports, but nothing was coming out of the web server — no HTML at all. For whatever reason, it didn’t work.
Rather than beat my head against the wall, I figured I can live without running a web server from home. I have a couple of VPSes in the Oracle Cloud Free Tier, and I added the Caddy web server to one of them and began moving the sites over.
Aside: Say what you will about Oracle and evilness, and I’m probably at the point where I should be paying for servers (and I have in the past). But it’s hard to turn down the two free-forever VPSes I’m getting under the Free Tier. Sure there are stories about them disappearing, but I’ve had these two for over a year, everything is backed up, and it’s been smooth and consistent.
Moving the certificates for https from the Pi (Debian 12-based Raspberry Pi OS) to the VPS (AlmaLinux 9) was a bit of work. I did some significant Googling to figure it out.
Turns out I couldn’t just wholesale move the entire directory over like some Caddy forum posts suggested. I had to download everything, upload to it all the new server, and then do a lot of cp/chown/chmod to get things right, only moving certs and not other config files. I only figured this out after moving everything and not being able to start Caddy. I had to roll back and move little by little, making sure permissions and ownership were right. This should be easier.
It was a stumbling block, but I got it done, switched my DNS to the VPS, and I was indeed off to the races, moving site by site.
The next part was changing all my rsync deployment scripts so they pointed to the VPS and not the Pi. There are always stumbling blocks. It turns out I hadn’t previously used rsync with the Oracle servers.
I had to make some tweaks. Of course OpenBSD and Fedora Silverblue handled rsync differently. In Fedora, the rsync lines only worked without pointing to the special key that Oracle creates for you. In OpenBSD, I had to call for the key in the rsync line.
So I did get the rsync script working on both of the OSes I run on my laptops.
My next move is figuring out a way to back up my GoToSocial server with a lighter file load. Martin “Wimpy” Wimpress mentioned on Linux Matters that he wrote a script to back up GtS and SQLite in such a way as to only “keep” my local users’ media files and not every file on the system (which is a LOT of files). My GtS uses PostgreSQL, but maybe I can appropriate the part of his script that backs up the media files and make it so I can continue backing up from my GtS server to the Web server, which has a significantly smaller file load.
I have been thinking about getting my own router that will offer WiFi 6 and hopefully have as good or better coverage as Spectrum’s $7/month router. Then I could save that $7 and also likely return to self-hosting with the Raspberry Pi.
But for now this is a workable situation: The Raspberry Pi is still on the local network, where I’m continuing to play with the Samba server I installed on it. I might also try the Pi as a backup server, though the speed of its USB flash drive could be a limiting factor.
And the two AlmaLinux 9 Oracle servers are set up, stable and reliable. And very much free (as in beer).
#almalinux #cloud #oracle #vps #web_server #caddy #raspberry_pi