Vagrantãchefã Dockerã£ã¦æè¿ããèããã©ãªã«ãéãã®ï¼
ã¯ããã«
å æ¥ãã¡ã®ä¼ç¤¾ã®ã¢ã«ãã¤ãã«æ¥ã¦ããã¦ãã大å¦çããã« ãVagrant, chef, Dockerã£ã¦ããWebã§è¨äºãèªããã§ããã©ä½¿ã£ã¦ããæèãä¼¼ã¦ãã¦ãä½ãéã£ã¦ãã¦ã©ã使ãåããã®ãããããããªããã§ãããããã¨ãã風ã«å°ãããã¾ããã
ãã®æã«å½¼ã«ãå£é ã§èª¬æã¯ããã®ã§ããããã¾ã説æåºæ¥ãã®ãèªåã§ãæªããã£ãã®ã§ä»åã¾ã¨ãã¦ã¿ããã¨æãã¾ãã
Vagrantã¨ã¯
Vagrantã«ã¤ãã¦ã Vagrantæ¥æ¬èªããã¥ã¡ã³ãã«ã¯ä»¥ä¸ã®ããã«èª¬æããã¦ãã¾ãã
Vagrantã¯ã ããªãã¨ããªãã®ãã¼ã ã®çç£æ§/æè»æ§ãæ大éã«ããæå©ããããããã«ã ç°¡åãªç°å¢è¨å®/è¤è£½å¯è½ãªãã·ã³/æ¥çæ¨æºã®æè¡ã§æ§ç¯ãããï¼ã¤ã®ä¸è²«ããã¯ã¼ã¯ããã¼ã«ãã£ã¦å¶å¾¡ãããå¯æ¬çãªéçºç°å¢ãæä¾ãã¾ãã
ãã®æ©æµãå¾ãçºã«ãVagrantã¯å 人ã®ç¥è¦ã«åºã¥ãã¦ãã¾ãã ãã·ã³(éçºç°å¢ã®ãã·ã³)ã¯ãViretualBox, VMWare, AWS, ãã®ã»ãã®ãããã¤ãã«ããæä¾ããã¾ãã ããã¦ãã·ã§ã«ã¹ã¯ãªãã/Chef/Puppet ã¨ãã£ãæ¥çæ¨æºçã«æä¾ããã¦ãããã¼ã«é¡ã¯ã ãã·ã³ä¸ã®ã½ããã¦ã§ã¢ãèªåçã«ã¤ã³ã¹ãã¼ã«/è¨å®ããããã«ä½¿ç¨ããã¾ã ã
ãã£ããããã¨Vagrantã¨ã¯ä»®æ³ç°å¢ã®è¨å®ã»æä½ç¨çµ±ä¸ãã¼ã«ã§ãã
ãã¾ã¾ã§éçºç¨ã®ä»®æ³ç°å¢ãä½æãããã¨ããã¨ä»®æ³ç°å¢ç¨ãã¼ã« (VirtualBoxãVMWareãªã©)ã使ããOSã®ã¤ã¡ã¼ã¸ããã¦ã³ãã¼ãã»ã¤ã³ã¹ãã¼ã«ãåæè¨å®ãªã©ãããããè¡ã£ã¦åãã¦ä»®æ³ç°å¢ãæ§ç¯ã§ãã¾ãã
ãããããããã¼ã ã¡ã³ãã¼ãããããè¡ããã¨ã§OSã®ãã¼ã¸ã§ã³ã®éããä»®æ³ç°å¢ãã¼ã«ã®éããä»®æ³ç°å¢ãã¼ã«ã®è¨å®ã®éããªã©ãçºçãã¦ãã¾ããã¿ããªãåãç°å¢ã§éçºãè¡ããã¨ãé£ããæéããããä½æ¥ã§ããã
Vagrantã使ãå ´å ããããã®ä»®æ³ç°å¢ã®è¨å®ããã¹ã¦Vagrantfileã¨ããè¨å®ãã¡ã¤ã«ã«è¨è¿°ããã ä»®æ³ç°å¢ã®æä½ãvagrantã¨ããã³ãã³ãã©ã¤ã³ãã¼ã«çµç±ã§è¡ãã¾ãã
ä»®æ³ç°å¢ã®è¨å®ãVagrantfileçµç±ã§è¡ãããããããã¼ã ã¡ã³ãã¼ã«åãç°å¢ãæ§ç¯ãã¦ã»ããå ´åã¯ãã®Vagrantfileã使ã£ã¦ãã®äººãåãããã«vagrantçµç±ã§ä»®æ³ç°å¢ãèµ·åããã¨åä¸ã®ç°å¢ãç°¡åã«æã«å ¥ãã¨ãããã¨ã§ãã
ä»ã«ãVagrantã§ã¯ãã¹ããã·ã³ã¨ã²ã¹ããã·ã³ (Vagrantã§ä½æããä»®æ³ç°å¢)ã®æå®ãããã£ã¬ã¯ããªãåæããæ©è½ãããã©ã«ãã§ç°¡åã«å©ç¨ã§ããããããã¾ã¾ã§ä»®æ³ãã·ã³ã§éçºãè¡ã£ã¦ãã ãã¼ã«ã«ã§ãã¡ã¤ã«ç·¨é => ä»®æ³ç°å¢ã«ã¢ãã => ä»®æ³ç°å¢å ã§å®è¡ãã¨ããããã¼ã ãã¼ã«ã«ã§ãã¡ã¤ã«ç·¨é=> ä»®æ³ç°å¢ã§å®è¡ ã¨ãã風ã«ç°¡ç¥åã§ãã¾ãã
Vagrantã¯ãã¼ã«ã«ãã·ã³ã«æ§ç¯ããä»®æ³ç°å¢ã®ä»ã«ãAWSã®EC2ãvagrantã³ãã³ãã§ã³ã³ããã¼ã«ãããã¨ãå¯è½ã§ãããå人çã«ã¯æ¬çªç°å¢ã¨éçºç°å¢ãåããã¼ã«ã§ç°¡åã«æä½ã§ããã®ã¯å°ãæãã¨ãããããã®ã§ãVagrantã¯ããã¾ã§éçºç°å¢ã®æ§ç¯&æä½ãã¼ã«ã¨ãã¦å©ç¨ãã¦ãã¾ãã
chefã¨ã¯
chefã«ã¤ãã¦ã@ITã®è¨äºã§ã¯ä»¥ä¸ã®ããã«èª¬æããã¦ãã¾ãã
ãChefãã¨ã¯ãã·ã¹ãã æ§ç¯ãèªååããããã®ã½ããã¦ã§ã¢ãã¼ã«ãããã¯æ çµã¿ï¼ãã¬ã¼ã ã¯ã¼ã¯ï¼ã®ä¸ç¨®ãã·ã¹ãã ã®å種è¨å®ãå¤æ´ããããã¢ããªã±ã¼ã·ã§ã³ãããã«ã¦ã§ã¢ãã³ã³ãã¼ãã³ããªã©ã®ã½ããã¦ã§ã¢ãã¤ã³ã¹ãã¼ã«ãããããä½æ¥ãèªååã§ãããWindowsãLinuxãMac OS Xãªã©è¤æ°ã®ãã©ãããã©ã¼ã ã«å¯¾å¿ãã¦ããã
chefã¯ãã£ããããã¨ãµã¼ãã¼è¨å®ãã¼ã«ã§ãã
ä¾ãã°PHPãã¤ãã£ãWebã¢ããªã±ã¼ã·ã§ã³ãåä½ãããããã®ãµã¼ãã¼ãè¨å®ãããæãã¨Webãµã¼ãã¼ã¨ãã¦Apacheãã¤ã³ã¹ãã¼ã«ããPHPãã¤ã³ã¹ãã¼ã«ããDBã使ããªãMySQLãªã©ãã¤ã³ã¹ãã¼ã«ãã¾ãããã¡ãããµã¼ãã¼ã®æ§ç¯ã¯ããã ãã§ã¯çµããããã»ãã¥ãªãã£ç¨ã«ãããã¯ã¼ã¯ã®è¨å®ãããããããã¼ã«ãã¤ã³ã¹ãã¼ã«ããããã¤ã³ã¹ãã¼ã«ãããã¼ã«ç¾¤ã®è¨å®ãªã©ãããããè¡ãå¿ è¦ãããã¾ãã
ãµã¼ãã¼ã®è¨å®ãè¡ãã®ãä¸å°ã ããªãã¾ã è¯ãã®ã§ãããåé·åããããã«è¤æ°å°ãµã¼ãã¼ãç«ã¦ãå ´åã« ãã¹ã¦æä½æ¥ã§è¡ãã®ã¯å¹çãæªãã®ã§ãããã®è¨å®ä½æ¥ãããã°ã©ãã³ã°ã§èªååãããã¨ããã®ãchefã®å½¹å²ã§ãã
ä»ã«ãchefã¯åªçæ§(ä½åå®è¡ãã¦ãçµæã¯åã)ã¨ããç¹å¾´ããã£ã¦ããããããã§ã«ç¨¼åãã¦ãããµã¼ãã¼ã«å¯¾ãã¦å®è¡ãã¦ãç°å¢ãå£ããã¨ãªãchefã§è¨è¿°ããç°å¢ã«åæããã¾ãã
ãã®ããchefã®ã³ã¼ããè¦ãã ãã§ãµã¼ãã¼ã®ç¾å¨ã®ç¶æ ãææ¡ã§ããããã¥ã¡ã³ãã®å½¹å²ãæããã¦ããã¾ãã
Dockerã¨ã¯
Dockerã«ã¤ãã¦ãã¾ãã¾ã@ITããã®è¨äºã§ã¯ä»¥ä¸ã®ããã«èª¬æãã¦ãã¾ãã
ãDockerãã¨ã¯ãDocker社ï¼æ§dotCloudï¼ãéçºãããªã¼ãã³ã½ã¼ã¹ã®ã³ã³ããã¼ç®¡çã½ããã¦ã§ã¢ã®1ã¤ã§ãã
ä¸è¨ã®èª¬æã§è¨è¼ãã¦ããéãDockerã¯ã³ã³ããã¼ç®¡çã®ãã¼ã«ã§ãããããã³ã³ããã¼åä»®æ³åæè¡ã¨å¼·ãç´ä»ãã¦ãã¾ãã
ä»®æ³åã«ã¯ãã¹ãåã ãã¤ãã¼ãã¤ã¶ã¼åãã³ã³ããã¼åã¨å¹¾ã¤ã種é¡ããããä¸è¨ã§èª¬æããVagrantã§ä½¿ç¨ãã¦ããVirtualBoxãè¡ãä»®æ³åã¯ãã¹ãåãAWSã® EC2ããããã¯ã©ã¦ããªã©ã¯ã©ã¦ããµã¼ãã¹ãªã©ã§ä½¿ãããä»®æ³åã¯ãã¤ãã¼ãã¤ã¶ã¼åã®ä»®æ³åã§ãã
ããããã®ä»®æ³åæè¡ã®è©³ç´°ã«ã¤ãã¦ã¯é·ããªãããçç¥ãã¾ããã ã³ã³ããã¼åã¨ä»ã®ä»®æ³åã¨ã®éãã¯ãã®è»½ãã§ãã
ä»ã®ä»®æ³åæè¡ã¯ä»®æ³çãªãç©çãã·ã³ããä½ãã ãã¨ããã¢ããã¼ãã®ãããç©çãã·ã³ã®ä¸ã®ä»®æ³ç©ºéã«ç¬èªã®Linuxã«ã¼ãã«ãOSãªã©ãã¤ã³ã¹ãã¼ã«ãã¾ãããã³ã³ããã¼åã§ã¯ç©çãã·ã³ã®Linuxã«ã¼ãã«ã¯å ±æãã¦ãå¥ã ã®ã¦ã¼ã¶ã¼ç©ºéãä½ãåºãã¨ããã¢ããã¼ããåã£ã¦ãã¾ãã
Dockerã§ã¯ã³ã³ããã¼åã§ä½ãããä»®æ³ç°å¢ãDockerfileã¨ããè¨å®ãã¼ã«ã使ã£ã¦è¨å®ãå ¥ãè¾¼ãã§ããã¾ãã ããã«ãã£ã¦ãã®Dockerfileã使ãã°åãã³ã³ããã¼åã®ä»®æ³ç°å¢ãä½æã§ãã¾ãã
ããããã®ãã¼ã«ã®é¢ä¿
vagrant & chef
vagrantã¨chefã¯ã¨ãã«ä¸ç·ã«èªãããã¨ãå¤ãã®ã§æ··åãããããã®ã§ãããvagrantã¯ä»®æ³ç°å¢ã®æä½ã»è¨å®ãã¼ã«ã§chefã¯ãµã¼ãã¼è¨å®ãã¼ã«ã§ãã ãã使ããããã¿ã¼ã³ã ã¨vagrantã§ä½ã£ãä»®æ³ç°å¢ãWebã¢ããªã±ã¼ã·ã§ã³ãåä½ã§ããããã«ããããã«chefã§è¨å®ãå ¥ãããã®ãããªæãã§ãã
ãVagrantfileã§ããµã¼ãã¼ã®è¨å®ãå ¥ãããã¨æã£ã¦ãã¾ãã¨ããããã®ã§ãããVagrantfileã§ã¯ãµã¼ãã¼ã®è¨å®ãå ¥ããããã«ã·ã§ã«ã¹ã¯ãªããã使ãããchefã使ãããã©ã¡ãã§ãæ§ãã¾ããã Vagrantfileã§è¡ãã®ã¯ããã®ã³ãã³ãã使ã£ã¦ãµã¼ãã¼ã®è¨å®ããããªããã¨ããå ¥ãå£ãæä¾ãã¦ããã¦ããã ãã§ããã®è¨å®ãã¼ã«ã®é¸æè¢ã®ã²ã¨ã¤ã¨ãã¦chefãããã¨ããé¢ä¿ã§ãã
vagrant & Docker
ã¾ã£ããé¢ä¿ããã¾ããã
vagrantã¯ä»®æ³ãã¤ãã¼ãã¤ã¶ã¼åããã¹ãåä»®æ³åãã¼ã«ãéãã¦ä»®æ³ç°å¢ãæä½ããã®ã«å¯¾ãã¦ãDockerã¯ã³ã³ããã¼åã®ä»®æ³ç°å¢ãæä½ãã¾ãã
ã¦ã¼ã¹ã±ã¼ã¹ãä¼¼ã¦ããããæ··åããããããããªãã§ããããäºã対象ã¨ãã¦ããä»®æ³åæè¡ãéãããçµã¿åããã¦ä½¿ããã¨ã¯ã¾ããªãã¨æããã¾ãã
chef & Docker
çµã¿åããã¦ä½¿ããã¨ãå¯è½ã§ããããã¾ãã¡ãªããããªãããããã¾ããã
chefã¯ãµã¼ãã¼ãæ§ç¯ããéã«ãã®å¯¾è±¡ã¨ãªãç°å¢ã§rubyã¨chefãå®è¡ã§ããã°ãµã¼ãã¼è¨å®ãè¡ããã¨ãå¯è½ãªã®ã§ãDockerã§ä½ã£ãã³ã³ããã¼åä»®æ³ç°å¢ã§ãè¨å®ã®èªååã®ããã«ä½¿ç¨ãããã¨ã¯å¯è½ã§ãã
ãã Dockerèªä½ã«Dockerfileã¨ãããµã¼ãã¼ã®è¨å®ãè¨è¿°ãã¦èªååããæ©è½ãæä¾ãã¦ããããããããchefã«ç½®ãæããå¿ è¦ããã¾ãããã¾ãã(æ¢åã®chefã®è³ç£ãçãããã¨ããã¡ãªããã¯ããã¾ããã»ã»)
ããã«Dockerã§ä½æããã³ã³ããã¼åä»®æ³åæè¡ã¯ããã»ã¹å ã§ãã®ä»®æ³ç°å¢ãæ§ç¯ããããã®ããã»ã¹ãæ¶ãã¨ä»®æ³ç°å¢èªä½ããªããªãããåºæ¬çã«ã¯æ¯åä¸ããDockerfileã使ã£ã¦ä»®æ³ç°å¢ãæ§ç¯ãããã¨ã«ãªãã¾ãã chefã®ã¡ãªããã®ã²ã¨ã¤ã«åªçæ§ãããã¾ããããããæå¹ãªã®ã¯ãã§ã«chefã«ãã£ã¦ãµã¼ãã¼ã®è¨å®ãå ¥ã£ã¦ããã¨ããã«ä½åº¦ãå®è¡ãã¦ãç°å¢ãåãã§ãããã¨ãä¿è¨¼ãããããã§ãã Dockerã®ããã«æ¯åä¸ããä½æããç°å¢ã®å ´åã¯ä½åº¦ãå®è¡ãããã¨ããããããªãã®ã§åªçæ§ã¯ä¸è¦ã«ãªãã¾ãã
ãªã®ã§Dockerã使ãã®ã§ããã°ãµã¼ãã¼ã®è¨å®ãchefã使ããDockerã§å®çµãããæ¹ãé©åã§ãããã
çµããã«
Vagrant, chef, Dockerãã¾ã ããããªã人ã«ãã£ããã¨ãã説æãã§ããããã«ãã®è¨äºãæ¸ãã¦ã¿ã¾ããã
æ¬å½ã¯Dockerã®ä½¿ãã©ãããªã©ãå¿ è¦ãªã®ã§æ¸ãããã¨æã£ãã®ã§ãããä½åãå°½ããã®ã¨ãããªè¨äºã¯ãããã§ãããã®ã¨ãä½ããã¾ã èªåãä»äºã§ä½¿ã£ã¦ããªãã¨ããçç±ã§æ¸ãã®ã¯çç¥ãã¡ããã¾ãã ><
Webéçºã®ç¾å ´ã ã¨ã»ã¨ãã©Vagrantã¨chefã«é¡ä¼¼ãããµã¼ãã¼è¨å®ãã¼ã«(Puppet, Ansibleãªã©)ã¯ä½¿ãã®ã¯ããã¹ã¿ã³ãã¼ãã«ãªã£ã¦ãã¦ãDockerã¯ã¾ã ããããã ã確å®ã«ã¹ã¿ã³ãã¼ãã«ãªãæè¡ã£ã¦ããæãã ã¨æãã¾ãã
Dockerã使ãå ´åã¯ã¢ããªã±ã¼ã·ã§ã³ã®è¨è¨èªä½ãå¤æ´ãå¿ è¦ã«ãªã大ããªå¤åãªã®ã§ããã£ããã¨ãã£ããã¢ãããã¦ãããããªã
åèURL
Vagrantを使う理由 | Vagrant日本語ドキュメント
Windows Insider用語解説:Windows/Linuxで使えるシステム構築・設定の自動化ツール「Chef」とは? - @IT