ãã¼ã¿ãã«ãªWebã¢ããªã±ã¼ã·ã§ã³
140æåã§æ¸ããããªãã£ãã®ã§ããã°ã«æ®´ãæ¸ãã
Heroku ã®ã¢ããªã±ã¼ã·ã§ã³ã人ã«æ¸¡ã
æ¨æ¥ããnaoyaãããä½ã£ã¦ãiOSã¢ããªã®ããã¯ã¨ã³ããµã¼ãã¼ã«ç¸ä¹ãããã¦ããããªãããã¨ãã話ãããã ãããèªåã§ãåããããªAndroidã¢ããªãä½ã£ã¦ãããã©ããµã¼ãã¼ãµã¤ãã¯ä½ã£ã¦ãªãããã¨ãããã¨ãããã
対ãã¦ãgithubã«ã³ã¼ãããããgit cloneãã¦heroku pushããã°åãããèªå㧠heroku ã«ãããã¤ãã¦ããã¨å¿ãããç¸ä¹ããã¦ããã£ã¦ãããã£ãã®ã ãã©ããã¡ãã§ã³ã¼ããæ¸ãæãããã¡ã³ãããã¨ãã«å æ¹ã®ã¢ããªãåæ¢ãããã¨ãèããã¨åãã³ã¼ããã¼ã¹ã§ãµã¼ãã¼ã¯èªåã§ç«ã¦ã¦ãããæ¹ãä½ãã¨è¯ãã
対象ã«ãªã£ãã½ããã¦ã§ã¢ã¯ Heroku ã§åããã¦ããã®ã§ãHeroku Ready ãªå½¢ãã¤ã¾ããå¿ è¦ãªå¤é¨ããã±ã¼ã¸ã®ä¸è¦§ããµã¼ãã¼ã®èµ·åæé ãªããã¯ãã¹ã¦ããã°ã©ããã«ã«æ§æããã¦ãã¦ï½¥ï½¥ï½¥å¤§è¢è£ã«è¨ã£ã¦ããã©è¦ããã« Bundler ã« gem ä¸è¦§ãæ¸ã㦠Procfile ã«ã³ãã³ãå¼æ°ãæ¸ãã¦ãã£ã¦ã㨠(å®é㯠Node.js ã ãã©) ã«ãªã£ã¦ãããã ããããã®ã½ããã¦ã§ã¢ãåããã®ã«ãããããããããæé ã§ããã¨èª¬æããªãã¦ãã"git push heroku master" ããã° OK ã§ãããã§æ¸ãã
Heroku ã使ã£ããã¨ããã人ãªãåããéããHeroku 㯠git push ããã ãã§ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤ãå¯è½ã ãããã®é½åº¦ãå é¨ã§ã¯æ°ããç°å¢ï½¥ï½¥ï½¥ ã³ã³ãããç«ã¡ä¸ãã¦ã¢ããªã±ã¼ã·ã§ã³ãæ§æãç´ããæºåãæ´ã£ããå¤ãã³ã³ããã¯å»æ£ãããæ°ãããã®ããã©ãã£ãã¯ãåãåããã¨ããä»çµã¿ã«ãªã£ã¦ããã
å¾ã£ã¦ãHeroku ã§åãã Web ã¢ããªã±ã¼ã·ã§ã³ã¯ãã®ä»çµã¿ã§å»æ£ãããããæ°ããç«ã¡ä¸ãç´ããã¨ãã§ããåæã§ä½ãå¿ è¦ããããå¿ è¦ãããã¨ããããHeroku ã®ã¢ã¼ããã¯ãã£å´ãã Web ã¢ããªã±ã¼ã·ã§ã³ãã©ãæ§æãã¹ããã¨ãããã¨ãèªåçã«æ±ºã¾ããããªãã¡ãã¢ããªã±ã¼ã·ã§ã³ããã¼ã¿ãã«ã«ãªãããæ§æããããããã¨ã«ãªãããã ããHeroku ã¯ç¹ã«ãã®è¾ºãã§ç¬èªä»æ§ãè¦æ±ãã¦ãããã¨ã¯ãªããRuby ã§ããã° Bundler ã Foreman ããNode.js ã§ããã° npm ãã¨è¡ã£ãå½¢ã§åãã©ãããã©ã¼ã ã§ããã¡ã¯ãã¹ã¿ã³ãã¼ããªéå ·ã使ã£ã¦æ§æããã°ããã
çµæçã«ãHeroku ã®ã¢ã¼ããã¯ãã£ã Webã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿ããªãã£ãè¦æ±ããããã«ãã£ã¦ãåé ã®ã±ã¼ã¹ã®ããã«ãä»äººã« Webã¢ããªã±ã¼ã·ã§ã³ããã£ãããã®ã¾ã¾æ¸¡ãã¨ããå¯æ¬¡çãªå©çãå¾ããã¦ããããã® Webã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿ããªãã£ã¯ããã£ãããã®ã¾ã¾åãç©ãããæ§æã§ããã¨ãããã¨ã§ãä¾ãã°ãµã¼ãã¼ãèªåã§ã¹ã±ã¼ã«ã¢ã¦ããããã¨ããããããã¨ãã«å¨åãçºæ®ããããåã Web ã¢ããªã±ã¼ã·ã§ã³ã Heroku ã§åããã®ã§ã¯ãªã Test as a Serviceãä¾ãã° Travis ã¨ã Circle CI ã®ãããªã¯ã©ã¦ããµã¼ãã¹ã«æ¾ãè¾¼ãã§ãã¹ããã¦ãããæã®åæã«ããªã£ã¦ããã
Immutable/Disposable Infrastructure
Immutable Infrastructureãããã㯠Disposable Infrastructure ã¨ããèãæ¹ãæ¨ä»è©±é¡ã ã
- インフラ系技術の流れ - Gosuke Miyashita
- 今さら聞けない Immutable Infrastructure - 昼メシ物語
- 2014年のウェブシステムアーキテクチャ - stanaka's blog
Webã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¼ã®ããã«ç¶æ ãæã¤å¿ è¦ããªããµã¼ãã¼ã¯ããããç¶æ ãæããªãã¨ãããã¨ãå¶ç´ã«ãããã¤ã§ãå»æ£å¯è½ã§ããã¨ããåæã§æ±ãã¨éç¨ã³ã¹ããä¸ãããããããªå¯è½æ§ãè¦ãã¦ãããã¨ããè°è«ãæ¨ä»ã®ãããã¸ã§ãã³ã°ãã¬ã¼ã ã¯ã¼ã¯ã DevOps ã¸ã®æ³¨ç®ã®éã¾ãã¨ãããããããã®ã®é大æã¨ãã¦ã®æ¦å¿µãã¨ãããã¨ããã£ã¦çãä¸ãã£ã¦ããã
ãã¾ Immutable Infrastructure ã«ã¤ãã¦è°è«ããããä½ããä½ã£ãããã¦ãã人ãã¡ã¨ããã®ã¯åºæ¬çã«ã¯ã©ã¦ããµã¼ãã¹ã®è£å´ããããã¯å¤æ°ã®ãµã¼ãã¼éç¨ããã¦ãã大è¦æ¨¡ Web ãµã¼ãã¹ã®è£å´ã®äººãã¡ã主ã ã£ãã¨ããã§ããã(èªåãå«ã) å½¼ãã«ã¯ãå½¼ããæ¥ã 管çããªããã°ãªããªã大éã®ãµã¼ãã¼ãããã¯ã¤ã³ã¹ã¿ã³ã¹ã®éç¨ã³ã¹ããä¸ãããã¨ã«ã¨ã¦ãå¼·ãã¢ããã¼ã·ã§ã³ãçµæ¸åçæ§ãããã
ä¸æ¹ãåã«èªåã® Web ã¢ããªã±ã¼ã·ã§ã³ãåãããµã¼ãã¼ãããã°ããã§ãããã¨ãããããªããå°ãã¨ã³ãããã®ãããããã¼ã«ã¨ã£ã¦ã¯ã©ãããã¾ã ããã¾ãã¡ãã³ã¨æ¥ã¦ããªããããããªãããããã人㯠Immutable Infrastructure çãªã¤ã³ãã©ãå®ç¾ãããå¾ã®ä¸çã®ã¤ã¡ã¼ã¸ã¨ãã¦ãHeroku ãæ³åãã¦ããã°ããã
Heroku ã« git push ãããããããã¼ããè¦ãå ´åãHeroku ã§åããã¦ããã¢ããªã±ã¼ã·ã§ã³ç°å¢ã¯ãããã¤ã®åº¦ã«å»æ£ãããããç´ãããªã Disposable Infrastructure ã§ãããHeroku ã®ã¤ã³ãã©ã¹ãã©ã¯ãã£ãå»æ£ãããåæã¨ããå¶ç´ããããã§åãã Web ã¢ããªã±ã¼ã·ã§ã³ã«ã©ãããå¯æ¬¡çå©çãåã¼ããã¨ãããã¨ã¯å ã«è¦ãéãã§ããã
Docker
Immutable/Disposable Infrastructure ãå®ç¾ããããã«ã¦ã§ã¢ã¨ãã¦æ³¨ç®ãéã¾ã£ã¦ããã®ã Docker (https://www.docker.io)ãDocker 㯠LXC 㨠AUFS ãçµã¿åãã㦠Heroku ã®ãã㪠PaaS ããã¯ã¨ã³ããããªãã¡ã³ã³ããåã®ä»®æ³ç°å¢ãã«ã¸ã¥ã¢ã«ã«éç¨ç¶æã§ããããã«ããã½ããã¦ã§ã¢ã ããã©ããæè¿ RHEL ã«æè¼ããããã¨æããããã¤ãæ¨æ¥ãGoogle Compute Engine ãä¸è¬å ¬éã¨ã¨ãã« Docker ãµãã¼ããçºè¡¨ ããããã¦ãé常ã«å¢ãããããDocker é¢ç½ããªã¨æã£ã¦ããèªåããã¾ãããããªå¢ãã§æ®åããã¨ã¯æã£ã¦ããªãã£ãã
Docker ã®éè¦ãªç¹å¾´ã«ãDocker ã³ã³ããã¨ãã¦æ§ç¯ããã¢ããªã±ã¼ã·ã§ã³ã¯ããã®ã¾ã¾ã¤ã¡ã¼ã¸ã¨ãã¦ã¨ã¯ã¹ãã¼ããã¦å¥ã®ãã¹ãã«æã£ã¦ãã£ã¦ãDocker ã³ã³ããã¨ãã¦ãã£ãããã®ã¾ã¾å度ç«ã¡ä¸ãããã¨ãã§ãããã¨ãããã®ããããããã Immutable/Disposable Infrastructure ã®æèã§èªãããæ©è½ã¨ãããããã®è¾ºã®å¶ç´ãåæã¨ãªã£ã¦å®ç¾ãããæ©è½ã§ããã
Google Compute Engine ã®ãããªå¤§è¦æ¨¡ã¯ã©ã¦ããã©ãããã©ã¼ã ã Docker ããµãã¼ãããã¨ãããã¨ã¯ãä¾ãã°èªåã®æå ã® OSX å ã® Vagrant ã§ç«ã¡ä¸ãã VM ã§åãã¦ãã Docker ã³ã³ããããããæ¥å¤§è¦æ¨¡è¨ç®ãªã½ã¼ã¹ãå¿ è¦ã«ãªã£ãããã¨ãããããçç±ã§ãGoogle ã®ã¯ã©ã¦ãã«ç§»ãã¦åãããªãã¦ãã¨ãããããããããè¦ãå ´åã«ã»ã¼ãã¼ã³ã¹ãã§å®ç¾ã§ãããã¨ãããã¨ã§ããããããã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿ããªãã£ã¨ããæèã§èå¯ããã¨è²ã ã¨é¢ç½ããåã«èªåã®ã¢ããªã±ã¼ã·ã§ã³ã®åä½ç°å¢ãã¹ã±ã¼ã«ã¢ããã¨ãããã¨ã«çã¾ãããä»äººã«ã¢ããªã±ã¼ã·ã§ã³ãé å¸ããã¨ããTest as a Service ãã®ä»ããã¬ã¤ã¤ã®é«ãã¯ã©ã¦ããµã¼ãã¹ã«æ¾ãè¾¼ãã¨ããããããªã¦ã¼ã¹ã±ã¼ã¹ãèããããã
Webã¢ããªã±ã¼ã·ã§ã³ãé å¸ãã ・・・ Movable Type
ã¨ããã§ãWebã¢ããªã±ã¼ã·ã§ã³ãé å¸ããã¨ããã¨èªåãæãåºãã¦ãã¾ãã®ã¯ã10å¹´åã®ããã°ãã¼ã ã®ç«ä»ãå½¹ã«ãªã£ã Movable Type ã¨ããããã°ãã¼ã«ã§ãããMovable Type 㯠Perl ã§æ¸ããããµã¼ãã¼ã¤ã³ã¹ãã¼ã«åã®ã½ããã¦ã§ã¢ã§ããã¦ã³ãã¼ããã¦èªåã®ãµã¼ãã¼ã«èªãè¨ç½®ãã¦åä½ãããå¿ è¦ããã£ããå½æã¯å¨å²ã®ããã°ãã¼ã«ã«æ¯è¼ãã¦ãã£ã¨é«æ©è½ãã¤æ´ç·´ããã¦ããã®ã§ãMovable Type ãåãããããããã«ãæ £ããªã Linux ãµã¼ãã¼ã¨æªæ¦è¦éããã¨ã³ãã¦ã¼ã¶ã¼ã大å¢ããã
Movable Type ããããã£ã¨åãããä¾ãã°æ²ç¤ºæ¿ãã¢ã¯ã»ã¹ã«ã¦ã³ã¿ã¼ã®ãããªã¹ã¯ãªãããªãããã¤ã³ã¿ã¼ãããä¸ã§é å¸ãã¦ããããã°ã©ã ã¯é å¸ããããèªåã§è¨ç½®è¨å®ãã¦èªåã®è¨ç®æ©ãªã½ã¼ã¹ã§ä½¿ã£ã¦ããã¨ããå½¢ã§ã¢ããªã±ã¼ã·ã§ã³ãé å¸ããã¨ããå½¢æ ã¯è¯ããã£ããè¯ããã£ãããã©ããMovable Type ã¯ãããã®ããã°ã©ã ã®é å¸ãç°¡åã§ãããä¸æ岩ã®ã¹ã¯ãªããã«æ¯è¼ããã¨ãã£ã¨è¤éä¸ã¤é«æ©è½ã§ãä¸ã«ã¯ãã¼ã¿ãã¼ã¹é¢é£ããã³ãã¬ã¼ãã¨ã³ã¸ã³ãã®ä»å¤ç¨®å¤æ§ãªã©ã¤ãã©ãªãªãããå«ã¾ãã¦ãããæåã«ã¿ãå°è±¡ã¨ãã¦ã¯ããããªã«å¤§ããªããã°ã©ã ãé å¸ãã¦ãããã®ããã¨é©ãããããã§ããã®ä»ã®é¡ã®ãã®ã¨ã¯ä¸ç·ãç»ãã¦ãããMovable Type ã¯é«åº¦ãªã¢ããªã±ã¼ã·ã§ã³ã«ãé¢ããããã¦ã³ãã¼ãé å¸åã®ã½ããã¦ã§ã¢ã§ãããã¨ãç¶æããã®ã«ãããªãã®éçºã³ã¹ããæ¯æã£ã¦ããããå®ç¾ãã¦ããã
ãã ãå½ç¶ã®æµãã ããã©ããè¨ç½®ã«ã¯ãµã¼ãã¼ã¯å¿ è¦ã ãå®éåããã¾ã§ã«è²ããªè¦å´ããããã§ãå¤ãã®ã¦ã¼ã¶ã¼ã¯ãã®å¾ãã¡ãã¡ã§ç«ã¡ä¸ãã£ãããã°ãµã¼ãã¹ãã¤ã¾ã SaaS ç³»ã®ãµã¼ãã¹ã«ç§»ã£ã¦ãã£ãã
ãã®æèªåãæã£ãã®ã¯ãé å¸åã® Movable Type ãããããèªåã®è¨ç®æ©ãªã½ã¼ã¹ã§åããã¨ããã®ã¯è²¬åãè² è·ã®åæ£ã¨ããæå³ã§ã¯ããWebçãªåæ£ã®èãæ¹ã ããã©ããã¨ã³ãã¦ã¼ã¶ã¼ãæ¯æãã³ã¹ãã大ããããã®ã§ããã®ã³ã¹ããä¸æã«å¼ãåãã¾ãããã¨ããã®ãããã°ãµã¼ãã¹ã ã¨ãããã¨ã ã£ããå¤æ°ã®ã¦ã¼ã¶ã¼ãããããæ¯æã£ã¦ããå°ããªã³ã¹ããã¾ã¨ãã¦ä¸æã«å¼ãåããããã ããããã®ã³ã¹ãããããªãã«å¤§ããªãã®ã«ãªãã®ã¯å½ç¶ã§ãããããµã¼ãã¼ãªã½ã¼ã¹ã«éè² è·ãããããã¦ããµã¼ãã¼ãè½ã¡ãããã¹ãã¬ã¼ã¸ãå£ãããã§å¤§é害ã«ãªãã¨ãã話ãå¾ã絶ããªãã£ããåæ£ããéä¸ãè¡ã£ãçµæã®ãã¬ã¼ããªãã§ããã
åæ£ããéä¸ãéä¸ããåæ£ã¸
åæ£ããéä¸ã¨ããã°ã次ã¯éä¸ããåæ£ã§ãããã¨ããã®ã¯ãã®åéã®ã»ãªãªã¼ã§ãããããã¤ã©ãããå¥æ©ã§ãããã¾ãåæ£åã®èãæ¹ã«ç§»è¡ãã¦ããã®ããªã¨ãã®10å¹´çæããã¿ã¦ããã®ã ããããã§ããããåé ã®è©±ã¨ç¹ãã£ã¦ããã¾ã¾ãã«çãã«è°è«ããã¦ãã Immutable/Disposable Infrastructure ããéä¸ããåæ£ã¸ã®ãã£ããã«ãªã£ã¦ããã®ã§ã¯ãªããã¨æã£ããã¨ããã®ãæ¬ã¨ã³ããªã§è¨ããããã¨ã§ãã£ãããã£ã¨ããã¾ã§è¾¿ãçããã
ãã¡ãããImmutable/Disposable Infrastructure ã¯ãåè¿°ã®ã¨ããã¯ã©ã¦ããããã¤ãã大è¦æ¨¡Webãµã¼ãã¹ãããã¤ãã®ãããªéä¸å´ã®ä¸çã§è°è«ããã¦ããããã®éæ主ç¼ãããã«ããã®ã¯ééããªããä¸æ¹ã§ãHeroku ã Webã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ã¿ããªãã£ãå¼·å¶ãããã¨ã«ãã£ã¦ããããå¯æ¬¡çã«ç¬¬ä¸è ã¨ã®ã¢ããªã±ã¼ã·ã§ã³ã®äº¤æãå¯è½ã«ããã®ã¨åãããã«ãå»æ£å¯è½ãªã¤ã³ãã©ã¹ãã©ã¯ãã£ã追æ±ãã¦ãã£ãçµæãã¾ãã§ãã¹ã¯ããããã¹ãã¼ããã©ã³ã®ã¢ããªã±ã¼ã·ã§ã³ãé å¸ãããã®ããã«ãWebã¢ããªã±ã¼ã·ã§ã³ã第ä¸è ã«é å¸ããã¨ã³ãã¦ã¼ã¶ã¼ã¯ãããèªåã®å¥½ã¿ã®å¥½ããªã¯ã©ã¦ããã©ãããã©ã¼ã ã«ãããã¤ãã¦ä½¿ã・・・ã¨ãããããªä¸çããããå®ç¾ããããããããªããªãã¨ãããã¨ãå¦æ³ããããã¦ããæ¨ä»ã§ãä¾ãã°ãã®ã¾ã¾è²ããªã¯ã©ã¦ããããã¤ãã Dokcer ããµãã¼ããã¦ãã£ãã・・・ãããããã¨ã¯å®¹æã«æ³åã§ããã®ã§ããã¾ãã
・・・ã©ãããã140æåã§æ¸ããã¨ãã¦æ¸ãå§ããã 5,000 æåã«ãªã£ã¦ããããã§ãã