Last Updated: February 25, 2016
·
664
· joshteng

Running Clockwork as a unicorn process to avoid one extra dyno

worker_processes 2 # amount of unicorn workers to spin up
timeout 3000

@resque_pid = nil
@resque_pid2 = nil
before_fork do |server, worker|
  @resque_pid ||= spawn("bundle exec rake jobs:work")
  @resque_pid2 ||= spawn("bundle exec clockwork app/clock.rb")
end

Disclaimer: I haven't tested this. This bit of code was found on someone else's blog (http://www.nambrot.com/posts/1-heroku-dyno-on-steroids)