My Self-Hosted Life

For those that know me, I’ve made no secret of the fact that I believe that you are better off doing something yourself than outsourcing the task to someone else, especially in areas that you are interested in or have some expertise. For me this has particular value in the case of my computing. As a result, I have taken the decision to self-host as much of my online services as possible, rather than relying on the cloud (since that’s just someone else’s computer). I’ve been working on this for years (actually the whole time this blog has been dark and before) and at this stage I’m mostly there: almost all of my digital life is provided by Open Source software, running under my control.

This post will detail what I’m using and how it all fits together. I’m not going to go into technical specifics since otherwise this post would be huge, perhaps I’ll focus on some of that in future posts (feel free to make requests in the comments). Also, please note that my setup is by no means finished and probably never will be, it’s an ongoing project and it has become pretty much my main hobby to install and maintain this stuff.

In the Cloud

I’m going to start right here, with this blog, since that was where the whole thing really started. This blog existed well before my undertaking to self-host. In the early days it lived on a shared hosting plan provided by Dreamhost. The site has always run WordPress, although I’ve toyed with the idea of moving to a static site over the years, I’ve just never quite managed it. In 2011 I moved the site to a shiny new VPS provided by Linode, where it has lived ever since. There is also a Piwik install for tracking website stats (which I’ve blogged about before).

The main motivation behind the VPS was to install and configure my own mail server setup, something which I ranted about shortly after. This setup has be serving myself and various family members well since then, with really very little maintenance on my part (almost everything is automated).

There have been various other uses for the VPS over time, many of which haven’t stuck. Probably the most successful has been an installation of TT-RSS, which started life on my home server and at some point moved to the VPS for convenience of access. I’ve also dabbled with various chat applications, mainly XMPP based, but they’ve never really been that useful due to the network effect of no-one else using them! At this stage email has become my primary form of communication.

You might say that this is a bit of a cop out, since this all runs on a virtual machine, which itself runs on someone else’s computer. I would agree, however it’s a nice middle ground between going all out with your own servers and running everything in the cloud. To me the reality that the VPS is in the cloud is obscured by the ability to control every detail of its running software. Its also pretty nice for services which I want to be reliable, since Linode almost never skips a beat.

At Home

So the VPS is one thing and is really used for critical services or stuff that needs to be accessible to the wider Internet (like this site), but the real magic happens on my home servers (yes, there is more than one). My main server (now on its second hardware iteration) started life as a MythTV system and still does a great job in this respect. Many other services have been added over time, such as an MQTT broker (mosquitto), git server (gitolite+gitweb), a calendar/contacts server (Radicale) and file synchronisation (Syncthing). At some point I also switched out the MythTV frontend and replaced it with XBMC (now Kodi).

In the last couple of years I’ve been moving further down the home automation route, rather than just sensing and logging via MQTT. I’ve finally settled on Home Assistant as my automation controller and UI, along with an instance of Node-RED to do some miscellaneous processing. This all runs on the main server, with a Raspberry Pi 2 in the garage functioning as what I like to call ‘the gateway’ (it has a couple of radios and some sensors connected and runs another instance of Node-RED to shuttle this data to MQTT). In addition I have my home CCTV set up using a couple of webcams and MotionEye. One of the cameras is located remotely and connected to another Raspberry Pi (this time an old model B) and streams back to the main server with mjpg-streamer.

I also run a pfsense based firewall to protect my network and provide remote VPN access. This runs on an old netbook with an extra USB ethernet adapter. The internal network is partitioned using VLANs to provide a separate firewalled subnet for the home automation gear, some of which is cheap Chinese stuff which needs to be forcibly prevented from talking to the cloud. The networking gear consists of two TP-Link routers, flashed with OpenWRT which provides nice VLAN support. These have been configured to just provide switching and wireless access points and delegate all the firewalling, DNS and DHCP stuff to the firewall.

Within the last year or so I’ve been working on streamlining the management of all of this. The principle focus of this has been monitoring all the services I’ve got running. For this I’ve settled on Nagios, which I run in a separate VM hosted on the main home server. Although complex to set up, I can’t talk highly enough of Nagios, it’s brilliant and it saves me so much time just by knowing what is going on on my network. Email notifications from Nagios of course go via my own mail server! I’ve also played around with collectd, InfluxDB and Grafana for performance graphing, although I’ve yet to deploy this to everything.

Conclusion and The Future

So that was a probably non-exhaustive list of my self-hosting activities. I’m sure I’ve probably forgotten many things and of course there are the huge amounts of supporting software that I haven’t mentioned. As I said, I’m now at the stage where this meets almost all my computing needs although there are a few areas where I want to improve.

The main thing is automating and persisting my configuration, since I’m still mostly doing things manually. For this I’ve settled on a combination of Ansible and Docker. I’ve played extensively with both but haven’t really made much progress with deploying them for much more than testing purposes.

