Hosting Astrodon in the cloud

Hosting Astrodon in the cloud
Photo by Mel Poole / Unsplash

Finding a new home for Astrodon has been a challenge. As - like most Astrodon members - am based in the EU I need a hosting provider that will keep all data EU resident and GDPR compliant. I also need a hosting provider with strong commitment to sustainability, taking real action and not greenwashing through offsets. Oh, and they have to have a mature, easy to manage IaaS stack with clear documentation and supported tooling. No too much to ask, surely?

Obviously this rules out most providers immediately. One that makes the cut is Scaleway, an established French cloud provider with a substantial market presence. More importantly, they have a mature organisational approach to social responsbility and environmental sustainability that give me confidence I can operate Astrodon without actively contributing to making the world a worse place.

Oh, and they have a hosting facility in a nuclear bunker under Paris.

With a hosting provider selected, the next step is to get Mastodon up and running in a way that's easy to manage, fault-tolerant, and reproducible without requiring lots of manual work.

Whilst Mastodon's popularity has exploded in the last two years, the majority of Mastodon instances are small communities relying on shared hosting. Actual real-world experience - and more importantly, documentation - of configuring, deploying, and managing large scale Mastodon infrastructure is hard to come by. Mastodon's official documentation is enough to get a single instance running, but falls short of providing best practice information for deployment, or scaling.

Partly this is a question of adoption - there are only a handful of communities with more than a few thousand members - and partly it's one of domain knowledge - developers on open source projects are not often managing communities themselves.

Without official documentation, the only option is to piece together something that works from the experience of other community managers around the fediverse, and Iterate Until Good Enough™.

Which is where I am now. Roughly, here's how Astrodon is setup:

  • I have a load balancer with a frontend and backend configuration and failover to a static hosted site.
  • There's an S3 bucket with the 250GB of site media and remote cache.
  • I have a manually provisioned Postgresql service with data imported from the current Astrodon DB.
  • I have a Terraform config that provisions a network, instances, and volumes for the servers.
  • I have a hacked together provisioner in Terraform that deloys configuration files for Mastodon, and a docker compose file for the various services.
  • The same hacked provisioner brings up the docker services and runs health checks.

The hacked-together application deployment is my first target for replacement. I'm looking at building tooling around Github Actions / CI, which will help with the changes I want to make to the Mastodon app itself.

So far this setup works with a copy of the live data, and I've deliberately over-provisioned the infrastructure to try to make the switch as painless as possible. Once the service has been live for a few days and I've got a better idea of the performance profile I'll start the process of trimming the infrastructure and putting in place tooling for scaling as needed.