Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.2 Jobs Not Running with job_type :runner #769

Open
RIttera13 opened this issue Feb 1, 2019 · 3 comments
Open

5.2.2 Jobs Not Running with job_type :runner #769

RIttera13 opened this issue Feb 1, 2019 · 3 comments

Comments

@RIttera13
Copy link

I had an issue after upgrading to 5.2.2 when jobs where not running. Jobs were added to crontab correctly and looked correct. I compared it to the crontab that worked before and it was the same. The issue was that the method to run the job was no longer working. I used a new job_type to use new commands and resolve the issue. The problem is that && bundle exec bin/rails needed to drop the "bin" and just read && bundle exec rails. I'm not sure if anyone else has had or can recreate the issue.

Just to confirm, the only changes made to my environment when this occurred was upgrading from Rails 5.0.1 to Rails 5.2.2.

Doesn't Work:
Default - job_type :runner, "cd :path && bin/rails runner -e :environment ':task' :output"

Creates this cronjob -
/bin/bash -l -c 'cd /var/deploy/MyApp/web_head/releases/20190201171815 && bundle exec bin/rails runner -e staging '\'MyJob.perform_now'\'''

Working Version:
My Custom job_type - job_type :new_runner, "cd :path && bundle exec rails runner -e :environment ':task' :output"

Creates this cronjob -
/bin/bash -l -c 'cd /var/deploy/MyApp/web_head/releases/20190201194724 && bundle exec rails runner -e staging '\''MyJob.perform_now'\'''

My environment is Ubuntu 16.04 self hosted but managed through Cloud66.

  • ruby 2.4.2p198
  • Rails 5.2.2

And thank you to the creators/maintainers of this awesome gem. Also, the ability to create a custom job_type made this issue very minor, so thank you for that as well.

@igorkasyanchuk
Copy link

I've got a similar issue that tasks are not executed, so I've added a logger and noticed this issue:

bundler: failed to load command: bin/rails (bin/rails)
LoadError: cannot load such file -- bootsnap/setup
/home/deploy/applications/platforma/releases/20190419062535/config/boot.rb:6:in require' /home/deploy/applications/platforma/releases/20190419062535/config/boot.rb:6:in <top (required)>'
bin/rails:3:in require_relative' bin/rails:3:in <top (required)>'

because I've removed this gem from prod env. Check you logs
set :output, "/home/deploy/applications/platforma/current/log/crontab.log"

maybe you have another issue.

@ishields
Copy link

@RIttera13 did you ever find a solution for this? I'm seeing a similar issue with Rails 6.1 and ruby 3.0.0

@KevinTriplett
Copy link

I had the same issue. My workaround was to create a rake task that simply calls my class method and create a cron job that runs the rake task. I got the added benefit of gaining a rake task I can manually run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants