
This site was born largely from a solution looking for a problem. In late 2022 I began looking into a good, low-cost solution to allow self-hosting a limited number of services locally. While any used hardware would likely work well enough for a small server, a priority for the build was power efficiency, given it would need to be powered 24/7. This culminated in a ‘no-name’ NUC with an Intel N100/8GB RAM/256GB SSD as well as a refurbished 8TB drive (Ultrastar HE8). With wifi AC, the NUC would be more than sufficient for both local and remote use cases without requiring hard-wiring and conveniently calculated out to less than $15/yr in electric consumption. One wipe/install of Ubuntu server edition later and the stage was set.
The initial configuration of this server was to provide storage hosting for backups as well as robust support for Plex. With Intel Quicksync and a decommissioned enterprise drive, it could handle these tasks quite well. Over the coming months the scope of this project quickly turned into one of best practice, with server hardening implemented, automated backups & basic email health checks. In this manner it continued for several years, with a few more drives and a RAID 1 array added along the way for redundancy.
Hosting a website has always intrigued me from a technical perspective but never found a valid reason to do so, especially with professional priorities being in another realm of expertise. The desire to add a portfolio finally allowed for this to be explored. However, I found myself faced with a server already running multiple services, as well as the possibility of hosting multiple sites. What’s the best practice here?
Enter Docker. Containerization has been another solution I’ve found intriguing but with no real ‘use case’ as of yet. However, docker solves both problems I had been presented with thus far and with a negligible performance overhead (important for a low-tdp 4 core CPU). After a false start or two, I found Docker to be an incredibly straightforward solution for hosting multiple services on the same instance. With Docker compose containers can be spun up, tested, recreated and reconfigured almost immediately which allows for rapid development of the WordPress environment. Later, this would allow for quick migration of all ‘legacy’ services running bare-metal to the docker environment. Thus was born a containerized LAMP stack, containing all dependencies and fully-automated certificate renewal (letsEncrypt + certbot is a blessing with the upcoming 47-day lifetimes).
The biggest challenges with docker turned out to not be implementation, but adhering to appropriate permission structures. Services being containerized, combined with the strict Linux file permission structure resulted in instances where a rebuilt container would suddenly be unable to access prior docker volumes, or have persistent issues with inheritance on bind-mounted volumes (pass-through mounts to the hosts filesystem). Thankfully Docker allows for user UIDs to be specified in the docker config, allowing for containers to be grouped together running under user contexts that make sense for their use cases and preserve least-privilege.
The end result has been a low-cost, high-performance locally hosted solution I am able to support and maintain easily with automation taking care of the heavy lifting for backups and updates. Security can be controlled per-service with minimal risk of disruption to other services if a potential compromise occurs due to the attack surface reduction allowed by Docker and OS-level controls (I.E. appArmor). If a compromise does occur, continuity can be restored quickly with a rebuild of the container & restoration of the container volume state from regular backups. A VPS in the cloud allows for constant uptime monitoring of all services with a local service monitoring the VPS instance, sending text notifications if continuity is ever disrupted.
Next steps for this project I believe would be to improve availability, as power and networking can be a weak point. LiFePO4 UPS appear to be a good solution but could potentially eclipse the cost of the entire setup. Low-power ‘UPS’ solutions running off of 18650s remain an intriguing solution as modem/router/NUC would not exceed amperage limits but could have reliability concerns. This may be the next direction to take to continue improving on the existing infrastructure.