Skip to content

Instantly share code, notes, and snippets.

@amkisko
Last active May 23, 2025 10:25
Show Gist options
  • Save amkisko/6ef9852c712a4c736a334ef8dfa4ba40 to your computer and use it in GitHub Desktop.
Save amkisko/6ef9852c712a4c736a334ef8dfa4ba40 to your computer and use it in GitHub Desktop.
good_job (good job rails) configuration template
GOOD_JOB_MAX_THREADS=5
GOOD_JOB_POLL_INTERVAL=10
GOOD_JOB_MAX_CACHE=10000
GOOD_JOB_SHUTDOWN_TIMEOUT=30
GOOD_JOB_PROBE_PORT=7433
GOOD_JOB_ENABLE_CRON=true
GOOD_JOB_ENABLE_LISTEN_NOTIFY=true
GOOD_JOB_CLEANUP_DISCARDED_JOBS=true
GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO=1209600
GOOD_JOB_CLEANUP_INTERVAL_JOBS=1000
GOOD_JOB_CLEANUP_INTERVAL_SECONDS=600
GOOD_JOB_ENABLE_PAUSES=false
GOOD_JOB_QUEUE_SELECT_LIMIT=1000
GoodJob::Engine.middleware.use(Rack::Auth::Basic) do |username, password|
wanted_username = ENV["GOOD_JOB_USERNAME"]
wanted_password = ENV["GOOD_JOB_PASSWORD"]
Rails.env.development? ||
(wanted_username.present? && wanted_password.present? &&
ActiveSupport::SecurityUtils.secure_compare(wanted_username, username) &
ActiveSupport::SecurityUtils.secure_compare(wanted_password, password))
end
Rails.application.configure do
config.good_job.preserve_job_records = true
config.good_job.retry_on_unhandled_error = false
config.good_job.on_thread_error = ->(error) { ActionReporter.notify(error) }
config.good_job.probe_app = ->(env) { [200, {}, ["OK"]] }
config.good_job.probe_handler = "webrick"
config.good_job.dashboard_default_locale = :en
config.good_job.cron = {}
config.good_job.cron_graceful_restart_period = 5.minutes
end
config.active_job.queue_adapter = :good_job
authenticate :manager_user do
mount GoodJob::Engine => "/admin/good_job"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment