diff --git a/Dockerfile b/Dockerfile index 79c125b..f7ba51d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Dockerfile.redis b/Dockerfile.redis index 8dcd469..5209fcf 100644 --- a/Dockerfile.redis +++ b/Dockerfile.redis @@ -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"] diff --git a/README.md b/README.md index 6c5b2dd..baeaf85 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/fly.toml b/fly.toml index 3c9aa28..f356f24 100644 --- a/fly.toml +++ b/fly.toml @@ -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" @@ -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'"