Skip to content

Instantly share code, notes, and snippets.

@nthj
Created October 24, 2013 07:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nthj/7133000 to your computer and use it in GitHub Desktop.
Save nthj/7133000 to your computer and use it in GitHub Desktop.
Running background workers on Heroku without paying for extra dynos
# Adjust according to your own needs
# Be sure to chmod +x before committing
# Store this in your app's 'bin/' directory
if [[ $DAEMONIZED_WORKER_CONCURRENCY -gt 0 ]]; then
# Adjust the '-q' flags as you need them, or swap this out for Resque or Delayed::Job
bundle exec sidekiq --concurrency $DAEMONIZED_WORKER_CONCURRENCY -q mailer,2 -q default --verbose;
fi;
console: bundle exec rails console
rake: bundle exec rake
web: daemonized-worker & web
worker: worker
# Adjust according to your own needs
# Be sure to chmod +x before committing
# Store this in your app's 'bin/' directory
bundle exec unicorn -c config/unicorn.rb -E $RACK_ENV -p $PORT config.ru --no-default-middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment