Deploying a tiny Mastodon server on DigitalOcean

Given the current bin-fire state of Twitter it seems entirely reasonable that everyone I know there is building a survivalist-style-bunker on Mastodon. But there’s a pretty immediate roadblock that faces every person trying to set up a new account: which server to choose?

While Twitter is monolithic – one site, one account, one @name – Mastodon is a system of interlinked, discrete servers – each run by some third party. So which one to trust? The number of choices avaiable is bewildering, and the problem is compounded at the moment by most of the bigger, general-purpose servers being overwhelmed by new accounts and limiting registration.

One other option – and probaby a bad one, in most cases, I can’t stress this enough – is to make things even worse by setting up your own server. In my case, I’m running one at, initially just to host my own account.

In case you’re tempted to do the same, I thought I’d put some notes here.

In order to get up and running in the quickest and easiest way you will need:

  • To be comfortable with DNS, SSH and AWS/S3
  • A domain name to spare (subdomains are possible, but a bit more faff)
  • An SMTP server to use (I have a account, which works well)

If you have all the above, the quickest way to get started is to use the DigitalOcean Mastodon droplet. Set up an account (if you use this referral link, that helps pay for my server) and deploy the droplet to a new Project.

You will need to choose a spec for your virtual server: I’ve seen several people recommend one with 2x vCPU and 4GB, which seems sensible. I am not sensible, so tried to run it on the cheapest $6/mo server – don’t do that, it failed all over the place. I’m currently on 1x vCPU and 2GB RAM, which seems to work fine for one user.

After deployment and before configuration, set up your DNS on Digital Ocean. You need this set and working before running the setup scripts, as otherwise your SSL config will fail.

You will also need to provision some storage for media. The simplest option – expected by the setup script – is an S3 bucket. Create a bucket, noting the name and region, and then a user. The required access policy JSON can be found here.

Once DNS and AWS are ready you can SSH into the server. An initial configuration script runs, asking you for things like:

  • Your domain name
  • Your AWS bucket, region, access keys etc
  • Your SMTP server and credentials
  • A name for your admin account

Copy and paste them all in, and you’re 90% of the way there. A Lets Encrypt SSL certificate is provisioned, and the server’s web interface will come up, ready to poke around in. You might want to tail the logs:

sudo journalctl -u mastodon-web -f

.. to look out for any errors.

Finally, some warnings:

  • Disable open registration. Right now. Unless you want the cost and legal responsibility of running an open server
  • Keep an eye on your S3 costs! The server will be almost constantly fetching and storing media, and you pay the bill
  • You’ll probably also want to install extended metrics, because inexplicably DigitalOcean doesn’t log memory usage by default

I’m going to keep my server up for a few weeks and see how it goes – maybe it’ll be a good alternative to the bird site for a few dollars a month, or maybe I’ll burn it to the ground and run away to a big server once registrations open again.

I will add updates here as and when. But for now, find me at:

UPDATE 11th November:

A few quick notes to add to this after almost a week of uptime:

  • Memory usage is a bit of a problem. I added a 2GB swapfile, for which you’ll find a handy guide here.
  • If you’re more serious about hosting in the long-term, this guide from Brett Lempereur details how to set up using DigitalOcean’s hosted PostGres and Redis
  • After adding two relays to increase federation, my S3 usage began to get out of hand: around 15GB this morning
  • You can remove old media files using tootctl – but that doesn’t work out of the box on DigitalOcean. Some useful info on how to work around is here.



, ,