diff --git a/Procfile b/Procfile index 79daa90b..0eb0fccb 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,4 @@ cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all distributed_press_renew_tokens: bundle exec rake distributed_press:tokens:renew +que: daemonize -c /srv/ -p /srv/tmp/que.pid -u rails /usr/local/bin/syslogize bundle exec que diff --git a/config/application.rb b/config/application.rb index 446b5402..97ee63a2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -38,6 +38,13 @@ module Sutty config.active_storage.variant_processor = :vips + # Que + config.action_mailer.deliver_later_queue_name = :default + config.active_storage.queues.analysis = :default + config.active_storage.queues.purge = :default + config.active_job.queue_adapter = :que + config.active_job.queue_name_prefix = "sutty_#{Rails.env}" + config.to_prepare do Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c| Rails.configuration.cache_classes ? require(c) : load(c) diff --git a/config/environments/production.rb b/config/environments/production.rb index ed737146..f13488b8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -64,11 +64,6 @@ Rails.application.configure do # Use a different cache store in production. config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } - # Use a real queuing backend for Active Job (and separate queues per - # environment) - config.active_job.queue_adapter = :que - config.active_job.queue_name_prefix = "sutty_#{Rails.env}" - config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. diff --git a/monit.conf b/monit.conf index ebb27fe7..567f72a6 100644 --- a/monit.conf +++ b/monit.conf @@ -18,3 +18,7 @@ check program distributed_press_tokens_renew with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data" every "0 3 * * *" if status != 0 then alert + +check process que with pidfile /srv/tmp/que.pid + start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que" + stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'"