第8å deploy:rollback 㨠deploy:cleanup
2008/05/18
ä»åã¯ãdeploy:rollback ã¿ã¹ã¯ã¨ deploy:cleanup ã¿ã¹ã¯ã«ã¤ãã¦ã
deploy:update ã¿ã¹ã¯ãå®è¡ããã¨ãCapistrano 㯠Subversion ãªã©ã®ãªãã¸ããªããã½ã¼ã¹ã³ã¼ãããã§ãã¯ã¢ã¦ããã¦ããã®ã ããããå°ã詳細ã«è¦ãã¨ãããããªãã¨ããã¦ããã
releases
ãã£ã¬ã¯ããªã®ä¸ã«ç¾å¨æå»ã«åºã¥ã YYmmddHHMMSS å½¢å¼ã®ãµããã£ã¬ã¯ããªãä½ããããã«ææ°ã®ã½ã¼ã¹ã³ã¼ãããã§ãã¯ã¢ã¦ãããã- ãã®ãµããã£ã¬ã¯ããªã«
shared/log
ãã£ã¬ã¯ããªã¸ã®ã·ã³ããªãã¯ãªã³ã¯ãä½ãã current
ãã£ã¬ã¯ããªãããã®ãµããã£ã¬ã¯ããªã¸ã®ã·ã³ããªãã¯ãªã³ã¯ãä½ãã
ã¤ã¾ããCapistrano ã¯ä»¥åã«ãã§ãã¯ã¢ã¦ãããã½ã¼ã¹ã³ã¼ããåã£ã¦ããã¦ãã·ã³ããªãã¯ã®ä½ãæ¿ãã«ãã£ã¦ææ°çãåãããã«ãã¦ããããã ã
deploy:rollback ã¯ãä¸ã¤åã®ã½ã¼ã¹ã³ã¼ãã«æ»ãã¦ã¢ããªã±ã¼ã·ã§ã³ãåèµ·åããã¿ã¹ã¯ã§ãããå
·ä½çã«ã¯ãcurrent
ãã£ã¬ã¯ããªã®ãªã³ã¯å
ãä¸ã¤åã®ã½ã¼ã¹ã³ã¼ãããã§ãã¯ã¢ã¦ããããã£ã¬ã¯ããªã«æ¿ãã¦ãææ°ã®ã½ã¼ã¹ã³ã¼ããåé¤ããdeploy:restart
ã¿ã¹ã¯ãå®è¡ããã
ãããã¤ããã°ããã®ã¢ããªã±ã¼ã·ã§ã³ã«é大ãªãã°ãçºè¦ããã¦ãæ¥ãã§å ã«æ»ãããå ´åã«ç¨ããã¿ã¹ã¯ã§ããã
* executing `deploy:rollback' * executing `deploy:rollback_code' * executing "ls -x /var/rails/ballad/releases" servers: ["alpha.oiax.jp"] [alpha.oiax.jp] executing command command finished * executing "rm /var/rails/ballad/current; ln -s /var/rails/ballad/releases/20080517010640 /var/rails/ballad/current && rm -rf /var/rails/ballad/releases/20080518014637" servers: ["alpha.oiax.jp"] [alpha.oiax.jp] executing command command finished * executing `deploy:restart' * executing "/var/rails/ballad/current/script/process/reaper" servers: ["alpha.oiax.jp"] [alpha.oiax.jp] executing command ** [out :: alpha.oiax.jp] Restarting 17952 ** [out :: alpha.oiax.jp] Restarting 17962 ** [out :: alpha.oiax.jp] Restarting 17964 ** [out :: alpha.oiax.jp] Restarting 17960 command finished
ãã¦ãdeploy:update ã¿ã¹ã¯ãç¹°ãè¿ãå®è¡ããã¨ãå¤ãã½ã¼ã¹ã³ã¼ããã¿ã¼ã²ãããã¹ãã«è²¯ã¾ã£ã¦ãããã¨ã«ãªãããã£ã¹ã¯ã¹ãã¼ã¹ã®ç¡é§ãªã®ã§ãææ°çããä½ä¸ä»£ããæ®ãã¦æ¶å»ãã¦ããããã
ãã®ãããªæã«ãdeploy:cleanup ã¿ã¹ã¯ã使ç¨ããã
ããã©ã«ãã§ã¯5ä¸ä»£åã®ã½ã¼ã¹ã³ã¼ããæ®ãã¦ãã¹ã¦æ¶å»ãããæ®ãã¹ãä¸ä»£æ°ã¯ keep_releases
å¤æ°ã§å¶å¾¡ã§ããã®ã§ãconfig/deploy.rb
ã«æ¬¡ã®ããã«æ¸ãã°ã3ä¸ä»£åãæ®ãããã«ãªãã
set :keep_releases, 3
å®è¡ä¾ï¼
* executing `deploy:cleanup' * executing "ls -x /var/rails/ballad/releases" servers: ["alpha.oiax.jp"] [alpha.oiax.jp] executing command command finished ** keeping 3 of 5 deployed releases * executing "rm -rf /var/rails/ballad/releases/20080512155340 /var/rails/ballad/releases/20080513092114" servers: ["alpha.oiax.jp"] [alpha.oiax.jp] executing command command finished