2014-09-29 93 views
1

我有一个作曲家的错误,同时运行Capistrano的退出代码为部署:Capistrano的部署作曲家错误

composer exit status: 2 

以下是完整的日志错误:

Invoke deploy:updated (first_time) 
Invoke composer:install (first_time) 
Execute composer:install 
Invoke composer:run (first_time) 
Execute composer:run 
INFO[28cd8f39] Running /usr/bin/env composer install --no-dev --no-interaction --verbose --optimize-autoloader on mydomain.com 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing on host mydomain.com: composer exit status: 2 
composer stdout: Nothing written 
composer stderr: Nothing written 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status=' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute' 
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:27:in `block (4 levels) in <top (required)>' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within' 
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:26:in `block (3 levels) in <top (required)>' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute' 
SSHKit::Command::Failed: composer exit status: 2 
composer stdout: Nothing written 
composer stderr: Nothing written 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status=' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute' 
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:27:in `block (4 levels) in <top (required)>' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within' 
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:26:in `block (3 levels) in <top (required)>' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run' 
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute' 
Tasks: TOP => composer:run 
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host mydomain.com: composer exit status: 2 
composer stdout: Nothing written 
composer stderr: Nothing written 
> 
** Invoke deploy:failed (first_time) 
** Execute deploy:failed 

我使用Capistrano的3.2版。 0和最新版本的capistrano-composer。

可能是什么问题?

回答

1

(问题回答的评论或编辑请参见Question with no answers, but issue solved in the comments (or extended in chat)

的OP写道:

Somehow the issue was in composer install command. I've resolved the issue by running composer update before composer install, and deploy went through successfully.

This is the code to run composer:update before composer:install.

namespace :composer do 
    before 'install', 'change_dir' 

    desc 'Composer update' 
    task :change_dir do 
     on roles(:app) do 
      execute "cd #{release_path}/ && composer update" 
     end 
    end 
end