Ubuntu 14.04 上的 Rails 4.1,带有 rbenv 和 ruby 2.2.1。
将 capistrano 与 capistrano-passenger gem 一起使用,但最后重新启动失败:
INFO [8213c63a] Running /usr/bin/env passenger-config restart-app /home/deployer/my_app --ignore-app-not-running as [email protected] /cdn-cgi/l/email-protection
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
Ref: https://github.com/capistrano/passenger/ https://github.com/capistrano/passenger/
添加无密码sudo
访问deployer
用户,在服务器上执行以下操作:
(您可能想要更具体地了解允许的命令)
sudo tee /etc/sudoers.d/deployer > /dev/null <<'EOF'
deployer ALL=(ALL) NOPASSWD:ALL
EOF
...而在你的delpoy.rb
, have:
set :user, 'deployer' # Deployment user on remote servers
Note:应该指出的是,乘客作者是正在研究一种方法,以便不再需要 sudo https://github.com/phusion/passenger/issues/1392将来。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)