Header

  1. View current page

    aproxacs

Profile_img_60x60_01
112

[Rails] Capistrano와 seesaw를 이용해서 배포하기

capistrano는  rails application의 배포를 쉽게 해주고 - [Rails] Capistrano 2.0 을 사용해서 deployment 자동화하기 참조

seesaw는 서비스의 중단 없이 rails application을 재시작 할 수 있도록 해 준다. - seesaw 사용해서 서비스를 우아하게 재시작하기 참조

 

한걸음 더 나아가서 capistrano와 seesaw를 이용해서 서비스의 중단없이 rails application을 배포해보자.

capistrano의 deploy 명령은 소스를 svn으로부터 checkout 받고 적당한 symbolic link를 생성한 후 rails를 재시작한다. mongrel_cluster를 사용하고 있다면 이 재시작 명령이 다음과 같다.

  1. mongrel_rails cluster::restart

이것을 seesaw를 이용해서 재시작하는 다음 명령으로 바꾸면 되겠다.

  1. mongrel_rails seesaw::bounce

 

Capistrano의 restart task 재정의하기

config/deploy.rb 파일에 capistrano의 restart task를 재정의하자.

  1. set :seesaw_conf, "#{current_path}/config/seesaw.yml"

  2. namespace :deploy do
      desc <<-DESC
      Restart the Mongrel processes on the app server using seesaw
      DESC
      task :restart, :roles => :app do  
        send(run_method, "#{mongrel_rails} seesaw::bounce -C #{seesaw_conf}")
      end
  3. end

 

만약 god를 사용해서 mongrel들을 감시하고 있다면 restart task를 다음과 같이 하자.

  1.   task :restart, :roles => :app do  
  2.     send(run_method, "god unmonitor pichu")
  3.     send(run_method, "sleep 5")
        send(run_method, "#{mongrel_rails} seesaw::bounce -C #{seesaw_conf}")
  4.     send(run_method, "sleep 5")
  5.     send(run_method, "god monitor pichu")
      end

 

끝이다.

 

에러

cap deploy 중 mongrel_cluster.yml를 못찿겠다는 에러가 발생한다면 seesaw.yml의 mongrel_config_file을 절대경로로 바꾸어 주자.

mongrel_config_path가 아니고 mongrel_config_file이다.

  1. mongrel_config_file: /PATH/TO/RAILS/config/mongrel_cluster.yml

 

 

Tags

History

Last edited on 02/28/2008 20:25 by 창

Comments (0)

You must log in to leave a comment. Please sign in.