nginx-Capistrano 3无权查询此Phusion Passenger实例的状态
作者:互联网
尝试在Capistrano 3上进行部署.我正在使用NGINX,RVM,Passenger,Rails4.我的部署正在运行,但是我需要手动重新启动NGINX-这是部署结束时的错误:
DEBUG [c4e821bc] Command: ~/.rvm/bin/rvm default do passenger -v
DEBUG [c4e821bc] Phusion Passenger version 5.0.6
DEBUG [c4e821bc]
DEBUG [c4e821bc] "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
DEBUG [c4e821bc] Finished in 0.981 seconds with exit status 0 (successful).
INFO [5082ae94] Running ~/.rvm/bin/rvm default do passenger-config restart-app /home/deploy/skilltry --ignore-app-not-running on 104.237.158.232
DEBUG [5082ae94] Command: ~/.rvm/bin/rvm default do passenger-config restart-app /home/deploy/skilltry --ignore-app-not-running
DEBUG [5082ae94] *** ERROR: You are not authorized to query the status for this Phusion Passenger instance. Please try again with 'rvmsudo'.
cap aborted!
我在这里尝试修复:
https://github.com/capistrano/passenger/issues/2
Use visudo to edit the file (so if you mess up you have the chance to re-edit the file), at the end of the file (*) add the following:
deployuser ALL=(root) NOPASSWD: /usr/bin/passenger-config
这没什么区别
在这里:
How can I get passenger-config restart-app to work?
但是我收到提示,我无法输入:
[sudo] password for deploy:
解决方法:
查看gems / capistrano-passenger-0.0.5 / lib / capistrano / tasks / passenger.cap文件,其中包含以下默认值:
task :defaults do
set :passenger_roles, :app
set :passenger_restart_runner, :sequence
set :passenger_restart_wait, 5
set :passenger_restart_limit, 2
set :passenger_restart_with_sudo, false
set :passenger_environment_variables, {}
set :passenger_restart_command, 'passenger-config restart-app'
set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" }
set :passenger_rvm_ruby_version, ->{ fetch(:rvm_ruby_version) }
if Rake.application.tasks.collect(&:to_s).include?("rvm:hook")
before :'rvm:hook', :'passenger:rvm:hook'
end
if Rake.application.tasks.collect(&:to_s).include?("rbenv:map_bins")
before :'rbenv:map_bins', :'passenger:rbenv:hook'
end
end
我能够将以下内容添加到deploy.rb中,以覆盖如何重新启动乘客实例:
set :passenger_restart_command, 'sudo passenger-config restart-app'
您应该首先验证/ etc / sudoers配置是否允许以root用户身份无密码执行该命令.
标签:capistrano3,nginx,passenger 来源: https://codeday.me/bug/20191028/1952677.html