How can I run the restart-config-app to work?

Rails 4.1 on Ubuntu 14.04 with rbenv and ruby ​​2.2.1.

Using capistrano with the capistrano gem, but restarting at the end failed:

INFO [8213c63a] Running /usr/bin/env passenger-config restart-app /home/deployer/my_app --ignore-app-not-running as deployer@mysite.com DEBUG [8213c63a] Command: passenger-config restart-app DEBUG [8213c63a] Please pass either an app path prefix or an app group name. See --help for more information. 

When I try to run this command on the command line via SSH, I get the following:

 deployer@host :~/app/shared/config$ passenger-config restart-app *** ERROR: You are not authorized to query the status for this 

What am I doing wrong here?

I am using Apache, here are the relevant parts of my / etc / apache 2 / apache2.conf:

 LoadModule passenger_module /home/deployer/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.5/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/deployer/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.5 PassengerDefaultRuby /home/deployer/.rbenv/versions/2.2.1/bin/ruby </IfModule> <VirtualHost *:80> ServerName mysite.name.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /home/deployer/myssite/current/public <Directory /home/deployer/mysite/current/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted </Directory> </VirtualHost> 
+6
source share
2 answers

Here is what made me work, I added this to my conifg/deploy.rb :

 set :passenger_restart_with_sudo, true 

Link: https://github.com/capistrano/passenger/

To add sudo -free access for the deployer user, on the server, run:

(you can be more specific regarding the allowed commands)

 sudo tee /etc/sudoers.d/deployer > /dev/null <<'EOF' deployer ALL=(ALL) NOPASSWD:ALL EOF 

... and in your delpoy.rb :

 set :user, 'deployer' # Deployment user on remote servers 

Note : it should be noted that the authors of the Passenger are working on the method, so sudo will no longer be needed in the future.

+7
source

If you do not want to use sudo to restart the application server, just add to config/deploy.rb :

 namespace :deploy do desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do execute :touch, release_path.join('tmp/restart.txt') end end end 

To restart with sudo (note that this does not affect Passenger <5):

 set :passenger_restart_with_sudo, false 

If you want to change the restart options, you can override them:

 set :passenger_restart_command, 'passenger-config restart-app' set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" } 
+3
source

Source: https://habr.com/ru/post/984280/


All Articles