ããã«ã¡ã¯ã
æ ªå¼ä¼ç¤¾ã©ã¯ã¹ã§å
è¡æè¡æ¤è¨¼ããããããã¸ãã¹é¨éåãã«æè¡æ
å ±ãæä¾ããåãçµã¿ãè¡ã£ã¦ãããæè¡æ¨é²èª²ãã¨ããé¨ç½²ã«æå±ãã¦ããé´æ¨ï¼@moomooyaï¼ã§ãã
ã©ã¯ã¹ã®éçºé¨ã§ã¯ããã¾ã§ç¤¾å ã§å©ç¨ãã¦ããªãã£ãæè¡è¦ç´ ãèªç¤¾ã®éçºã«é©åãããæ¤è¨¼ãããã¸ãã¹è¦æ±ã«å¯¾ãã¦è¿ éã«å¿ããããããã«ããªãã ãæè¡æ¨é²ããã¸ã§ã¯ããã¨ããããã¸ã§ã¯ããããã¾ãã
ãã®ããã¸ã§ã¯ãã§ãWEBã¢ããªã±ã¼ã·ã§ã³ã®Dockerã³ã³ãã移è¡ãã«ã¾ã¤ããæ¤è¨¼ãé²ãã¦ããã®ã§ããã®ä¸éå ±åãå ±æããããã¨æãã¾ãã
- æ¬æ¤è¨¼ã§ã®æ³å®ç°å¢
- æ¢åã¢ããªã§ã³ã³ããåã®é害ã«ãªã£ãé¨å
- ã²ã¨ã¾ãç®æãç¶æ
- ããã»ã¹ç¸ä¹ãã®å½±é¿
- ã¾ã¨ã
ç¶ãã®è¨äºãæ¸ãã¾ããã
æ¬æ¤è¨¼ã§ã®æ³å®ç°å¢
- Docker Compose
- k8sãä¸æã«æ¤è¨¼ã§ããããããªã
- GitLab CI
- CIã§ã®åä½ãã²ã¨ã¾ãç®æ¨ã¨ãã¦æ¬çªéç¨ã«å¿ è¦ãªæ¤è¨¼ã¯å¾åã
- 対象ã®ãµã¼ãã¹ã¯20年以ä¸éç¨ãããã¬ã¬ã·ã¼ãªPHPã¢ããª
- LAMPå ¨çæã«éçºãããã¢ããª
æ§æãä¸é¨æç²ããã¨ãããªæãã
WEBãµã¼ãã¼ã«DBãµã¼ãã¼ãç¸ä¹ããã¦ããæ§æã§ã詳ããã¯å¾è¿°ãã¾ããPHPããã°ã©ã ã¨Postfix/Cronã¯å¯çµåãã¦ããç¶æ ã§ãã
CIã«ä¸å¿ è¦ãªé¨åã¯å¾åã
Dockerã³ã³ããåãã¦CIãåãããããã1ãã¨ãæåªå
ã¨ãã¦ãæ¬çªéç¨ã«å¿
è¦ãªè¦ä»¶ãçæ³è«çãªè¨è¨ã¯ç¡çã«è¿½ããªãããã«ãã¾ãã
CIãæ´»çºã«åãããããããã¨ã§ããã®å¾ã®æ¹åé£æ度ãä¸ããã¨æ³å®ãã¦ãã¾ãã
- ãã°åéã®ä»çµã¿
- DBãè¨å®ãã¡ã¤ã«ã®æ°¸ç¶å
- åé·æ§ç¢ºä¿
ä¾ãã°ãä¸è¨ã®ãããªè¦³ç¹ã¯ã¤ãã§ã®ç¯å²ã§ããããªããããç¡çã¯ããªãã
Dockerã³ã³ããåãæåªå
ã
æ¢åã¢ããªã§ã³ã³ããåã®é害ã«ãªã£ãé¨å
OSã³ãã³ããå©ç¨ãã¦ãã
ã¾ãã解決課é¡ã«ä¸ãã£ãã®ããã¡ãã®èª²é¡ã§ããã
PHPããã°ã©ã ãããawk
ãfind
ãªã©ã®OSã³ãã³ããå¼ã³åºãã¦ããé¨åãããã¾ããã
ä»ã§ã¯ã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ããOSã³ãã³ããå©ããã¨ã¯ãã¾ãããªãã¨æãã¾ãããä»ããç´20å¹´åââLAMP2ãæå±ããã¦éããªãé ã§ãââã«ã¯ãOSã¨ã¢ããªã±ã¼ã·ã§ã³ã®åé¢ã¨ãã£ãæ¦å¿µãä»ã»ã©æµ¸éãã¦ããªãã£ãããã«æãã¾ã3ã
å種å¦çãå®è£
ããã«ããã£ã¦ãä»ã»ã©ã©ã¤ãã©ãªã¨ã³ã·ã¹ãã ãå
å®ãã¦ããªãã£ãã¨ãããã¨ããããOSã³ãã³ããæ´»ç¨ãããã¨ã¯å½æã®ç¶æ³ã§ã¯åççã ã£ãã¨æãã¾ãã
ãããããã¬ã¬ã·ã¼ã·ã¹ãã ã¨å¼ã°ããã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ã§ã¯å¤ãæ¡ç¨ããã¦ããã¨æããã¾ãã
ãªããå½è©²ã¢ããªã±ã¼ã·ã§ã³ã¯Linux + Apache + PostgreSQL + PHPã®LAPPæ§æã§ãã
ããããDockerã³ã³ããåãé²ããã«ããã£ã¦ã¯èª²é¡ã¨ãªãã¾ãã
解決çã¨ãã¦ã¯ããã¤ãã®æ¹æ³ãèãããã¾ãã
- OSã³ãã³ãã§è¡ã£ã¦ããå¦çãPHPå®è£ ã«ç½®ãæãã
- ã³ã³ããã¤ã¡ã¼ã¸ã«OSã³ãã³ããã¤ã³ã¹ãã¼ã«
- ãã¹ãã®OSã³ãã³ããå¼ã³åºã権éãä»ä¸
çæ³ã¨ãã¦ã¯1ã®æ¹æ³ãªã®ã§ãããå©ç¨ãã¦ããOSã³ãã³ãã®ç¨®é¡ã20以ä¸ãå©ç¨ç®æã100ãè¶
ããé¨åã§å©ç¨ãã¦ãã¾ãã
æ¹ä¿®ã³ã¹ããæããã¨ããã§ãµã¼ãã¹ã®é¡§å®¢æä¾ä¾¡å¤ã¯å¤ããã¾ããã
ã¨ãªãã¨ããã¸ãã¹çã«ã¯ã´ã¼ãµã¤ã³ã¯åºããªãã§ãããã
3ã®æ¹æ³ã¯ãããããããªãã¨ãã§ããã¨æã£ã¦ãããªãã£ãã®ã§ããã社å
ã§ä¸éçºè¡¨ãè¡ã£ãéã«ãããªäºãã§ããã¨æãã¦ãããã¾ããã
ãã ãããã®æ¹æ³ã¯ã»ãã¥ãªãã£é¢ããããã¨ãªãã4ãã³ã³ããåãã¦å¾ãããã¯ãã®ãã¼ã¿ããªãã£ãDockerã³ã³ããå®è¡ç°å¢ã®ãã¹ãOSã«ã¤ã³ã¹ãã¼ã«ããã¦ããã³ãã³ãã«ãã£ã¦ããªãããããã¦ãã¾ãã®ã§é¿ãããã§ãã
ã¨ãªãã¨ãç¾å®çãªæ¡ã¨ãã¦ã¯2ã®æ¹æ³ã«ãªããã¨æãã¾ãã
ãDockerã³ã³ããã§ã®å®è¡ã¯ä½è¨ãªã³ãã³ãããªãåã»ãã¥ã¢ã«ãªããã¨ããã¡ãªãããèãã¯ãããã®ã®ãç¾è¡ã®ä½è¨ãªOSã³ãã³ãã¾ã§æã£ã¦ããç¶æ
ã«æ¯ã¹ãã°ãå©ç¨ããOSã³ãã³ãããåå¨ããªãåã ãã»ãã¥ã¢ã«ãªãã¾ããã対å¿ããã³ã¹ããDockerfileå
ã§ã³ãã³ãã¤ã³ã¹ãã¼ã«å½ä»¤ã1è¡è¿½å ããã ãã§ãã
ã³ã³ããã¤ã¡ã¼ã¸ã®ãµã¤ãºãè¥å¹²å¢ãããã¡ãªãããããã¾ãããå
¨ä½ã§è¦ãã°å¾®ã
ãããã¡ãªããã ã¨æãã¾ãã
æçµçã«ã¯OSã³ãã³ãã¸ã®ä¾åã¯ãªããããã§ãããDockerã³ã³ããåãã¦ãã¹ã¿ããªãã£ãä¸ãã¦ããã®ã»ããä¾åã®è§£æ¶ãããããããã§ãã
Dockerã³ã³ããåãåªå
ããã®ã§ããã°ã2ã®æ¹æ³ãæè¯ã ã¨æãã¾ãã
ããã«ã¦ã§ã¢ã¨ã®å¯çµå
次ã®èª²é¡ã¯ãã¡ãã§ãã
ãã®èª²é¡ã¯ã詳ããè¦ãã¨2ã¤ã«åãããã¨ãã§ãã¦
- PHPããã°ã©ã ããè¨å®ãã¡ã¤ã«ãæ¸ãæãã¦ããã«ã¦ã§ã¢ããªãã¼ããã¦ãã
- ããã«ã¦ã§ã¢ã®åä½ãããªã¬ã¼ã«PHPããã°ã©ã ãå®è¡ããã¦ãã
ã®2ã¤ã¨ãªãã¾ãã
ç´ ç´ã«ã³ã³ããè¨è¨ããã¦ããã¨ããã«ã¦ã§ã¢ã¯PHPã³ã³ããã¨ã¯å¥ã³ã³ããã«ãªãã¨æãã¾ãããä¸è¨ã®å¦çãå«ã¾ãã¦ããå ´åã«ç´ ç´ã«åãããã¨ãã§ãã¾ããã
ã¾ã1ã¤ç®ã®èª²é¡ã«ã¤ãã¦ã¯ãçéãªè¨è¨ã¨ãã¦
- è¨å®ãã¡ã¤ã«ãDockerã³ã³ããå¤ã«åºãã¦æ°¸ç¶å
- æ°¸ç¶åãããè¨å®ãã¡ã¤ã«ãæ´æ°
- Dockerã³ã³ãããåèµ·å
ãããã¾ãã
ããããã®è¨è¨ã§ãã¨â¦
- è¨å®ãã¡ã¤ã«ãæ°¸ç¶åããã¹ãã¬ã¼ã¸ãã©ãããï¼
- ãªãã¼ãããå ´åã¨åèµ·åããå ´åã§ããã«ã¦ã§ã¢ã«ã¢ã¯ã»ã¹ã§ããªãã¿ã¤ãã³ã°ãå¢ããï¼
ã¨èª²é¡ãå¢ãã¾ãã
2ã¤ç®ã®èª²é¡ã«ã¤ãã¦ã¯ããã«ã¦ã§ã¢ã«ããããªã¬ã¼ãHTTPãªã¯ã¨ã¹ããªã©ã«å¤æãã¦æããä»çµã¿ã¨ããªã¯ã¨ã¹ããåãä»ãã¦PHPããã°ã©ã ãèµ·åããä»çµã¿ãä½ãã°å¯¾å¿ã§ãããã§ãã
ããããä¾ã«ãã£ã¦è©²å½ç®æãè¤æ°ãããã¨ããã®æ¹ä¿®ãè¡ã£ã¦ã顧客æä¾ä¾¡å¤ãå¤ãããªããã¨ããåæã§ã¯åãã«ãã対å¿ã§ãã
ãã®èª²é¡ã«ã¤ãã¦ã¯ãã¾ã æ¢åå¦çã®ç解ãé²ãã¦ããæä¸ãªã®ã§ã¾ãæ¹éãå¤ããããç¥ãã¾ããããä»åã¯CIã«å©ç¨ã§ããã¨ããã¾ã§æã£ã¦ããã¨ããåæã§ãã
ãã®ãããæåã¯å²ãåã£ã¦PHPã³ã³ããã«ç¸ä¹ãããããã¨æã£ã¦ãã¾ãã
åä¸ã³ã³ããå
ã§ããã°æ¢åã®å¦çéããè¨å®ãã¡ã¤ã«ã®ãªãã¼ããã§ãã¾ãããPHPããã°ã©ã ã®èµ·åãå¯è½ã«ãªãã¾ãã
ãã ãããã®æ¹éã¯CIã§åä½ããããã¨ãåæã¨ãããã®ã«ãªãã¾ãã
æ¬çªéç¨ãè¦éã«å
¥ããã¨è¨å®ãã¡ã¤ã«ãæ°¸ç¶åãããªãã¨ãã£ãåé¡ãããã°ãã¡ã¤ã«åºåã®èª²é¡ãåºã¦ãã¾ãã
ããã§ãDockerã³ã³ããåã«ãã£ã¦CIç°å¢ãç°¡ç¥åãããæ´»çºã«CIãæ´»ç¨ãããã¨ãã§ããããã«ãªãã°åé¡ã¨ãªã£ã¦ããé¨åã®è§£æ±ºãããããããªãã¨èãã¦ãã¾ãã
ã¾ãã¯Dockerã³ã³ããåã
ãªã³ã©ã¤ã³ç³»ã¨ãããç³»ã®å¯çµå
3ã¤ç®ã®èª²é¡ã¯ãå è¿°ã®ããã«ã¦ã§ã¢ã®ä»¶ã¨ä¼¼ã¦ããã®ã§ããããªã³ã©ã¤ã³ç³»ã¨ãããç³»ã1ã¤ã®ã³ã¼ããã¼ã¹ã«ãªã£ã¦ãããã¨ã§ãã
æ¢åã®ä»çµã¿ã§ã¯CronããPHPããã°ã©ã ãå¼ã³åºããã¨ã§å®è¡å¶å¾¡ãè¡ã£ã¦ãã¾ãã
ããèªä½ã¯åé¡ãªãã®ã§ãããã³ã³ããã¢ã¼ããã¯ãã£ã«ããããããå®è¡å¶å¾¡ã¨ããã¨ä»¥ä¸ã®ãããªãã®ãçéãã¨æãã¾ãã
- ãããå¦çãå®è¡ãããããã³ã³ããã®å¤ã«ã¹ã±ã¸ã¥ã¼ã©ã¼ãç¨æ
- ã¹ã±ã¸ã¥ã¼ã©ã¼ããããå¦çãå®è¡ãããããã³ã³ãããèµ·å
- ãããã³ã³ããã¯å¦çãçµãã£ããåæ¢
ä»åã¯CIã§ã®å©ç¨ãã¿ã¼ã²ããã«å®ãã¦ããã®ã§ãã¹ã±ã¸ã¥ã¼ã©ã¼ã«ããå®è¡å¶å¾¡ã¯å¿
è¦ããã¾ããã
ãã®ããã課é¡ã¨ãã¦è¦ãã¦ãããã®ã®é¡ç¾ãã¦ããããã§ã¯ãªãã®ã§ããã¾ãåé¡ã«ãªããªãã®ã§å¤é¨ã¹ã±ã¸ã¥ã¼ã©ã¼ã®æºåããå¤é¨ã¹ã±ã¸ã¥ã¼ã©ã¼ããã®èµ·åãåãä»ããä»çµã¿ã®å°å
¥ã¯è¦éã£ã¦ãã¾ãã
大éæã«å¯¾å¿ããã®ã§ããã°ãããç³»ã®ã³ã¼ããåé¢ã§ãã¦ããªã以ä¸ããªã³ã©ã¤ã³ç³»ãå«ããã³ã¼ããã¼ã¹ãæã¤ãããç¨ã³ã³ããã¤ã¡ã¼ã¸ãç¨æãã¦ãã³ã³ããèµ·åæã®å¼æ°ã§å®è¡ããããã°ã©ã ãé¸æãããããªä»çµã¿ãä¸çªæ¥½ã§ããããã
ãªã³ã©ã¤ã³ç³»ãæ··å¨ãã¦ãããããã½ã¼ã¹ã³ã¼ãã®ä¿®æ£ãå
¥ã£ãã¨ãã«ã¯ãããç¨ã³ã³ããã¤ã¡ã¼ã¸ãæ´æ°ããªããã°ãªããªãã®ãæéã§ã¯ããã¾ããâ¦ã
ãããç³»ã®åé¢ããªã³ã©ã¤ã³ç³»ã¨å ±æãã¦ããã½ã¼ã¹ã³ã¼ãã®æ±ããã©ãããããªã©ãã³ã¼ã管çä¸ã®èª²é¡ã«æ³¢åãã¦ãã¾ãã®ã§ä»åã¯Dockerã³ã³ããåãæåªå ã¨ãã¦å¾åãã«ãã¦ãã¾ãã
ã²ã¨ã¾ãç®æãç¶æ
ããã¾ã§è§¦ãã課é¡ãèæ
®ããçµæãã¾ãç®æãç¶æ
ãä¸è¨ã®ç¶æ
ã¨è¨å®ãã¾ããã
è¦ã¦ã®éããã»ã¨ãã©ãã®ã¾ã¾ã³ã³ããåãã¾ãã
PostgreSQLã³ã³ããé¨åã«ã¤ãã¦ã¯æ¬çªéç¨æã¯ã³ã³ããã§ã¯ãªãVMã ã£ããããã¢ã¡ã¿ã«ã ã£ããã¨ããé¸æè¢ãããã¨æãã¾ãããCIã§å©ç¨ããåã«ã¯ãã¼ã¿ãæ°¸ç¶åããã«æ¯åãªã»ãããããæ¹ãé½åãè¯ãã§ãã
ãã ããããã»ã¹ãç¸ä¹ãããã®ã¯Dockerã³ã³ããã®ä½æ³ããå¤ãããã¨ã¯ééããªãã®ã§ãï¼ä»åã¯ãã¾ã大ããªåé¡ã§ã¯ãªãã§ããï¼å¾è¿°ã®ããã«å¥ã®èª²é¡ãçã¾ãã¦ãã¾ãã
ããã»ã¹ç¸ä¹ãã®å½±é¿
ä»ã«ã課é¡ã¨ãªãå½±é¿ãããããç¥ãã¾ããããããã»ã¹ã®ç¸ä¹ãã«ãã£ã¦çºçãã4ã¤ç®ã®èª²é¡ã¨èªèãã¦ããã®ã¯ãã°åºåã«ã¤ãã¦ã§ãã
ãã°ãè¤æ°åºåããã
stdout, stderrã®2種é¡ã§å¯¾å¿ã§ããªããã°åºåãè¡ãããã
php.log, cron, maillogã®æ±ããèããªãã¨ãããªãã
æ¬çªã§æ±ãã¨ããã
- Dockerã³ã³ããå ã§ãã°ã¨ã¼ã¸ã§ã³ããæã¤
- ãã¹ã¦stdout/stderrã«ã©ãã«ä»ãã§åºåãã¦Dockerã³ã³ããå¤ã§åé¢ãã
ã®2æãã¨æãã¾ãã
CIã§ä½¿ããã°ããï¼ï¼ã¨ã©ã¼æ¤ç¥ãããã人åã§ç¢ºèªã§ããã°ããï¼ã®ã§
ãï¼. ãã¹ãããã¦ã³ããã¦ãã°ãã¡ã¤ã«åºåã
ã§å¯¾å¿ãã¾ãã
åé·åã¨ãèãåºãã¨åé¡ãåºã¦ãããã§ãããä»åã¯å¾åãã«ãã¾ãã
ã¾ã¨ã
- OSã³ãã³ãã®å©ç¨ãæé¤ãã
- ããã«ã¦ã§ã¢ã®è¨å®ãã¡ã¤ã«ãã¢ããªã±ã¼ã·ã§ã³ããæ´æ°ããªã
- ã©ããã¦ãå¿ è¦ãªãè¨å®ç®¡çããã¼ã¸ã£ã¼ã¨ãªããµã¼ãã¹ãç«ã¦ã¦æä½éã®ç¬ç«æ§ãä¿ã¤
- ããã¦ãããå¦çã ãã§ãççµåã«ãã
- ã§ããã°ãåä½ã®ã¢ããªã±ã¼ã·ã§ã³ã¨ãã¦å®è¡å¯è½ã«ã§ããã¨çæ³ç
ä»ããè¨è¨ãéçºããå ´åã«ã¯æåããDockerã³ã³ããã§åä½ãããã±ã¼ã¹ãå¤ãã¨æãã®ã§èªç¶ã¨åé¿ã§ããé¨åãå¤ãã¨æãã¾ãããLAMPç°å¢å ¨çæã®ã¬ã¬ã·ã¼ã·ã¹ãã ãªã¢ããªã±ã¼ã·ã§ã³ããªã¢ã¼ããã¯ãããå ´åã®åèã«ã¯ãªããã¨æãã¾ãã
ãããã®æ¹éããã¨ã«ä¸åæã«æ¤è¨¼ãé²ãã¦ãå®éã«ãã£ã¦ã¿ã¦ã©ãã ã£ããå ±åã§ããã°ã¨æãã¾ãã
ã¨ã³ã¸ãã¢ä¸éæ¡ç¨ãµã¤ã
ã©ã¯ã¹ã§ã¯ãã¨ã³ã¸ãã¢ã»ãã¶ã¤ãã¼ã®ä¸éæ¡ç¨ãç©æ¥µçã«è¡ã£ã¦ããã¾ãï¼
ãèå³ããã¾ãããæ¯éã確èªããé¡ããã¾ãã
https://career-recruit.rakus.co.jp/career_engineer/
ã«ã¸ã¥ã¢ã«é¢è«ãç³è¾¼ã¿ãã©ã¼ã
ã©ã®è·ç¨®ã«å¿åããã°è¯ããããããªãã¨ããæ¹ã¯ãã«ã¸ã¥ã¢ã«é¢è«ãéæè¡ã£ã¦ããã¾ãã
以ä¸ãã©ã¼ã ãããç³è¾¼ã¿ãã ããã
rakus.hubspotpagebuilder.com
ã©ã¯ã¹Developersç»é²ãã©ã¼ã
https://career-recruit.rakus.co.jp/career_engineer/form_rakusdev/
ã¤ãã³ãæ
å ±
ä¼ç¤¾ã®é°å²æ°ãç¥ãããæ¹ã¯ãæ¯é±éå¬ãã¦ããã¤ãã³ãã«ãåå ãã ããï¼
âTECH PLAY
techplay.jp
âconnpass
rakus.connpass.com
- ç¾ç¶ã§ãCIã¯åãã¦ããããCIå®è¡ãããã¼ã¸ã§ã³ãåãæ¿ãããã³ã«CIç¨DBã®ãã¤ã°ã¬ã¼ã·ã§ã³ãå¿ è¦ã«ãªããªã©ä¸ä¾¿ãªç¶æ³ã«ãªã£ã¦ããã↩
- Linux + Apache + MySQL + PHP/Perl/Pythonã¨ããæ§æã↩
- æ¯åããæªãã®ã¯20å¹´ãåã¨ãªãã¨ç§ãå¦çã ã£ãé ã§ã趣å³ã§ã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãæ¸ãã¦ãããã®ã®ãããã¯ã·ã§ã³ã¬ãã«ã§æºãã£ã¦ããããã§ã¯ãªãã®ã§ã¡ãã£ã¨èªä¿¡ããªãããã§ãã↩
- ç¾ç¶ãOSä¸ã§ç´æ¥åä½ãã¦ããç¶æ³ãªã®ã§ãããã«æ¯ã¹ãã¨ã»ãã¥ãªãã£ãªã¹ã¯ãé«ãããã§ã¯ãªãã¨ã¯æãã¾ãã↩