我是一个将Rails部署到生产环境的完整菜鸟,并且看到Capistrano退出并出现以下错误:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxx.xxx.xxx.xxx: passenger-config exit status: 1
passenger-config stdout: *** Cleaning stale instance directory /tmp/passenger.RWBkftW
/home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `chown': Operation not permitted @ rb_file_chown - /tmp/passenger.RWBkftW/. (Errno::EPERM)
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `block in remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `open'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:93:in `cleanup'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:49:in `block in list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `each'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/utils.rb:53:in `select_passenger_instance'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/restart_app_command.rb:44:in `run'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/main.rb:75:in `run!'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/bin/passenger-config:37:in `<top (required)>'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `load'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `<main>'
passenger-config stderr: Nothing written
SSHKit::Command::Failed: passenger-config exit status: 1
passenger-config stdout: *** Cleaning stale instance directory /tmp/passenger.RWBkftW
/home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `chown': Operation not permitted @ rb_file_chown - /tmp/passenger.RWBkftW/. (Errno::EPERM)
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `block in remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `open'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:93:in `cleanup'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:49:in `block in list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `each'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/utils.rb:53:in `select_passenger_instance'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/restart_app_command.rb:44:in `run'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/main.rb:75:in `run!'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/bin/passenger-config:37:in `<top (required)>'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `load'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `<main>'
passenger-config stderr: Nothing written
Tasks: TOP => passenger:restart
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@xxx.xxx.xxx.xxx: passenger-config exit status: 1
passenger-config stdout: *** Cleaning stale instance directory /tmp/passenger.RWBkftW
/home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `chown': Operation not permitted @ rb_file_chown - /tmp/passenger.RWBkftW/. (Errno::EPERM)
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:726:in `block in remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `open'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/2.2.0/fileutils.rb:720:in `remove_entry_secure'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:93:in `cleanup'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:49:in `block in list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `each'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/admin_tools/instance_registry.rb:42:in `list'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/utils.rb:53:in `select_passenger_instance'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/restart_app_command.rb:44:in `run'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/lib/phusion_passenger/config/main.rb:75:in `run!'
from /home/deploy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/passenger-5.0.7/bin/passenger-config:37:in `<top (required)>'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `load'
from /home/deploy/.rbenv/versions/2.2.1/bin/passenger-config:23:in `<main>'
passenger-config stderr: Nothing written
[me@localhost rally_app]$
问题似乎与Phusion Passenger的配置以及部署用户的权限有关,但我不确定如何继续。
提前感谢您的帮助。
更新:错误似乎是Passenger正在以root用户身份在/ tmp /中创建文件,但随后尝试清除/删除它们作为“部署”#39;由乘客承担的用户因为部署了&#39;拥有environment.rb。
/ tmp / dirs看起来像:
4 drwxr-xr-x. 4 root root 4096 May 20 14:15 passenger.Jy8mOoq/
4 drwxr-xr-x. 4 root root 4096 May 5 07:14 passenger.jZAgQb1/
4 drwxr-xr-x. 4 root root 4096 May 7 07:13 passenger.M9fxTPM/
4 drwxr-xr-x. 4 root root 4096 May 6 13:12 passenger.RWBkftW/
我认为这不是乘客的问题;这似乎更有可能是我的部署&#39;用户的权限。我按照Capistrano说明here
设置了部署用户答案 0 :(得分:3)
我对Passenger没有经验,但是从你的回溯中看来,你的部署用户似乎无权访问/tmp/passenger.RWBkftW/。文件。
查看用户乘客的运行情况,例如
ps aux
命令在您的服务器上。
然后,您应该向部署用户授予乘客访问权限,或者通过运行乘客的用户部署应用程序。
答案 1 :(得分:3)
此处为乘客作者。就像斯坦尼斯拉夫所说的那样。但我猜乘客在遇到这样的问题时不应该因错误而中止。它只是试图清理陈旧的目录。我会做出改变,以确保它可以继续运作。
编辑:这已在commit c957e9e1171中实施。