I’m also constantly evaluating new software to fill gaps in my ecosystem. I’m currently looking at Rocket.Chat and Hubot to provide a chat based interface for remote administration, but don’t have a usable system yet. I’m also toying with the idea of a Gitlab server to replace the gitolite+gitweb system and to utilise the CI in my automation strategy, but I’ve heard it requires a bit in terms of resources (incidently gitlab.com is really the only 3rd party service I heavily use).

That I am able to do this at all is a testament to the power of Free and Open Source software and cheap commodity hardware. I find it pretty awesome to think that almost every interaction I have online utilises my own infrastructure and that it works tirelessly for me 24/7.

I’m only just getting started documenting my setup here, for instance this post hasn’t touched on any of the client applications I use on my phone and desktop machines. I’m also going to do some more technical posts on various aspects as time goes on, so please stay tuned (or even subscribe to the RSS feed or mailing list!).

15 responses to “My Self-Hosted Life”

  1. Frederic Avatar
    Frederic

    Nice setup, quite extensive!

    An alternative to Gitlab.com that is

    – Less resource hungry
    – Still Open Source
    – Still better than gitolite+gitweb

    would be the Gogs project (same concept as Gitlab but written in Go)

    https://gogs.io/
    https://github.com/gogits/gogs

    🙂

  2. Rob Connolly Avatar
    Rob Connolly

    Yeah, I’ve played a bit with Gogs before. It’s pretty nice, but lacks a lot of features compared to Gitlab (I’m especially interested in the CI stuff).

  3. Federico lucifredi Avatar
    Federico lucifredi

    Do you have static IPs at home? How many, and what provider/how much do you pay?

    Thanks! -F

  4. Rob Connolly Avatar
    Rob Connolly

    No static IPs, I’m using Dynamic DNS with DuckDNS. The VPS obviously has a static IP.

  5. Deepak Avatar
    Deepak

    Have you tried Nextcloud thats recently forked from Owncloud. I use that in my setup for home.

  6. Rob Connolly Avatar
    Rob Connolly

    No, not tried that since the fork. I’ve tried it a couple of times in the past and always had issues with the syncing.

  7. sudshekhar Avatar
    sudshekhar

    Hey, interesting setup. In a future post, could you please elaborate your home setup in more detail (the things you measure, tools/software used)? Would love to know more about it.

  8. Rob Connolly Avatar
    Rob Connolly

    I’d be happy to, but I’m not sure I know what you mean. This post has detailed most of the software I’m currently using. I’m going to go into more detail about the home automation at some point, if that’s what you’re interested in?

  9. Rick Avatar
    Rick

    Followed this from HN. You mentioned that you have automated some of this already, but I couldn’t find any code on your github. Do you think your automation is in some sharable state as I want to do the same on my home servers?

    Related: cloudron.io is working on a self-hosting platform as well. It has some of the apps you mention like Rocket.Chat, Gitlab already. Maybe you can reuse them (or contribute there).

  10. Rob Connolly Avatar
    Rob Connolly

    Most of the automation is just updating the software on the servers and also updating the TLS certs with Certbot/Let’s Encrypt at the moment. I have been working on some automated deployment stuff with Ansible, but it’s not in a state where I’m willing to share yet. I’ll try and clean it up and do a post on some of it sometime, so keep an eye on the blog.

    I’ve looked briefly at cloudron.io and sandstorm.io (which is similar) recently. Both look interesting, but difficult to integrate with my existing setup. Definitely worth keeping an eye on though.

  11. Josh Avatar
    Josh

    If you lose internet connection entirely (say, a tree falls on the wires), and you are at home:

    – Do you get notified?
    – What local functionality breaks (if any)?
    – Do any services crash or are unable to re-start? (I have had a few like this when they hang on git-pull if there is a local DNS server)

    If you’re not sure, may I suggest testing it out?

  12. Rob Connolly Avatar
    Rob Connolly

    I’ve actually had this happen since our ISP had a 12 hour outage earlier this year. I currently don’t get notified, but if I’m at home it’s pretty obvious. Nothing local seemed to break, only things like outgoing email will stop, but will be buffered (the same reason I don’t get notified). I obviously lose access to everything on the VPS, but haven’t had anything on the local LAN fail or crash.

  13. My Home Automation Setup | Blogging to Nowhere

    […] previously documented Home Assistant runs in a VM on my main home server. It talks mostly to devices in an isolated […]

  14. Self Hosting Update | Blogging to Nowhere

    […] My Self-Hosted Life […]

  15. Self Hosted Push Notifications with Gotify and Home Assistant

    […] to the current communications device of choice – the smartphone. Of course, this breaks my fully self hosted ethos and is to be avoided. Luckily it’s now possible to achieve self hosted push […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Bad Behavior has blocked 295 access attempts in the last 7 days.