2012-01-18 13 views
2

問題がどこにあるのかわかりませんが、Capistranoはほぼ空のプロジェクトを展開するのに約5分かかります。Capistrano非常に遅い

私が何か間違っているのか、それとも普通なのか教えていただけますか?

私が使用しています:

  • カピストラーノ2.9.0を
  • のRails 3.1.3
  • GitHubのリポジトリ
  • ない遅すぎるサーバー(4個のコア、1ギガバイトのメモリ)
  • NGIX、乗客

ここに私が得ている出力はあります: https://gist.github.com/1632009

Capfile

load 'deploy' if respond_to?(:namespace) # cap2 differentiator 
# 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 

deploy.rb

# -*- encoding : utf-8 -*- 
require "bundler/capistrano" 

set :user, 'rubys' 
set :domain, 'example.com' 
set :application, 'EXAMPLE' 

# adjust if you are using RVM, remove if you are not 
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) 
require "rvm/capistrano" 
set :rvm_ruby_string, '1.9.2' 
#set :rvm_type, :user 

# file paths 
set :repository, "[email protected]:GITHUBREPO/ashop.git" 
set :deploy_to, "/apps/#{application}" 

# using a local git repository on the server you are deploying to. 
set :deploy_via, :remote_cache 
set :copy_exclude, [ '.git' ] 


# distribute your applications across servers (the instructions below put them 
# all on the same server, defined above as 'domain', adjust as necessary) 
role :app, domain 
role :web, domain 
role :db, domain, :primary => true 


set :deploy_via, :remote_cache 
set :scm, 'git' 
set :branch, 'master' 
set :scm_verbose, false 
set :use_sudo, false 
set :rails_env, :production 

namespace :deploy do 
    desc "cause Passenger to initiate a restart" 
    task :restart do 
    run "touch #{current_path}/tmp/restart.txt" 
    end 
end 

EDIT

+0

は、ネットワークが遅いですか? –

+0

5Mbitの理論上のアップロード/ダウンロードhttp://www.speedtest.net/result/1714391142.png – Mark

+0

多分サーバー<=> githubが遅い –

答えて

1

カピストラーノは、おそらく理由の束のために遅いです。 1つは、deploy.rbファイル内のすべてのrunに対して、サーバーに新しいリモートシェルを開きます。

これは、sshマスターチャネルを使用することによって少し修正できます。これにより、capistranoは実際にssh接続を再利用するため、ネットワークオーバーヘッドが少なくなります。 http://alexyoung.org/2011/05/17/deployment/

もう一つの理由があるすべてのデプロイ用に新しいディレクトリにコピーし、あなたの全体のコードベースこと:

は、ここでのsshマスターチャンネルに言及ルビーの展開に関する記事です。

のgitを使用したとき、これは厳密には必要ではない、とgithubのは、これを「修正」する方法についての素晴らしい記事があります。https://github.com/blog/470-deployment-script-spring-cleaning

+0

マスターチャンネルでは、展開が少し速くなりました。後で私は2番目の解決策も試みます。 – Mark

+1

Capistranoは.ssh/configのマスターチャネル構成に関係なく、SSH接続を再利用しているようです。 – Zr40

+0

マスターチャンネルを使用するときに違いがないことに気付きました。私は手動で私のサーバーにSSHを接続すると、はるかに高速ですが、Capistranoは気にしないようです。 – Ciryon