CapistranoãRails以å¤ã§ä½¿ãæ¹æ³
Capistranoã¯Railsã¨é常ã«è¦ªåæ§é«ããã§ãããä»ã®è¨èªã§ã使ãã¾ãã
ä¾ã¨ãã¦Ethnaã®ããã¸ã§ã¯ãã capistranize ãã¦ã¿ã¾ãã
1.Ethnaã®ããã¸ã§ã¯ãä½æ
$ ethna.sh add-project test creating directory (/path/to/project/test) [y/n]: y
2.Railsç°å¢ã®é©ç¨
$ rails rails-tmp $ cp rails-tmp/Rakefile test $ cp -a rails-tmp/config test $ cp rails-tmp/db db $ cp -a rails-tmp/test test $ cp -a rails-tmp/lib/* test/lib $ cp rails-tmp/vendor test/vendor
ããã§Railsç°å¢ãåä½ããããã«ãªãã¾ããã
ããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªå
㧠Rake -T çãå®è¡ãã¦ã¨ã©ã¼ãã§ãªããã°OKã§ãã
3.capistranizeã®é©ç¨
ããããã¯æ®éã®railsã¢ããªã±ã¼ã·ã§ã³ã¨åãã§ãã
$ cap -A test
config/deploy.rbãè¨å®ããã¨capistranoã使ããããã«ãªãã¾ãã
æ¨æºã®Railsã¢ããªã¨ãã£ã¬ã¯ããªæ§æãéããããããã«ä½µãã¦ã¿ã¹ã¯ããªã¼ãã¼ã©ã¤ããã¾ãã
config/deploy.rbã®æå¾ã«ä»¥ä¸ã®ã³ã¼ãã追å ãã¾ãã
desc "Set up the expected application directory structure on all boxes" task :setup, :roles => [:app, :db, :web] do run <<-CMD mkdir -p -m 775 #{releases_path} #{shared_path}/system && mkdir -p -m 777 #{shared_path}/log && mkdir -p -m 777 #{shared_path}/tmp && CMD end desc <<-DESC Update all servers with the latest release of the source code. All this does is do a checkout (as defined by the selected scm module). DESC task :update_code, :roles => [:app, :db, :web] do on_rollback { delete release_path, :recursive => true } source.checkout(self) run <<-CMD rm -f #{release_path}/config/id_rsa.contents* && rm -rf #{release_path}/log #{release_path}/tmp && ln -nfs #{shared_path}/log #{release_path}/log && ln -nfs #{shared_path}/tmp #{release_path}/tmp CMD end
ãã®ä»ã«ããã¬ã¼ã ã¯ã¼ã¯ã«ãã£ã¦ã¯å¤æ´ããªããã°ãããªãã¿ã¹ã¯ãããããããã¾ããããã®å ´åã¯
/path/to/rubygemsroot/capistrano-1.2.0/lib/capistrano/recipes/standard.rb ããå¤æ´ããã¿ã¹ã¯ãdeploy.rbã«ã³ãã¼ãã¦å¤æ´ããã°OKã§ãã
capistranoã®ã¤ããã¯å®éã«ä½æãã¦ã¿ãã¨ãããã¾ãã