javan / javan/whenever

Mina deploy and cron problems

Open
#616 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ruby-version-manager-mess usage-question
Dominant language
Ruby
Stars
8.9k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have some issues with Whenever gem and Mina deploy.

In my schedule.rb I have:

env :PATH, ENV['PATH']

every 12.hours do
  rake "-s sitemap:refresh"
end

In deploy.rb I have:

require 'mina/whenever'
.................
and in deploy do
invoke :'whenever:clear'
invoke :'whenever:write'
invoke :'deploy:cleanup'

The reason why I don't use whenever:update is that it doesnt work correctly. It updated cron one deploy step back. Well, but it isn't that problem. This command create this crontab -l:

# Begin Whenever generated tasks for: 46.101.149.216_production
PATH=/home/thomas/myapp/releases/36/vendor/bundle/ruby/2.2.0/bin:/home/thomas/.rbenv/versions/2.2.3/bin:/home/thomas/.rbenv/libexec:/home/thomas/.rbenv/plugins/ruby-build/bin:/home/thomas/.rbenv/shims:/home/thomas/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

0 0,12 * * * /bin/bash -l -c 'cd /home/thomas/myapp/current && RAILS_ENV=production bundle exec rake -s sitemap:refresh --silent'

# End Whenever generated tasks for: 46.101.149.216_production

Well, it's really weird the PATH part. And of course, cron doesn't work. Maybe it's because env :PATH, ENV['PATH'], but before it didn't work as well. I am using rbenv. I have no idea how cron works and I can't repair it. But when I go to /home/thomas/myapp/current folder on server and run command manually, sitemap is created, so command works correctly.

Thanks for help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with schedule.rb and deploy.rb, then inspect the generated crontab entry for the Mina deployment. Reproduce the deployment and cron invocation while comparing it with the manually working sitemap:refresh command. Done means the deployed cron job runs the sitemap task on the intended release with the expected environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.