- Top View Labs
- Posts
- Hosting Small Projects Like It's 2008
Hosting Small Projects Like It's 2008
15 years ago, I used to host my small projects on a linux box that I managed myself. Now that feels compelling again because of some new tools.
I'll be honest - I really don't want to go back to using rsync to move PHP files on to a Rackspace VM. For the last decade, it's always been my advice to use Heroku, or something like it, for hosting small projects. For a long time Heroku's free plan worked well enough. It meant I didn't have to write my own deploy script or remember how to actually configure SSL for NGINX. I didn't have to worry about firewall settings or keeping postgres up to date.
For side projects, living in a PaaS started to feel like death by a thousand cuts, mostly on my credit card:
I would hit the row limit on the free database and need to upgrade.
I would want to keep a history of my logs and would need to plug in Papertrail.
I would need background workers so I would add dynos.
I would be interested in performance so I would add New Relic.
It wasn't hard to quickly go from the free tier to having a recurring $100 charge every month for a hobby project. This was more than I paid for my cellphone service. I shouldn't be paying the same amount to host a poor ripoff of a todo app.
There are some new tools that have come along that make self hosting projects on a linux box a compelling again.
Docker
In the old days, I had two options when it came to what version of a tool I wanted to run on my server. I could use the version that came with my OS's package manager, or install my own. I had to deal with the fact that I couldn't use the latest and greatest postgres features. Or, I could dig through articles online and figure out how to install the version I wanted myself. Either way, I ended up using the same version of the tool for every project I worked on.
Now with Docker, I only need to install packages that the base system needs. Usually these end up being docker and some tool like tmux and vim. Each project can then have it's own docker compose file. There I can specify what ever versions of a tool that I want for that project.
Docker also means that it's much easier to deploy full open source apps. For app monitoring, I can install Grafana, Promethus, and Loki in 50 lines of yaml. For analytics I can setup the self hosted versions of Plausible or Posthog. Sentry has a self hosted version that I can use for exception tracking. If I ever out grow these, I know that I can graduate to the hosted versions of these without major changes to my app.
Tailscale
It's work to have a free server that's from wherever you happen to be physically. It's even more work to feel like that server is secure. I used to have to choose having a VM on my local home network or paying for one in the cloud. The local vm was free but inaccessible from the office or a coffeeshop. The cloud option was over $20 a month and I still needed to figure out how to properly secure it. Now with Docker, I only need to install packages that the base system needs. Usually these end up being docker and some tool like tmux and vim. Each project can then have it's own docker compose file. There I can specify what ever versions of a tool that I want for that project.
With a free Tailscale account, I can have virtualbox running a VM on my gaming desktop at home. It can have no ports open and I can SSH into it from my laptop anywhere on the planet. I can even expose an HTTP server to the open internet without opening any ports on my router using a Cloudflare tunnel.
I'm sure this was possible in the past with a VPN, but Tailscale made the setup process so easy that I actually did it. Sure, if my home internet or power goes out my side project will be offline, but my home fiber connection as proven reliable enough. If the power goes out I care more about the steaks in my freezer than I do my side project being offline.
Github Actions
Part of the magic of using Heroku for the first time was how dead simple it made deploying code changes. Just git push heroku and your changes were live. It does take some setup, but it's totally possible to setup github to deploy code to your self hosted server. Github Actions support self hosted runners. You can run these on your server to build docker images and trigger a docker to pull. Tools like MRSK may prove to make this possible with even less configuration.
Rough Edges
There's still some nice parts of PaaS that are hard to replicate in a self hosted server.
Offsite Backups - I would love a plug-and-play tool to regularly backup, transfer offsite, and easily restore my database. Heroku's postgres offering makes this easy to setup, and I'm never worried about data I send to S3. I still need to find a way to replicate this experience for my home server.
Email and SMS - I am not going to host my own MTA (I'm not a maniac), so there will always be some reliance on cloud services, even for small projects.
Batteries Definitely Not Included - There's no Right Way ™️ to set this up. One of the benefits of Heroku is that it's somewhat opinionated about how you host and deploy your projects. With self hosting you are going to be making all the decisions.
For a lot of reasons, I still advise startups to start in a service like Heroku, but I'm having a lot of fun seeing how far I can push my $0 a month home server.