2013-10-26 38 views
2

我正在开发Rails 4应用程序,我已经设置我的服务器运行瘦,我试图设置capistrano 3部署。我正在开发Windows和部署在Linux上。 目前,如果失败,在这条线:capistrano 3,导轨4,瘦服务器奇怪异常

[f98408e4] Command: bundle exec thin restart -O -C config/thin/production.yml 

有了一个很奇怪的例外。有趣的是,当我ssh到服务器,导航到当前版本目录并手动执行该命令它正确运行。也许你会看到一些我没有:

cap aborted! 
bundle exec thin restart -O -C config/thin/production.yml stdout: Nothing written 
bundle exec thin restart -O -C config/thin/production.yml stderr: Nothing written 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/command.rb:94:in `exit_status=' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:125:in `block (4 levels) in _execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:147:in `block (2 levels) in _execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:149:in `block in _execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:106:in `tap' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:106:in `_execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:54:in `execute' 
config/deploy.rb:23:in `block (4 levels) in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/abstract.rb:81:in `within' 
config/deploy.rb:22:in `block (3 levels) in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:42:in `run' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:9:in `block in execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:8:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:8:in `execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/coordinator.rb:21:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/dsl.rb:8:in `on' 
config/deploy.rb:21:in `block (2 levels) in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/dsl.rb:14:in `invoke' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/deploy.rake:18:in `block (2 levels) in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/dsl.rb:14:in `invoke' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:64:in `block (2 levels) in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:63:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:63:in `block in <top (required)>' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/application.rb:12:in `run' 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/bin/cap:3:in `<top (required)>' 
C:/Ruby200/bin/cap:23:in `load' 
C:/Ruby200/bin/cap:23:in `<main>' 
Tasks: TOP => deploy:restart 

有关重新启动我的deploy.rb任务看起来是这样的:

set :default_env, { rvm_bin_path: '~/.rvm/bin' } 
set :rails_env, "production" 
namespace :deploy do 
    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     within release_path do 
     execute "bundle exec thin restart -O -C config/thin/production.yml" 
     end 
    end 
    end 
end 
+0

我收到了同样的错误。但不总是。只是不时。 –

回答

4

正确的语法是:

namespace :deploy do 
    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     within release_path do 
     execute :bundle, "exec thin restart -O -C config/thin/production.yml" 
     end 
    end 
    end 
    before :restart, 'rvm:hook' 
end