This repository hold the code to deploy EPFL's Mastodon server with Ansible.
It can be accessed at https://social.epfl.ch.
Since February 2025, EPFL host its own instance of Mastodon on https://social.epfl.ch.
Mastodon is an open source, self-hosted, social networking service. Mastodon uses the ActivityPub protocol for federation which allows users to communicate between independent Mastodon instances and other ActivityPub compatible services. Mastodon has microblogging features similar to Twitter, and is generally considered to be a part of the Fediverse. (Read more on wikipedia)
This repo uses Ansible with a wrapper that install it locally called
Ansible suitcase. The Mastodon blocks are deployed with Docker on the
remote hosts, following the official Docker deployment method1. It results
of the deployment of 5 containers (mastodon-web
, mastodon-postgresql
,
mastodon-redis
, mastodon-sidekiq
and mastodon-streaming
). Containers
prometheus
, node-exporter
and alertmanager
ensure some basic observability
and alerting. On top of that, the traefik
containers deals with all HTTP
requests and offers the Let's Encrypt TLS certificate to users.
./mastodonsible
By default this will deploy on the test inventory. Use --prod
to use the
production inventory. If needed, you can use --protect
to add a basic
authentication middlewar in the Traefik setup.
Note
Due to the instrumentation of the Mastodon metrics inside the Mastodon image, you will have to push an updated version of mastodon-web/Dockerfile with the correct Mastodon version that will be cloned and built on the target. Version has to be changed in vars/versions.yml too.
The configuration as code will deploy everything in /srv
:
/srv/backups
/srv/mastodon
/srv/prometheus
/srv/traefik
While folders name are self-explainatory, the storage is not always the VM's disk. We have 2 (ceph) volumes mounted in the VM. They are using LVM. One is for the backups, the other one for the data that may grow with time (mastodon upload and cache, prometheus data).
root@mastodon:~# lsblk
vda 100G disk
└─vda1 100G part /
vdb 50G disk
└─vdb1 50G part
└─mastodon--backup-backup 40G lvm /srv/backups
vdc 400G disk
└─vdc1 400G part
├─mastodon--data-web 25G lvm /srv/mastodon/web
├─mastodon--data-cache 100G lvm /srv/mastodon/web/public/system/cache
└─mastodon--data-prometheus 15G lvm /srv/prometheus/data