Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM tootsuite/mastodon-streaming:v4.4 as streaming
FROM tootsuite/mastodon-streaming:v4.5.7 as streaming

FROM tootsuite/mastodon:v4.4
FROM tootsuite/mastodon:v4.5.7

USER root

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.redis
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM redis:alpine
FROM redis:7-alpine
ADD start-redis-server.sh /usr/bin/
RUN chmod +x /usr/bin/start-redis-server.sh
CMD ["start-redis-server.sh"]
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ fly apps create mastodon-example
### Secrets

```bash
export SECRET_KEY_BASE=$(docker run --rm -it tootsuite/mastodon:latest bin/rake secret)
export 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 | sed 's/\r//' | fly secrets import
export MASTODON_VERSION=v4.5.7
export SECRET_KEY_BASE=$(docker run --rm -it tootsuite/mastodon:$MASTODON_VERSION bin/rake secret)
fly secrets set SECRET_KEY_BASE=$SECRET_KEY_BASE
docker run --rm -e SECRET_KEY_BASE=$SECRET_KEY_BASE -it tootsuite/mastodon:$MASTODON_VERSION bin/rake mastodon:webpush:generate_vapid_key | sed 's/\r//' | fly secrets import
```

### Redis server
Expand Down Expand Up @@ -134,15 +134,17 @@ If your instance is getting slow or falling over, you may find [Scaling Mastodon

### Upgrading Mastodon

To upgrade to a new version of Mastodon, change the version number on the first line of `Dockerfile`, and then check the [release notes](https://github.com/mastodon/mastodon/blob/main/CHANGELOG.md) for upgrade instructions.
To upgrade to a new version of Mastodon, update the Mastodon image tags in [`Dockerfile`](./Dockerfile), and then check the [release notes](https://github.com/mastodon/mastodon/blob/main/CHANGELOG.md) for upgrade instructions.

If there are migrations that need to be run, make sure that the release command in [`fly.toml`](./fly.toml) is uncommented.
This repo keeps the Fly release command enabled in [`fly.toml`](./fly.toml), so standard post-deploy migrations run automatically during `fly deploy`.

Before upgrading to Mastodon 4.5.x or newer, make sure your Fly Postgres app is already on PostgreSQL 14 or newer and your Redis app is already on Redis 7 or newer.

If there are migrations that must be run before deploying to avoid downtime, you can run the pre-deploy migrations using a second app. By scaling this app to a VM count of zero, it won't add to our bill, but it will let us run the pre-deploy migrations as a release command before the web processes get the new code.
```bash
fly apps create mastodon-example-predeploy
bin/fly-predeploy secrets set OTP_SECRET=placeholder SECRET_KEY_BASE=placeholder
bin/fly-predeploy secrets set SECRET_KEY_BASE=placeholder
bin/fly-predeploy secrets set $(fly ssh console -C env | grep DATABASE_URL)
bin/fly-predeploy scale memory 1024
bin/fly-predeploy scale count 0
Expand Down
9 changes: 5 additions & 4 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ swap_size_mb = 1024
[[vm]]
memory = "1024"

## Uncomment if you are upgrading Mastodon. See README.md for details.
# [deploy]
# release_command = "bin/rails db:migrate"
## Keep standard post-deploy migrations enabled.
## Use fly.predeploy.toml for releases that require pre-deployment migrations.
[deploy]
release_command = "bin/rails db:migrate"

[env]
LOCAL_DOMAIN = "social.python.it"
Expand Down Expand Up @@ -52,7 +53,7 @@ swap_size_mb = 1024
# rails = "./overmind start -x rails"
# # If you need to run more sidekiq workers, scale up this group
# # by running `fly scale count N --group sidekiq`
# sidekiq = "bash -c 'bundle exec sidekiq -c $MAX_THREADS -q default,8 -q push,6 -q ingress,4 -q mailers,2 -q pull'"
# sidekiq = "bash -c 'bundle exec sidekiq -c $MAX_THREADS -q default,8 -q push,6 -q ingress,4 -q mailers,2 -q pull,1 -q fasp,1'"
# # The schedule queue can only ever have one worker process at a time
# # by running fly scale count 1 --group schedule
# schedule = "bash -c 'bundle exec sidekiq -c $MAX_THREADS'"
Expand Down