Running delayed_job worker on Heroku?

前端 未结 4 636
野的像风
野的像风 2021-02-05 11:03

So right now I have an implementation of delayed_job that works perfectly on my local development environment. In order to start the worker on my machine, I just run rake

相关标签:
4条回答
  • 2021-02-05 11:21

    I recommend the workless gem to run delayed jobs on heroku. I use this now - it works perfectly for me, zero hassle and at zero cost.

    I have also used hirefireapp which gives a much finer degree of control on scaling workers. This costs, but costs less than a single heroku worker (over a month). I don't use this now, but have used it, and it worked very well.

    0 讨论(0)
  • 2021-02-05 11:24

    I haven't tried it personally yet, but you might find nohup useful. It allows your process to run even though you have closed your terminal window. Link: http://linux.101hacks.com/unix/nohup-command/

    0 讨论(0)
  • 2021-02-05 11:25

    Using heroku console to get workers onto the jobs will only create create a temporary dyno for the job. To keep the jobs running without cli, you need to put the command into the Procfile as @Lucaksz suggested.

    After deployment, you also need to scale the dyno formation, as heroku need to know how many dyno should be put onto the process type like this: heroku ps:scale worker=1

    More details can be read here https://devcenter.heroku.com/articles/scaling

    0 讨论(0)
  • 2021-02-05 11:26

    Add

    worker: rake jobs:work
    

    to your Procfile.

    EDIT:

    Even if you run it from your console you 'buy' worker dyno but Heroku has per second biling. So you don't pay because you have 750h free, and month in worst case has 744h, so you have free 6h for your extra dynos, scheduler tasks and so on.

    0 讨论(0)
提交回复
热议问题