Mastodon is a social network with a difference. In essence it is a Twitter-clone, but without the tracking and usage of your own data against you. It is an extension of GNU Social, but it seems to push the UI-first mentality of the indieWeb. I am not really a social media user, but I liked the look of this and felt that it was worth exploring. Additionally, when I'm stating to people not to use Twitter, Facebook e.t.c. that I have some kind of alternative.
You don't have to self-host Mastodon, and it seems that the vast majority of users don't. There are instances set up around specific interests but the largest instance is the more generic mastodon.social. While it's certainly easier to just register an account there (given the federated nature of Mastodon, you only need register on one instance to be able to interact with all others), I figured it would be more interesting to set something up myself.
I had tried to do this before on one of my own servers, but the reverse-proxying of Mastodon proved to be too much for me and I gave up. I figured that this might be an ideal time to give renting a VPS a go. I picked up a $5 a month instance with Vultr.com running Ubuntu 18.04, but it's clear that the company gives a lot of scope for experimenting. In all it took about 15mins to sign up, choose where I wanted to host my VM, upload an ssh key, set a new user and get going.
The install was simple enough to follow - I used this guide.
However, I ran into a few issues that I will document here should I ever go through this again…
Have the DNS entry of the instance sorted early in the process. For me this was a case of adding an “A” record for the prefix “Social” with my DNS provider. That way cshire.xyz heads to this site and social.cshire.xyz heads to the Mastodon instance hosted on the VPS. As far as I know the ip of the VPS is static so I didn't worry about setting up ddclient or any other dynamic DNS updater.
In Step 3 it takes you through installing Ruby. I found that there was a version mismatch with the Ruby environment and the gem commands that come after.
The guide states to run;
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.0 rbenv global 2.6.0
But I found that instead issuing;
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.5 rbenv global 2.6.5
At some point in Step 6 or 7 it compiles an awful lot of code to get Mastodon working. I found that my VM ran out of memory to compile. Upon searching the error message a post on another projects GitHub suggested that a lack of swap space might be the issue. I remembered reading that Ubuntu 18.04 was the first version to do away with swap space, so figured I'd try and add some. I found this guide on Digital Ocean and added some temporarily - I stopped at Step 4. This worked fine and the swap space (which isn't needed after Mastodon is installed) is disabled upon reboot.
Mastodon wants to be able to email alerts and notifications - ensure that you have SMTP set up beforehand! I used Sendgrid again, but if you are going to host an instance for many people this may not be a great idea due to the limitations on numbers of emails sent with the free plan.
That's pretty much it! I have been playing around with it a bit over the last few days. My instance is closed for signups…probably forever because that's not something I want to moderate. Also, I don't know how long I want to keep the instance around or if I'll even end up using it very much at all. I guess that's the joy of self-hosted software though, it's really to satisfy the user more than anything else, I can tear it down anytime I want to try something else!