Our server setup

First, some history!

I started off my sysadmin adventures back in 2012. After learning Python, PHP and web for one and a half years, I discovered Node.js. Back then, there was quite a bit of media hype on Node.js and it's potentials. Having stronger JavaScript experience and used to the event-driven style of writing code, I picked it up in a breeze.

Now, that was at the age of 12 and I had no credit card, neither did I know of any free VPSes, nor could I explain to my parents what a VPS was. I had been using 000webhost to run a couple of sites written in PHP or static HTML, but I wanted to host Node.js apps.

I had a laptop. Or rather, I shared a family laptop, but no one else uses it so I had Ubuntu installed on the HP520 (with a long backstory on how I accidentally switched to Ubuntu). My home network was a "3G WiFi Router" that had horrible reception issues and was unstable, so I switched to a USB dongle attached to my laptop, and left my laptop on its side on my desk.

So that was it, my first server. I set up dynamic DNS and got a .uni.me free domain, had it running 24/7. Of course, there was always the occasional disconnect of the dialup 3G connection which kept pissing me off that I had to write a script to reconnect when it disconnects.

Okay, so that worked well for one and a half years, and then we got a fiber connection. Now that I had an actual wired LAN, I got a Raspberry Pi and moved over. By then I had even more files and apps being served from it, and it was set up with chromium showing videos on a display.

A while later, I had a schoolmate who upgraded his desktop, leaving behind an i7 860, with a motherboard and 4GB of RAM, which he gave me. So, I moved to that. With more Linux experience, I started going into virtualization and KVM. Running a virtual hosting environment in my home was my hobby that nobody understood

During the pre-MakerForce days, we participated in hackathons, and I also developed commongoods with a different group of friends (Hackathon@SST where we won first prize, got into another event and won top again, then ended up at APICTA). All of my team hackathon projects had Node.js backends that ran from that server, thus playing an important role in my learning.

I had quite a bit of prize money, so I went shopping for a new desktop that would be a server, custom-built. Here's photos of it from a more recent cleanup with my mech from Hack&Roll 2016.

I migrated over, revamped the filesystem and partition layout, user permissions, KVM and networking. Over the past year I've refined it even further, and as this is a quick and dirty setup, there are many holes I haven't filled in my management tools.

Because I wanted to support multiple users or sites, I created a filesystem layout that kinda looks like that:

/hosting/:
/hosting/users/: folders for each website or user
/hosting/users/[user]/nginx.conf
/hosting/users/[user]/domain.key
/hosting/users/[user]/signed.crt
/hosting/users/[user]/www/
/hosting/tools/: tools for management
/hosting/conf/: master configuration files included in /etc/ configurations.
/hosting/special/: nginx custom error code files, default favicon 
/hosting/virt/:
/hosting/virt/iso/: KVM ISO files
/hosting/virt/disk/: some less-used VM images

Another great part of my setup is that all my disks use LVM (except for swap and boot) and btrfs (except for the root fs). The flexibility of LVM allows me to do live resizes when I need to, and btrfs gives me snapshots, useful as a weak backup strategy for easy recovery and restore of files.

The worst part is the current networking setup. I'm using the stock RT-N56U M1 gave us, and it has it's occasional freezes. My server sits on the internal network and I'm port-forwarding all the services to the server, without any firewall set up on the server. This means that if you break my home's WPA2-PSK, you're halfway in.

To reduce the number of cables running around, I got a basic desktop switch. It's been reliable thus far. Soon, when I get two more NICs working, I may move to a pfSense VM as the router and use the RT-N56U as an AP. This will also make firewalling easier with the vast features available in pfSense, and improve my uptime significantly as I occasionally have to do router reboots and loose my IP address.