ã¤ã³ãã©ã®ç¶ç¶çããªããªã¼
äºåã«æã£ã¦ãããããã§ãããã¤ã³ãã©ãã¯ã¬ã¤ã¤çã«ã¯ OS ããä¸ã®è©±ã
å°ãåã« GitHub 時代のデプロイ戦略 - naoyaのはてなダイアリー ã§ãGitHub ãä»ãããããã¤ãå®è·µãã¦ããã¨ãããã¨ãç´¹ä»ãããæ®æ®µã®éçºã Pull Request ãã¼ã¹ã§ãã£ã¦ããã®ã§ããããã¤ãã¾ã Pull Request ãå¥æ©ã«å®è¡ãããã¨è²ã æããã¨ãã話ã
ãã®ãã©ã¯ãã£ã¹ã®å¯¾è±¡é åãã¤ã³ãã©ã«ã¾ã§æ¡å¤§ãã¦ã¿ã¾ãããã¨ããã®ãä»åã®è©±ã
DNS ã¬ã³ã¼ãã Pull Request ã merge ããå¥æ©ã«èªåã§æ´æ°
AWS ãå©ç¨ãã¦ããå ´åããã¡ã¤ã³ã®ç®¡çã Amazon Route 53 ã使ãã¨ããããã¨é½åãããã
Route 53 ã§ã® DNS ã¬ã³ã¼ãã®æ´æ°ã¯ããã¾ã§ãã©ã¦ã¶ããæä½ãã¦ãããããã ã¨èª°ããã¤ä½æ¥ãããããããªããå±¥æ´ããã©ãã¯ãã¥ãããã¾ãå¤æ´ç¢ºå®åã«äºåã¬ãã¥ã¼ããã®ã«ãåãã¦ãªãã
ãã㧠roadworker ã使ããroadworker 㯠Route 53 ã® DNS ã¬ã³ã¼ãè¨å®ã ruby ã® DSL ã§æ¸ããããã«ãããã¼ã«ãè£ã§ã¯ Route 53 㨠API ã§éä¿¡ããã
roadworker ã使ãã¨ã以ä¸ã®ããã«ã¬ã³ã¼ãã Ruby ã®ãã¡ã¤ã«ã§æ¸ããã(GitHub ããå¼ç¨)
hosted_zone "winebarrel.jp." do rrset "winebarrel.jp.", "A" do ttl 300 resource_records( "127.0.0.1", "127.0.0.2" ) end rrset "winebarrel.jp.", "MX" do ttl 300 resource_records( "10 mx.winebarrel.jp", "10 mx2.winebarrel.jp" ) end end
ãããã¦ãDNSã¬ã³ã¼ãã®ç¾å¨ã®ç¶æ ããã³ã¼ãã«ãªã£ãã®ã§ããã¨ã¯ãã¤ãéã Git 㨠GitHub ã®ããã¼ã«ä¹ãããã¨ãã§ããããã¡ã¤ã«ã®æ´æ°ã«ã¯ Pull Request ã使ããã³ã¼ãã¬ãã¥ã¼ãããä¸æ³ã
æ´ã«ãRoute 53 ã¸ã®è¨å®ã®é©ç¨ããªãã¡ roadworker ã®å®è¡ã¯ CircleCI ã«ä»»ãããPull Request ã master ã« merge ããããèªå㧠roadwork
ã³ãã³ããå®è¡ããããã«ããããã¹ããã§ã¼ãºã§ dry run ããããã«ããã°ãä¸ãä¸ Ruby ã³ã¼ããå£ãã¦ãã¦ããããæ¤ç¥ã§ããã
dependencies: pre: - bundle install: timeout: 600 test: post: - bundle exec roadwork --dry-run --apply deployment: master: branch: master commands: - bundle exec roadwork --apply
å®è¡ã CircleCI ã«ä»»ããã° (Git ã«ãã¡ã¤ã«ã®æ´æ°å±¥æ´ãæ®ãã ãã§ãªã) å®è¡å±¥æ´ã®ãã°ãæ®ããããã¹ãã¼ã¿ã¹ã Slack ã«éç¥ããã®ãç°¡åã
DNS ã¬ã³ã¼ããæ¸ãæãããã¨ããã¨ããã¼ã¨ãã©ããããã ã£ã? ã¤ã³ãã©æ å½ãé¡ããã¨ãããã¨ã«ãªããã¡ã ããããã§ãåä¾ã«å£ã£ã¦ Pull Request ãæã㦠merge ããã ãã§ãã¹ã¦ãå®è¡ããããã¨ãããã¨ã«ãªã£ãã
以ä¸ã¯æè¿ KAIZEN platform Inc. ã«å ¥ç¤¾ãã glidenote ããã®ãä»äºã§ãããã°ãã¸ã§ã
Chef ã®é©ç¨ã CircleCI çµç±ã§ããã㦠ChatOps
ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤ã Pull Request ããã¼ã¸ããã¿ã¤ãã³ã°ã§å®è¡ããã¨ããèãæ¹ã DNS å¤æ´ã«ãé©ç¨ããã®ãå ã®ä¾ãåæ§ã«ããã Chef ã§ã®ã¤ã³ãã©ã®å¤æ´ãå ¨é¨åãããã«ãã£ã¡ããããã¨ãããã¨ã§ mdoi ããã£ãã£ãã
(ããã§ã¯ç°¡æçã« master ã« merge ãããã¨æ¸ãã¦ãããã©ãå®éã«ã¯ãããã¤ç¨ã®ãã©ã³ããå¥ã«ãã£ããã¨ã¡ãã£ã¨è¨è¨ã¯ç°ãªã)
Chef ã®ã¯ãã¯ããã¯ã®ãµã¼ãã¼ã¸ã®é©ç¨ã«ã¯ knife-solo
ã使ã£ã¦ããããããã CircleCI ã«å®è¡ããããCircleCI ã«ã¯ ssh ã®ç§å¯éµãã»ãã¥ã¢ã«æ¸¡ããä»çµã¿ãããã®ã§ãèªè¨¼å¨ãã®å¿é
ãç¹ã«å¿
è¦ãªããCircleCI ã«å®è¡ãä»»ãããã¨ã§ãæ¯åã®å®è¡ãã°ããã®ã¾ã¾æ®ããã®ã¯å
ã® DNS ã®ä¾ã«åããã§ãã¨ã¦ãè¯ãã
ã¤ã³ãã©ã«å®éã«ã³ã¼ããé©ç¨ããã®ã¯ãã¯ãã¯ããã¯å¤æ´ Pull Request ã® merge å¥æ©ã ã¨ãããã«ã¢ã°ã¬ãã·ããããã®ã§ã冒頭でも紹介した以前の記事ã«åããããããã¤ç¨ã® Pull Request ã使ãæ¹æ³ãæ¡ç¨ãã¦ãããã¤ã³ãã©ã«ææ°ã®ã¯ãã¯ããã¯ãé©ç¨ããããªãã¨æã£ãã deployment/qa-proxy
ãªã©ããããã¤ç¨ã®ãã©ã³ãã« Pull Request ãä½ã£ã¦ merge ããããã㨠CircleCI ãåãåºãã¦å¯¾è±¡ã·ã¹ãã ã« Chef é©ç¨ãå§ããã
ããã¾ã§æ¥ãããä¾ã«ãã£ã¦ ChatOpsã
ã¤ã³ãã©ã¸ã®å¤æ´é©ç¨ããã£ãããããã£ã¦ãã¾ãã°ãããããã§ãè¤æ°ã®æ å½è ãåæã«ã¤ã³ãã©ã«é©ç¨ããããªãã¦ãã¨ãèªç¶ã¨é²ããã¨ãã§ããã
ã¤ã³ãã©ãèªåã§æ´æ°ãªãã¦ããã¨ããããªã¹ã¯ã®é«ããã¨ããã£ã¦ããããã«èãããããå®éã«ã¯æå
㧠knife solo
ãã¦ããã®ã CircleCI ã«å®è¡ããã¦ããã ãã§ããããã®ããã»ã¹ã«ç§»è¡ãããã¨ã«ãããªã¹ã¯ã®å¢åã¯ãªãã
ãMerge pull requestããã¿ã³ã«ä½ç¨ãéç´ããã
ãããã¦ãã·ã¹ãã æ§æã®å¤æ´ãªã©ã®ä½ç¨ã PullRequest + CircleCI ã«ãããªãã¬ã¼ã·ã§ã³ã«éç´ããããã¨ããã®ã¯ãªããªãè¯ããã©ã¯ãã£ã¹ã§ããã
åã« Pull Request ãéã£ã¦å¤æ´ãã¾ãããããã ãã§ãååã«æ©æµã¯ããã®ã ãã©ãå®éã«ä½ãããã®å¤æ´å®è¡ã®ããªã¬ããMerge pull Request ãã¿ã³ãæ¼ããã¨ãããã¿ã³ã«ç´ã¥ããããã¨æèããªãã¦ãèªç¶ã¨ Pull Request ãéã£ã¦ãããã¨ããèãæ¹ã«ãªããDNS ã«å¤æ´ãå ããã â Pull Request ããã¼ã¸ããã (â» å®éã«ã¯ master ã«å¤æ´ããã£ãã) å¤æ´å¦çãèªåã§è¡ããã â ããããã«ãªã¯ä½ãããã¨ããå ·åã
ãããã¦çµæçã«ãä½ãããã«ãç·ã®ãã¿ã³ãæ¼ãã ããããªãã¡ã¯ã³ã¯ãªãããããã¤ã®ä»çµã¿ãæ§ç¯ã§ãããInfrastructure as Code ãæ¨ãé²ãã¦ãã¤ã³ãã©ã CI ãã¦ãã¯ã³ã¯ãªãã¯ããã㤠â ç¶ç¶çããªããªã¼ã®å®è·µã§ããã