Source Code

Our goal is to provide the best possible Mastodon experience for our members. One way to deliver on that is by delivering the most up-to-date Mastodon code. We "run off main", which means using the latest commits to the main branch of the Mastodon codebase found on the project's official GitHub repository.

We take a clean copy of the latest Mastodon code and then apply a limited set of modification with a custom script. We then build the modified code inside a Docker container, publish it to GitHub and Docker Hub, for consumption by our Kubernetes cluster.

Our instance specific customizations include:

Container Availability

Primary Image

Our customized container image is available from both Docker and GitHub container registries. This is suitable for the web/Puma and Sidekiq services.

Streaming Image

Mastodon 4.3-based images and beyond use a seperate container image for the Streaming API.

Redis TLS Changes

DigitalOcean requires encrypted/TLS connections to their managed Redis instances, however the Mastodon codebase uses a Redis driver (hiredis) which does not have a native TLS capability. To accommodate this, we have in the past used HAProxy or Stunnel to take the un-encrypted connection requests and encrypt those connections between the Mastodon components and Redis.

We have chosen to remove the hiredis driver from our installation and use redis-rb instead. Using the native redis-rb driver provides support for TLS connections. This is done by patching a stock Mastodon installation with the following commands, downloading updated bundles and node components, and recompiling:

sed -i '/gem '\''hiredis'\'', '\''~> 0.6'\''/d' ./Gemfile
sed -i '/hiredis/d' ./Gemfile.lock
sed -i '/hiredis/d' ./lib/mastodon/redis_config.rb
sed -i '/hiredis/d' ./lib/tasks/mastodon.rake
sed -i 's/, driver: :hiredis//g' ./app/lib/redis_configuration.rb
sed -i 's/, require: \['\''redis'\'', '\''redis\/connection\/hiredis'\''\]//' ./Gemfile

Compared to running with hiredis through HAProxy or Stunnel, we have not seen any negative impact in performance by using redis-rb.