With the recent Nazi takeover of the 🐦 site I, like many others, decided to switch to Mastodon 🐘. However, I wanted to run my own instance. So I went through a few approaches until I found one that worked pretty well. This is using Digital Ocean as my cloud provider.
- Droplet for running the app - I went with a 2GB/1vCPU box ($14/mo) since that's what was recommended for the Mastodon 1-click app. I originally tried the 1-click but wasn't able to get it working. (1-click is DO's way to set up an already-provisioned server, kinda like an AWS AMI image.) Follow the Mastodon docs for installing and running the app.
- PostgreSQL managed database ($15/mo) - I decided to go with a managed DB so I don't have to keep up with securing/updating it as much. Once the instance is ready, create a new
mastodon
DB user and create amastodon_production
database as well. - Connection Pool for the database (included w/managed db) - By default only 22 concurrent connections are allowed to the database, and with running 2 Mastodon instances against the database, I was eating through those pretty quickly. So I set up 2 connection pools, one for each Mastodon instance with 10 connections each. Connection pools allow up to 5,000 concurrent connections each. I'd recommend setting one up with the database initially so you don't have to switch to it later.
- Spaces for assets ($5/mo for 250GB) - Spaces is DO's S3 equivalent, used for storing user assets.
So overall it's running $34/mo to run a single instance, or $48 for 2 instances since I'm sharing the managed database engine between the two. Maintenance has been minimal, mostly just upgrading the Mastodon code occasionally to stay up-to-date.