2016-08-19 34 views
0

我在我的rails 5應用程序上運行$ cap production deploy。它工作得很好,直到最後一步:Capistrano 3 Unicorn開始在最後一步返回一個奇怪的錯誤

似乎是一個權限問題給我,但它早期工作正常。

unicorn:restart 
     01 service unicorn_myApp_production restart 
     01 Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .serv… 
     01 See system logs and 'systemctl status unicorn_myApp_production.service' for details. 
(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: service exit status: 1 
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files 
See system logs and 'systemctl status unicorn_myApp_production.service' for details. 
service stderr: Nothing written 

SSHKit::Command::Failed: service exit status: 1 
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files 
See system logs and 'systemctl status unicorn_myApp_production.service' for details. 
service stderr: Nothing written 

Tasks: TOP => unicorn:restart 
(See full trace by running task with --trace) 
The deploy has failed with an error: Exception while executing as [email protected]: service exit status: 1 
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files 
See system logs and 'systemctl status unicorn_myApp_production.service' for details. 
service stderr: Nothing written 

** DEPLOY FAILED 
** Refer to log/capistrano.log for details. Here are the last 20 lines: 

DEBUG [b9413f29] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env mv /var/www/myApp/releases/… 
    INFO [b9413f29] Finished in 0.111 seconds with exit status 0 (successful). 
    INFO [cef268ae] Running /usr/bin/env sudo service delayed_job_myApp_production restart as [email protected] 
DEBUG [cef268ae] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env sudo service delayed_job_bubb… 
    INFO [cef268ae] Finished in 21.242 seconds with exit status 0 (successful). 
    INFO [41580c64] Running /usr/bin/env sudo /etc/init.d/nginx reload as [email protected] 
DEBUG [41580c64] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env sudo /etc/init.d/nginx reload… 
DEBUG [41580c64] [....] Reloading nginx configuration (via systemctl): nginx.service 
DEBUG [41580c64] 
DEBUG [41580c64] 
DEBUG [41580c64] 
DEBUG [41580c64] [ ok 
DEBUG [41580c64] 
DEBUG [41580c64] 
DEBUG [41580c64] . 
    INFO [41580c64] Finished in 0.268 seconds with exit status 0 (successful). 
    INFO [84d3bdae] Running /usr/bin/env service unicorn_myApp_production restart as [email protected] 
DEBUG [84d3bdae] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env service unicorn_myApp_produ… 
DEBUG [84d3bdae] Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by… 
See system logs and 'systemctl status unicorn_myApp_production.service' for details. 

有沒有其他人面對過這個?我究竟做錯了什麼。

+0

您可以運行它作爲SSH部署用戶? –

+0

不是。沒有sudo就會出錯。 – marvindanig

+0

然後我建議@William Sumfest的回答。我不確定你的系統有哪些變化,但與Capistrano無關。 –

回答

1

這是一個權限錯誤。在最後一行:

/usr/bin/env service myApp start 

嘗試:

/usr/bin/env sudo service myApp start