Part 1: Creating Your Own Mastodon Instance — Getting Started

Mastodon Giganteus Skeleton Fossil Illustration

Creating Your Own Mastodon Instance Series

Part 1: Creating Your Own Mastodon Instance — Getting Started
Part 2: Creating Your Own Mastodon Instance — DigitalOcean and NGINX
Part 3: Creating Your Own Mastodon Instance — Docker and Mastodon
Part 4: Creating Your Own Mastodon Instance — AWS S3 and CloudFront

Mastodon

Introduction
Before You Start
Decide on your Domain
SSH Keys
What’s Next?

Social media is changing. The old forms aren’t as relevant. The old sites are filled with hostile actors and a distinct lack of accountability. Mastodon is a new form — it’s an open-source (GitHub link) micro-blogging social network application inspired by GNU Social that is built on the idea of “federation,” or a network of networks. The best part is you can run an instance of Mastodon yourself.

I did. You can find my instance at https://mastodon.observer . It’s been a fun process.

An important concept in distributed social networking is making a federation of instances. Federating allows a network to scale by connecting nodes, instead of scaling by one site getting bigger and bigger. If another Mastodon instance shares a similar theme to my instance, I’ll federate with them. Then my instance can read the toots (micro-blogs or posts) from the other instance. I’ll federate with other instances that share the same criteria I have for posting. If we both require the use of content warnings for graphic content or if we both ban hate speech, then we might federate with each other. This allows networks to form in a distributed manner. Meanwhile, each instance may develop its own subculture by the main personalities than broadcast on that site. This is a more natural kind of social network than the monoliths which currently dominate the industry.

There are a lot of reasons why no longer using the popular social media sites of our day [name omitted here for sanity’s sake] is a good idea. Some people have already discussed that, and I will save that for another blog post. However, here’s the “elevator pitch”: “[Social network you’ve heard of] but without the [hate groups you’ve heard of].” Also, if you’re interested in social networks that have a different approach to privacy than the ones that currently dominate the internet, you might want to look into it.

[Social network] but without the [hate groups].

The technical know-how necessary to run a Mastodon instance is not trivial. That said, with persistence, I think many people would be surprised at how easy it is to run a social network.

You can run an instance of Mastodon yourself.
Running your own instance of Mastodon, heck yeah!

There are already a number of guides for running your own Mastodon instance, notably the official documentation. This article is meant to be read alongside the official documentation. There may well come a point when this guide is out of date and the official docs are correct. In that case, always follow the official docs. 👍🏼

I’ll walk through the process I used to start up my own Mastodon instance using Docker, NGINX, DigitalOcean, NameCheap, and AWS S3. I’ll be using a Mac with Sublime Text 3, iTerm2 and Oh My ZSH. This guide assumes some technical knowledge on your part, such as how to use Git and Nano. At the time of writing this, I still haven’t gotten it running, so we’ll be going in this process together. :D

Before you start

What kind of social network do you want? One where people don’t worry about being harassed? One with people who have a common identity as you, such as being a programmer or being an artist? This is an opportunity to be creative, to create something new and unexpected.

Look at the instance list. I have found there are several communities which have established strong presences on Mastodon. Creating a Mastodon instance means meeting those groups. What I can tell you is, you won’t find a lot of [hate group]. 👍🏻 In my case, I want to create a forum for a news and internet news feeds. Like an interactive RSS feed app. If you don’t know what an RSS feed is, click here.

Before figuring out what behavior an RSS feed should have, it can be helpful to trial run things for a while, manually. This is the mechanical turk portion of the product development lifecycle. You are figuring out what kind of behavior you want, and you can discover more useful behavior before every dedicating time to coding. So, I’m in the mechanical turk phase for now.

Olive Oconomowoc

Decide on your domain

The best Mastodon instances have fantastic domain names, usually with funny TLDs. I use NameCheap.com for buying domain names. Sometimes they’ll have sales so it will be even cheaper, but mostly domains there cost between $1 and $14 a year. Make sure to disable automatic identity protection, which they’ll charge you for if you don’t disable.

Once you’ve purchased [read: “rented”] your funny domain name, we need to point the domain name resolution to DigitalOcean. So, in your NameCheap dashboard, go to Manage for your domain name. Then, under Nameservers, select Custom DNS from the dropdown. Add a third nameserver and fill them in with the following values:

ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

Now, be sure to click the green checkmark on the right to save your changes and you’re done here. It can take minutes, hours, or even a full day for DNS resolution to update, though generally it’s pretty fast.

SSH Keys

Before setting up our infrastructure, I’d recommend getting your SSH keys in order. I personally have a couple computers in different locations that I’d like to use to connect to use to maintain my Mastodon instance. Try to add all your SSH keys before spinning up your instance, because it takes longer to add a second SSH key after creating your Virtual Machine (VM). If you want to add a second SSH key after initializing your instance, it’s going to be a little bit of a pain.

The command for Macs to copy your SSH key to your clipboard is:

pbcopy < ~/.ssh/id_rsa.pub

What’s Next?

In Part 2, we will sign up with DigitalOcean and start up our server. Once that’s running, we can configure NGINX and LetsEncrypt. In Part 3 we’ll install Docker and the Mastodon application code, configure them, and run them.

Stock Photography with a license for commercial reuse with modification without attribution

Thanks.