Skip to content

thechangelog/changelog.social

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Changelog's Mastodon on fly.io

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

Setup

App

$ fly apps create --region iad --name changelog-social
$ fly scale memory 1024 # rails needs more than 256mb

Secrets

$ 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 server

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

Storage (user uploaded photos and videos)

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.

Option 1: Local volume
$ fly volumes create mastodon_uploads
Option 2: S3, etc
$ 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.

Postgres database

$ fly pg create --name changelog-social-pg
$ fly pg attach changelog-social-pg
$ fly deploy -c fly.setup.toml # run `rails db:setup`

Deploy

$ fly deploy

Upgrade

  1. Update Dockerfile with the new version reference
  2. Run fly deploy

About

Changelog's Mastodon on fly.io

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 62.6%
  • Shell 37.4%