Mastodon is a free, open-source social network server based on ActivityPub.
The Mastodon server is implemented a rails app, which relies on postgres and redis. It uses sidekiq for background jobs, along with a separate nodejs http streaming server.
Docker images: https://hub.docker.com/r/tootsuite/mastodon/
Dockerfile: https://github.com/mastodon/mastodon/blob/main/Dockerfile
docker-compose.yml: https://github.com/mastodon/mastodon/blob/main/docker-compose.yml
$ fly apps create --region iad --name changelog-social
$ fly scale memory 1024 # rails needs more than 256mb
$ SECRET_KEY_BASE=$(docker run --rm -it tootsuite/mastodon:latest bin/rake secret)
$ OTP_SECRET=$(docker run --rm -it tootsuite/mastodon:latest bin/rake secret)
$ fly secrets set OTP_SECRET=$OTP_SECRET SECRET_KEY_BASE=$SECRET_KEY_BASE
$ docker run --rm -e OTP_SECRET=$OTP_SECRET -e SECRET_KEY_BASE=$SECRET_KEY_BASE -it tootsuite/mastodon:latest bin/rake mastodon:webpush:generate_vapid_key | fly secrets import
Redis is used to store the home/list feeds, along with the sidekiq queue information. The feeds can be regenerated using tootctl
, so persistence is not strictly necessary.
$ fly apps create --name changelog-social-redis
$ fly volumes create -c fly.redis.toml mastodon_redis
$ fly deploy --config fly.redis.toml --build-target redis-server
The fly.toml
uses a [mounts]
section to connect the /opt/mastodon/public/system
folder to a persistent volume.
Create that volume below, or remove the [mounts]
section and uncomment [env] > S3_ENABLED
for S3 storage.
$ fly volumes create mastodon_uploads
$ fly secrets set AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=yyy
See lib/tasks/mastodon.rake for how to change your [env]
section for Wasabi, Minio or Google Cloud Storage.
$ fly pg create --name changelog-social-pg
$ fly pg attach changelog-social-pg
$ fly deploy -c fly.setup.toml # run `rails db:setup`
$ fly deploy
- Update
Dockerfile
with the new version reference - Run
fly deploy