My Adventures in Self-hosting
I had 2 coding related new-years resolutions. Master python and make everything selfhosted. This post is about the second goal.
Don’t get me wrong, there are a lot of SaaS solutions out there that are awesome and take away the burden of having to manage a server but i really wanted to be able to control everything myself. I had already locked down my social media privacy settings, but wanted to take the next step to independence.
First on my list was this site. I had been thinking of moving it for some time as hosting it on Github pages and I finally did last year.
The next item was how to get off of Github and the random services I had connected into it like TravisCI and Coveralls. The part I struggled with here was the social aspect of it. Not so much stars, watchers, PR’s but more the exploration stuff (which sadly is not possible to get on selfhosted services). but at the same time I didn’t want to put up a barrier to prevent people from submitting something. Asking someone to create a user/pass just for my shitty git repo wasn’t an option. As luck would have it, Gitea, which is a fork of Gogs had just sprung up. Gitea has been much more active with regards to commits and one of those commits just happened to be supporting authentication via Github! I pulled the docker image and there I had my own private git instance.
So I had a solution to my git repo hosting, now what about replacing TravisCI and Coveralls? I’m glad you asked! This part of my self-hosting process ended up being a bit more work than I expected. To replace TravisCI I went with self-hosted Drone. Drone was pretty easy to get going since it comes as a Docker image so once I had it fired up I simply logged in and enabled it for the repos I wanted. Coveralls was next up on the list and surprisingly I didn’t find very many open source options. I found hoptocopter which actually just uses the native go test coverage tooling and then spits out one of those fancy badges via shields. That showed me that it wasn’t that hard to make your own custom testing paltform. To avoid having to call their API I used the wonderful shields docker image provided by beevelop. From there I just setup a Docker compose file that started up hoptocopter and shields together and bam! Instant code coverage badges. At this point I had basically re-created everything I had in Github. There were some things I couldn’t implement such as builds being triggered by PRs, but that wasn’t a huge deal to me so I considered it a success. Guess what I used to front these?
Previously this site had used Google Analytics for metrics. I actually like the product and enjoy seeing all of the cool data about my site but Google and privacy do not belong in the same sentence. My next goal was to rid myself of Google Analytics and find something I could run on my server but that still had an easy to use UI. I started looking into GoAccess. Really nothing to say about GoAccess outside of it just works. It parses the log files from Apache (Or nginx or caddy) and turns them into a pretty html page.
Password management, a great debate topic. Do you use a fancy hosted tool like LastPass or do you use something you can store locally like KeePass? The answer for me was neither, I have looked into pass which is a super simple (good) way to manage your passwords but still be able to access them on most devices including my Android phone. I am currently still using lastpass as that was the easiest for me (dammit SaaS, you nailed it)
Now I have to talk about the things I haven’t come up with a good solution for (yet). The biggest is e-mail. A few years ago I tried hosting my own mail server and did everything the internet says to do to avoid your e-mails being flagged as spam. Unfortunately that didn’t work and about 80% of my e-mails ended up in the spam folder. I am currently debating on using Protonmail which is great and I have no real problems with, it’s just that I don’t have those messages on my own server so I have to trust that everything they say they do is actually true. That’s a fairly big thing to do but at this point I just have to suck it up and deal with it. The second area is image and video sharing. Things like Google Drive or Google Photos are great products but again, Google. I’ve been looking around for some open source alternatives and haven’t found anything yet that meets my needs. I want to be able to send photos right from my phone to the app on my server and then send out generated links to family members to access those files all while keeping them hidden from everyone else. I’ve toyed around with hacking something together but I have to believe that an app like this already exists so I’ll keep searching.
I still have a bit left to do like moving all of my Github repos over to my Gitea setup but so far I’ve been enjoying the new freedom. Since most of these apps are pretty low maintenance I don’t really have to do much sysadmin type work which is great (although you can tinker around if you want). If that will still be the same six months from now I’ll just have to wait and see.