2

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)

IggyPlop
  • 321
  • 3
  • 11

1 Answers1

0

If you are getting a command not found for rvmsudo, it is probably because you don't have rvmsudo installed.

will_in_wi
  • 2,623
  • 1
  • 16
  • 21
  • rvmsudo is installed. I think the issue involves the "shell" from which the command is executed, which I believe is non-interactive, so it doesn't have the necessary permissions to execute many commands. The top answer to this thread gives a good overview of the different shell environments: http://stackoverflow.com/questions/216202/why-does-an-ssh-remote-command-get-fewer-environment-variables-then-when-run-man – IggyPlop Nov 18 '15 at 16:25