Capistrano를 사용하여 빈 우분투 VM을 부트 스트랩합니다.capistrano 및 rvm-capistrano로 배포
조리법/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-capistrano
보석을 사용
조리법/rvm.rb
rvm-capistrano
보석은 모든 작업의 기본 쉘을 수정하고 추가됩니다 것처럼 나타납니다
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_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '[email protected]'
이것의 반향은 내베이스 레시피가 rvm을 설치하기 전에 runned되기 때문에 더 이상 작동하지 않는다는 것입니다 :
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 제조법을 작성해야합니까?
매우 유용한 것, 또한 실행할 수있는 것 ... ", : shell =>"bash "' – mpapis
@RyanWilcox blog.wilcoxd.com은 아래로 – matt
나는 매우 흥미로울거야. 네가 어떻게했는지 알면서. 나는 RVM을 설치하고 싶지 않지만 그것을 관리하기 위해 동일한 조리법 세트를 사용하고자하는 프로덕션 시스템을 가지고있다. 결국 나는 간단한 버전의 git-shell https를 작성했다. // gist .github.com/2785833 ~ ~/.rvm/bin/rvm-shell에 설치하십시오 –