Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to run a long task on Heroku with Ruby On Rails?

I am looking for the best way to run a very long task in Heroku.

I use Ruby On Rails for my web application and I have a very long task that I want to run it every week on Sunday during the night. It takes around 15~20 minutes. I already have Rufus-Scheduler, but I am not sure it is the most effective solution.

I also find something about Backgrounding Tasks in Heroku with Delayed Job. But is it the best way to handle it ?

Thanks.

like image 278
Kilian Avatar asked Jun 02 '15 12:06

Kilian


People also ask

Which type of database Cannot be used to deploy your Rails app to Heroku?

So, the reason why you cannot use SQLite on Heroku is because SQLite stores all database information in a file on disk, and because Heroku will delete the files on your disk, this won't work.

Can you run cron jobs on Heroku?

Cron To Go is an add-on created for Heroku users to run scheduled jobs based on one-off dynos using cron expressions. Cron To Go combines the simplicity of using cron to schedule jobs with the scale and elasticity of the cloud.

Does Heroku support rails 7?

Ruby on Rails is a popular web framework written in Ruby. This guide covers using Rails 7 on Heroku. For information on running previous versions of Rails on Heroku, see the tutorial for Rails 6. x or Rails 5.


1 Answers

This is what I use for a job that I run every night: https://devcenter.heroku.com/articles/scheduler

It works really well if your job is configured as a rake task. The guide at the link shows you how to configure everything and even addresses long-running jobs.

like image 97
NM Pennypacker Avatar answered Sep 28 '22 17:09

NM Pennypacker