Whenever with capistrano should use symlinked `/current/` instead of `/app_revision/` folder in crontab
Consider the following : I have two roles in capistrano, :worker, and :scheduler
My :scheduler role was meant for the machine whose crontab will be updated with whenever.
My :worker role is meant for processing background jobs
It turns out to save costs, I decided my scheduler machine could also be a worker to process async jobs. Now two scenarios and the second one is buggy :
- When I deploy to the
:schedulerRole, it will deploy to my whenever-enabled machine and update the crontab, all good. - When I deploy to the
:workerRole, it will still deploy to my whenever-enabled machine (as it is a worker at the same time) but it WON'T update the crontab (since crontab update is only affiliated to:scheduler. Now what happens is that- Not only will whenever use an old app version but
- after
keep_releasesdeployments, the folder that was referenced by the crontab will no longer exist, causes silent crashes of the scheduler (unless email warnings are enabled to report cron failures)
In order to fix this I would suggest that crontab always uses the symlink /current used by capistrano to maintain the active version. What about it ?
Any news about this request?
Not on my side, I'm just careful to always deploy with my scheduler roles to avoid this problem, but I'm sure this problem will come back and hit me in the face again and again until a good fix is made :-)
From your brief suggestion, I don't know exactly how this would work or if it would cause problems for other users. Could you drop a PR to discuss?
yep this still seems to be the behavior and is annoying to have a polluted crontab -l
Have a similar issue. I use whenever/capistrano while multi-servers deploy. After deploying the cron on my first main server is updated well, the second and third are not updated.
Another thing. If I use whenever --update-crontab command on production server and then run deploy the old cron task is not replaced with new one. Whenever is simply add new one.
I believe using symlink /current instead of /releases/131232242 paths would fix this issues.