How to run Clockwork in Heroku

942 Views Asked by At

I'm really new to Heroku, but I have a problem. I have created a Clockwork script called "clock.rb" in rails and I use:

bundle exec clockwork clock.rb

to run it in the background on my local server, but How I can run that on Heroku server? (I would like the cheapest solution)

Thanks!!!

1

There are 1 best solutions below

0
fool-dev On BEST ANSWER

To your Procfile use like this

worker: bundle exec clockwork clock.rb

it will start the server every time after Heroku push/web server restart.

Or you can run using console from your computer like this but in this case, you need to run every time after web server restarting

heroku run bundle exec clockwork clock.rb

and from Heroku open console and type

bundle exec clockwork clock.rb