2012-03-30 10 views
2

私はCapistranoを使って空のUbuntu VMをブートストラップしています。capistranoとrvm-capistranoでデプロイ

Iベース要件をインストールベース処方を有する:

レシピ/ base.rb

def set_default(name, *args, &block) 
    set(name, *args, &block) unless exists?(name) 
end 

namespace :deploy do 
    desc "Install everything onto the server" 
    task :install do 
    run "#{sudo} apt-get -y update" 

    # Common dependencies 
    run "#{sudo} apt-get -y install curl git-core build-essential python-software-properties" 
    run "#{sudo} apt-get -y install sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion" 

    # Set timezone to UTC 
    run "#{sudo} bash -c 'echo UTC > /etc/timezone'" 
    run "#{sudo} cp /usr/share/zoneinfo/UTC /etc/localtime" 
    run "#{sudo} dpkg-reconfigure -f noninteractive tzdata" 
    end 
end 

を私はまた、RVMをインストールするためのレシピを持っています。

rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '[email protected]' 

rvm-capistrano宝石はすべてのタスクやアペンドのデフォルトのシェルを変更しているかのように表示されます

レシピ/ rvm.rb

set_default(:rvm_ruby_string) { "[email protected]#{application}" } 
set_default(:rvm_install_type, :stable) 
set_default(:rvm_type, :user) 

require 'rvm/capistrano' 

after 'deploy:setup', 'rvm:install_rvm' 
after 'deploy:setup', 'rvm:install_ruby' 

:私は、このためにrvm-capistrano宝石を使用しますこれは、私の基本レシピは、rvmをインストールする前に実行されているため、もう動作していないということです。

cjoudrey (master) app$ cap deploy:install 
    * executing `deploy:install' 
    * executing "sudo -p 'sudo password: ' apt-get -y update" 
    servers: ["33.33.33.10"] 
    [33.33.33.10] executing command 
    [33.33.33.10] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '[email protected]' -c 'sudo -p '\''sudo password: '\'' apt-get -y update' 
** [out :: 33.33.33.10] bash: /home/vagrant/.rvm/bin/rvm-shell: No such file or directory 
    command finished in 45ms 
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '[email protected]' -c 'sudo -p '\\''sudo password: '\\'' apt-get -y update'" on 33.33.33.10 
cjoudrey (master) app$ 

deploy.rb

require 'bundler/capistrano' 

load 'config/recipes/base' 
load 'config/recipes/rvm' 
load 'config/recipes/nginx' 
load 'config/recipes/mysql' 
load 'config/recipes/nodejs' 

server '33.33.33.10', :web, :app, :db, primary: true 

set :user, 'vagrant' 
set :application, 'app' 
set :deploy_to, "/home/#{user}/apps/#{application}" 
set :deploy_via, :remote_cache 
set :use_sudo, false 

set :scm, 'git' 
set :repository, '[email protected]:cjoudrey/test.git' 
set :branch, 'master' 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 
ssh_options[:keys] = `vagrant ssh-config | grep IdentityFile`.split(' ').last 

after 'deploy', 'deploy:cleanup' 

は、誰もが前に、この問題がありましたか? rvm-capistranoがデフォルトのシェルを変更するときを制御する方法はありますか?つまり、deploy:installのデフォルトシェルを変更しないようにする方法はありますか?

rvm-capistranoの代わりに自分のrvmレシピを作成するだけでいいですか?

答えて

4

私は同様の問題があり、私のdeploy.rbにdisable_rvm_shell関数を書くことになりました。私はこれをブログエントリ:Capistrano, system wide RVM and creating gemsets as part of deploy:setupに記録しました。

+2

非常に便利なことですが、実行することもできます... "、:shell =>" bash "' – mpapis

+0

@RyanWilcox blog.wilcoxd.comがダウンしました – matt

+0

私は非常に興味がありますあなたがどのようにそれをしたのか知っている。私はRVMをインストールしたくない生産システムを持っていますが、それを制御するために同じセットのレシピを使用したいと思います...最終的には、git-shellの単純なバージョンhttps:// gist .github.com/2785833から〜/ .rvm/bin/rvm-shellにインストールしてください –

関連する問題