0

我正在尝试将 mysite 部署到我的 VPS。Capstrano 是我完成这项任务的工具。当我跑步时

cap deploy

我收到了这个错误

  * executing `deploy:assets:precompile'
  * executing "cd /home/aassdd/mysitename.com/releases/20120609034922 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["mysitename.com"]
    [mysitename.com] executing command
 ** [out :: mysitename.com] Faraday: you may want to install system_timer for reliable timeouts
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/aaalsubaie/mysitename.com/releases/20120609034922; true"
    servers: ["mysitename.com"]
 ** [deploy:update_code] exception while rolling back: IOError, closed stream
/Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb:41:in `select': closed stream (IOError)
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb:41:in `io_select'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb:40:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb:40:in `io_select'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/transport/packet_stream.rb:73:in `available_for_read?'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/transport/packet_stream.rb:85:in `next_packet'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/transport/session.rb:171:in `poll_message'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/transport/session.rb:166:in `loop'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/transport/session.rb:166:in `poll_message'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/connection/session.rb:451:in `dispatch_incoming_packets'
    from /Library/Ruby/Gems/1.8/gems/net-ssh-2.5.2/lib/net/ssh/connection/session.rb:213:in `preprocess'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/processable.rb:17:in `process_iteration'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/processable.rb:43:in `ensure_each_session'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/processable.rb:41:in `each'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/processable.rb:41:in `ensure_each_session'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/processable.rb:17:in `process_iteration'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/command.rb:165:in `process!'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/command.rb:164:in `loop'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/command.rb:164:in `process!'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/command.rb:163:in `process!'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/command.rb:134:in `process'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/actions/invocation.rb:178:in `run_tree'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:198:in `execute_on_servers'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/erb.rb:719:in `each_slice'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:186:in `each'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:186:in `each_slice'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:186:in `execute_on_servers'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/actions/invocation.rb:176:in `run_tree'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/actions/invocation.rb:148:in `run'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy/assets.rb:42:in `load'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/callback.rb:38:in `call'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:123:in `trigger'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:123:in `each'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:123:in `trigger'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:110:in `update_code'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:203:in `load'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:56:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:202:in `load'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `send'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:193:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/namespaces.rb:110:in `update'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:170:in `load'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:46:in `execute_requested_actions_without_help'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:45:in `each'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions_without_help'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/help.rb:19:in `execute_requested_actions'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:34:in `execute!'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Library/Ruby/Gems/1.8/gems/capistrano-2.12.0/bin/cap:4
    from /usr/bin/cap:19:in `load'
    from /usr/bin/cap:19

我不知道它曾经正常工作的错误来源是什么!

这是我的帽子文件

load 'deploy'
# Uncomment if you are using Rails' asset pipeline
  # load 'deploy/assets'

Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks

load 'deploy/assets'
task :search_libs, :hosts => "mysitename.com" do
  run "ls -x1 /usr/lib | grep -i xml"
end

这是我的部署文件

require "bundler/capistrano"

default_run_options[:pty] = true

set :user, 'myname'
set :domain, 'mysitename.com'
set :application, 'mysitename'


set :repository,  "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/#{domain}"
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :use_sudo, false

server domain, :app, :web
role :db, domain, :primary => true

namespace :deploy do
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end

  desc "reload the database with seed data"
  task :seed do
    run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
  end
end

值得一提的是,当我 ssh 到远程服务器并执行时

cd /home/ssddff/mysitename.com/releases/20120609034922 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile

它可以正常工作!

4

1 回答 1

0

我通过将 VPS 内存增加到 512MB 解决了这个问题

于 2012-06-09T19:02:11.197 回答