From 5ee2d98b40f43c8338666fbc9efd1adcf1d6c1b3 Mon Sep 17 00:00:00 2001 From: Dave MacDonald Date: Sun, 4 Dec 2022 18:32:08 -0500 Subject: [PATCH] rake mastodon:setup: Restore Redis config prior to creating an admin user --- lib/tasks/mastodon.rake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index c1e5bd2b454..7bde2f0da71 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -470,6 +470,15 @@ namespace :mastodon do require_relative '../../config/environment' disable_log_stdout! + # With the environment now reloaded, update Sidekiq to use the Redis config that was provided earlier interactively, in case it differs from the default localhost:6379. + # When the admin user is created, User dispatches an 'account.created' event to Sidekiq, which connects to Redis. + Sidekiq.configure_client do |config| + new_params = REDIS_SIDEKIQ_PARAMS.dup + new_params['url'] = "redis://:#{env['REDIS_PASSWORD']}@#{env['REDIS_HOST']}:#{env['REDIS_PORT']}/0" + new_params.freeze + config.redis = new_params + end + username = prompt.ask('Username:') do |q| q.required true q.default 'admin'