ruby-on-rails – 如何让passenger-config restart-app工作?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 如何让passenger-config restart-app工作?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用rbenv和 ruby 2.2.1在Ubuntu 14.04上安装Rails 4.1.

使用capistrano和capistrano-passenger gem,但最后重启失败:

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.

当我尝试通过SSH在命令行运行此命令时,我得到:

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

我在这做错了什么?

我正在使用Apache,这是我的/etc/apache2/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>

解决方法

这是让我跑步的原因,我把它添加到我的conifg / deploy.rb:
set :passenger_restart_with_sudo,true

参考:https://github.com/capistrano/passenger/

要为部署者用户添加无密码的sudo访问权限,请在服务器上执行以下操作:

(您可能希望对允许的命令更具体)

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

……并且在你的delpoy.rb中,有:

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

注意:应该注意的是,乘客作者将来是working on a method so that sudo will not be required any longer.

猜你在找的Ruby相关文章