I have run into an issue restarting my Rails application during the deployment process using Capistrano. Here is a trace of the problem code:
INFO [e14478ef] Running /usr/bin/env rvmsudo passenger-config restart-app /var/www/appname/staging/ --ignore-app-not-running as deploy@xxx.xxx.xxx.xx
DEBUG [e14478ef] Command: rvmsudo passenger-config restart-app
DEBUG [e14478ef] bash: rvmsudo: command not found
I am almost certain this issue is stemming from the environment from which the command is being executed ($BASH_ENV), but I'm not sure how to remedy the issue. When I execute the same command manually from the command line, everything works fine. My app is using:
- Ruby (2.2.0)
- Rails (4.2.0)
- Capistrano (3.4.0)
- Capistrano-passenger (0.0.4)
- Capistrano-rails (1.1.2)
- Capistrano-rvm (0.1.2)
- Passenger (5.0.6)
Just a note: I have been able to restart the app by overwriting the passenger:restart task and using the old touch tmp/restart.txt method. However, I would really like to know how to get the default restart method working correctly.
Update: I was able to circumvent the problem by replacing the default restart task with the following code:
desc 'Restart your Passenger application - temporary fix'
task :restart do
on roles(:app) do
sudo "passenger-config restart-app #{fetch(:deploy_to)}"
end
end
I am still interested in learning how to restart the app without overwriting the default task, but I have added the code above for those who may be stuck in a similar situation.
(Credit: https://github.com/capistrano/passenger/issues/9#issuecomment-92685064)