2012-01-18 4 views
2

정확히 어디에 문제가 있는지 잘 모르겠지만 Capistrano는 거의 빈 프로젝트를 배포하는 데 약 5 분이 걸립니다.Capistrano very slow

내가 잘못했거나 평소인지 알 수 있습니까?

내가 사용하고 :

  • 카피 스트라 노 2.9.0을
  • 레일 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 

편집

+0

네트워크 속도가 느린가요? –

+0

이론상 5Mbit 업로드/다운로드 http://www.speedtest.net/result/1714391142.png – Mark

+0

어쩌면 서버 <=> github가 느립니다. –

답변

1

카피 스트라 노 이유의 무리에 아마 느립니다. 하나는 deploy.rb 파일의 모든 run에 대해 서버에 새로운 원격 쉘을 여는 것입니다.

이것은 ssh 마스터 채널을 사용하여 약간 수정할 수 있습니다. 이로 인해 capistrano는 실제로 ssh 연결을 재사용하게되므로 네트워크 오버 헤드가 적습니다. http://alexyoung.org/2011/05/17/deployment/

또 다른 이유는 모든 배포를위한 새로운 디렉토리에 복사합니다 전체 코드베이스가 :

다음은 ssh를 마스터 채널을 언급 루비 배포에 대한 기사입니다.

자식을 사용할 때이 꼭 필요한 것은, 그리고 github에가 "해결"하는 방법에 대한 좋은 기사를 가지고이 : https://github.com/blog/470-deployment-script-spring-cleaning

+0

마스터 채널을 사용하면 배포 속도가 조금 빨라졌습니다. 나중에 나는 두 번째 해결책을 시도 할 것이다. – Mark

+1

Capistrano는 .ssh/config의 마스터 채널 구성에 관계없이 SSH 연결을 다시 사용합니다. – Zr40

+0

마스터 채널을 사용할 때 아무런 차이가 없음을 알았습니다. 수동으로 SSH를 서버에 연결하면 동시 연결 속도가 훨씬 빨라지지만 Capistrano는 상관하지 않습니다. – Ciryon