[英]Capistrano very slow
我不確定問題的確切位置,但是Capistrano大約需要5分鍾才能部署幾乎是空的項目。
你能告訴我我做錯了還是平常的?
我在用:
這是我得到的輸出: 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, "git@github.com: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
編輯
Capistrano可能由於多種原因而運行緩慢。 一種是它為您的deploy.rb文件中的每次run
打開一個新的遠程外殼程序到服務器。
可以使用ssh主通道對此進行一些修改,這將導致capistrano實際上重用ssh連接,這意味着較少的網絡開銷。
這是一篇有關ruby部署的文章,其中提到了ssh主頻道: http : //alexyoung.org/2011/05/17/deployment/
另一個原因是,每次部署時,它將整個代碼庫復制到一個新目錄。
在使用git時,這不是絕對必要的,並且github上有一篇很棒的文章介紹了如何“修復”此問題: https : //github.com/blog/470-deployment-script-spring-cleaning
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.