éçºè ãèªåã®åé¡ã®è§£æ±ºçããã°ããæå ¥ãããããæ¬çªç°å¢ã«ç¢ºå®ã«æäŸã§ããããã«ããã«ã¯ã©ãããã°ããã§ããïŒã¢ããªã±ãŒã·ã§ã³ã®ãããã€ã¯ç°¡åã§ããæ¬æ Œçãªè£œåã«ããŠã12ã®ããŒã ã100ã®ã€ã³ã¹ã¿ã³ã¹ã§äœ¿çšã§ããããã«ããããšã¯ããå°é£ã§ãããããŠãæ°ãã©ãã€ãã®ãã¹ã¿ãŒã·ã¹ãã ã«ã€ããŠè©±ããŠãããšãäžå®ã®ã¬ãã«ãäžãããæãæ±ããããããŒã¹ãç¶ãç®ã§ç Žè£ããŸãïŒå€åïŒã
ããŠã³ã¿ã€ã ããµãŒãã¹æåŠãªãã§å±éããæ¹æ³ãå ±æããããšæããŸãã Jenkinsãã€ãã©ã€ã³ã仲ä»è ãªãã60åã§æ¬çªç°å¢ã«500ã€ã³ã¹ã¿ã³ã¹ãããã¯ãã¹ãŠãªãŒãã³ãœãŒã¹ã§ãã詳ããã¯ç«ã®äžã§ãèªãããŸãã
ç§ã®ååã¯RomanProskinã§ããMail.ruGroupã§TarantoolãããŒã¹ã«ããé«è² è·ã·ã¹ãã ãäœæããŠãµããŒãããŠããŸããç§ãã¡ã®ããŒã ãTarantoolã¢ããªã±ãŒã·ã§ã³ã®ãããã€ã¡ã³ããã©ã®ããã«æ§ç¯ãããã説æããŸããããã«ãããããŠã³ã¿ã€ã ããµãŒãã¹æåŠãªãã«æ¬çªç°å¢ã§ã³ãŒããæŽæ°ãããŸãããã®éçšã§ééããåé¡ãšãæçµçã«ã©ã®ãããªè§£æ±ºçãéžãã ãã«ã€ããŠèª¬æããŸããç§ãã¡ã®çµéšããããã€ã¡ã³ãã®æ§ç¯ã«åœ¹ç«ã€ããš ãé¡ã£ ãŠããŸãã
ã¢ããªã±ãŒã·ã§ã³ã®ãããã€ã¯ç°¡åã§ãã Tarantoolã«ã¯ã«ãŒããªããžCLI ãŠãŒãã£ãªãã£ïŒ githubïŒãããã«ãããã¯ã©ã¹ã¿ãŒåãããã¢ããªã±ãŒã·ã§ã³ã¯æ°åã§Dockerã®ã©ããã«ãããã€ãããŸãããœãªã¥ãŒã·ã§ã³ãã²ããŸãããŠæ¬æ Œçãªè£œåã«å€ããããšã¯ã¯ããã«å°é£ã§ããäœçŸãã®ã€ã³ã¹ã¿ã³ã¹ãç°¡åã«åŠçã§ããã¯ãã§ããåæã«ããã¬ãŒãã³ã°ã®ã¬ãã«ãç°ãªãæ°åã®ããŒã ã§éèŠãããå¿ èŠããããŸãã
å±éã®èåŸã«ããèãæ¹ã¯éåžžã«åçŽã§ãã
- ããªãã¯2ã€ã®éã®ãµãŒããŒãåããŸãã
- ããããã§1ã€ã®ã€ã³ã¹ã¿ã³ã¹ãèµ·åããŸãã
- ãããã1ã»ããã®ã¬ããªã«ã«çµåããŸãã
- 1ã€ãã€æŽæ°ããŸãã
ããããæ°ãã©ãã€ãã®ããŒã¿ãå«ããã¹ã¿ãŒã·ã¹ãã ã«ãªããšãäžå®ã®ã¬ãã«ãäžãããæãæ±ããããããŒã¹ãç¶ãç®ã§ç Žè£ããŸãïŒå€åïŒã
åææ¡ä»¶ã®èšå®
ã·ã¹ãã ã«ã¯å³æ ŒãªSLAããããŸããèšç»ãããäœæ¥ãèæ ®ããŠã99ïŒ ã®å¯çšæ§ã確ä¿ããå¿ èŠããããŸããããã¯ãåãåããã«å¿çããªãäœè£ããã幎éåèš87æéãããããšãæå³ã ãŸãã 87æéãšããã®ã¯å€§å€ããã§ã ãâŠ
ãããžã§ã¯ãã¯çŽ1.8TBã®ããŒã¿éãæ³å®ããŠèšèšãããŠããŸããåèµ·åã ãã§40åããããŸãïŒå€æŽãæåã§è¡ãããå ŽåãæŽæ°èªäœã¯äžããããã«è¿œå ãããŸããç§ãã¡ã¯é±ã«3åã®æŽæ°ãè¡ãïŒ40 * 3 * 60åã®52 =åèš 104æéã- SLAã«éåããŠããŸãããããŠããããã¯ç¢ºå®ã«çºçããäºæ ãèæ ®ããã«èšç»ãããäœæ¥ã«ãã ãŸããã
ãã®ã¢ããªã±ãŒã·ã§ã³ã¯ãé«ããŠãŒã¶ãŒè² è·ã®ããã«éçºãããŸãããã€ãŸããå®å®æ§ã®èŠä»¶ãæºããå¿ èŠããããŸãããããŒãã«é害ãçºçããå Žåã«ããŒã¿ã倱ãããªãããã«ããããã«ãã¯ã©ã¹ã¿ãŒãå°ççã«2ã€ã®ããŒã¿ã»ã³ã¿ãŒã«åå²ããããšã«ããŸãããããã§ãSLAã«éåããªãå±éã¡ã«ããºã ã決å®ããŸãããã€ã³ã¹ã¿ã³ã¹ãããã«æŽæ°ããã®ã§ã¯ãªããããŒã¿ã»ã³ã¿ãŒå šäœã§ãããã§æŽæ°ããŸãã
è² è·ã2çªç®ã®ããŒã¿ã»ã³ã¿ãŒã«è»¢éãããšãæŽæ°å šäœãéããŠã¯ã©ã¹ã¿ãŒãèšé²ã§ããããã«ãªããŸããããã¯å€å žçãªã·ã§ã«ããŒå±éã§ãããæšæºçãªãã£ã¶ã¹ã¿ãªã«ããªãã©ã¯ãã£ã¹ã®1ã€ã§ã ã
ããŒã¿ã»ã³ã¿ãŒéã§æŽæ°ããæ©èœã¯ãããŠã³ã¿ã€ã ãŒãã®å±éã®éèŠãªèŠçŽ ã®1ã€ã§ãããã®ããã»ã¹ã«ã€ããŠã¯ãèšäºã®æåŸã§è©³ãã説æããŸãããããã§ã¯ãé人éçãªå±éã®ç¹åŸŽãšçºçããåé¡ã«ã€ããŠè©³ãã説æããŸãã
åé¡
éè·¯ã暪åã£ãŠãã©ãã£ãã¯ã転éããŸã
ããã€ãã®ããŒã¿ã»ã³ã¿ãŒãããããªã¯ãšã¹ãã¯ãããã®ããããã«éä¿¡ã§ããŸããããŒã¿ãååŸããããã«è¿ãã®ããŒã¿ã»ã³ã¿ãŒã«ã¢ã¯ã»ã¹ãããšãå¿çæéã1ã100ããªç§é·ããªããŸããã¯ãã¹ãã©ãã£ãã¯ãåé¿ããããã«ãããŒã¿ã»ã³ã¿ãŒã«ã¢ã¯ãã£ãã¿ã°ãš ã¹ã¿ã³ãã€ã¿ã°ãä»ããŸãã ããã©ã³ãµãŒïŒnginxïŒã¯ããã©ãã£ãã¯ãåžžã«ã¢ã¯ãã£ããªããŒã¿ã»ã³ã¿ãŒã«æµããããã«æ§æãããŠããŸãã Tarantoolãã¯ã©ãã·ã¥ããããã¢ã¯ãã£ããªããŒã¿ã»ã³ã¿ãŒã§äœ¿çšã§ããªããªã£ãå ŽåãTarantoolã¯èªåçã«äºçŽã«åãæ¿ãããŸãã
ãã¹ãŠã®ãŠãŒã¶ãŒèŠæ±ã¯éèŠã§ãããããæ¥ç¶ãç¶æãããããã«ããæ¹æ³ãå¿ èŠã§ãããã®ããã«ãããŒã¿ã»ã³ã¿ãŒéã§ãã©ãã£ãã¯ãåãæ¿ããå¥ã®ansibleãã¬ã€ããã¯ãäœæããŸãããåãæ¿ãã¯
backup
ã説æã®ãã£ã¬ã¯ãã£ãã䜿çšããŠå®è£ ãã ãŸã
upstream
ãµãŒããŒçšãã¢ããã¹ããªãŒã ã¯å¶éã«ãã£ãŠéžæãããå¶éã«ãã£ãŠã¢ã¯ãã£ãã«ãªããŸããæ®ãã¯èŠå®ãããŠã
backup
ãŸãïŒnginxã¯ãã¢ã¯ãã£ããªãã®ããã¹ãŠå©çšã§ããªãå Žåã«ã®ã¿ããããã®ãã©ãã£ãã¯ãèš±å¯ããŸã ãæ§æãå€æŽããå ŽåãéããŠããæ¥ç¶ã¯éããããã æ°ããèŠæ±ã¯åèµ·åã®å¯Ÿè±¡ãšãªããªãã«ãŒã¿ãŒã«éä¿¡ãããŸãã
ã€ã³ãã©ã¹ãã©ã¯ãã£ã«å€éšããŒããã©ã³ãµãŒããªãå Žåã¯ã©ãããã°ããã§ããïŒ Tarantoolã€ã³ã¹ã¿ã³ã¹ã®å¯çšæ§ãç£èŠããç¬èªã®ãããã©ã³ãµãŒãJavaã§äœæããŸãããã ãããã®åå¥ã®ãµãã·ã¹ãã ã«ã¯ãç¬èªã®å±éãå¿ èŠã§ãããã1ã€ã®ãªãã·ã§ã³ã¯ãã«ãŒã¿ãŒå ã«ã¹ã€ããã³ã°ã¡ã«ããºã ãæ§ç¯ããããšã§ãã 1ã€å€æŽã¯ãããŸãããHTTPãã©ãã£ãã¯ãå¶åŸ¡ããå¿ èŠããããŸãã
nginxã§æŽçããŸããããåé¡ã¯ããã ãã§ã¯ãããŸããã§ãããã¬ããªã«ã»ããå ã®ãã¹ã¿ãŒã«å¯ŸããŠãåãæ¿ããè¡ãå¿ èŠããããŸããåè¿°ããããã«ãäžèŠãªãããã¯ãŒã¯ããªãããåé¿ããããã«ãããŒã¿ã¯ã«ãŒã¿ãŒã®è¿ãã«ä¿æãã å¿ èŠããããŸããããã«ãçŸåšã®ãã¹ã¿ãŒïŒã€ãŸããæžã蟌ã¿ã¢ã¯ã»ã¹æš©ãæã€ã¹ãã¬ãŒãžã€ã³ã¹ã¿ã³ã¹ïŒãã¯ã©ãã·ã¥ããå Žåããã§ã€ã«ãªãŒããŒã¡ã«ããºã ã¯ããã«ã¯æ©èœããŸãããã¯ã©ã¹ã¿ãŒã¯ã€ã³ã¹ã¿ã³ã¹ã䜿çšã§ããªãããšã«ã€ããŠäžè¬çãªæ±ºå®ãäžããŸããã圱é¿ãåããããŒã¿ã«å¯Ÿãããã¹ãŠã®èŠæ±ã¯ãšã©ãŒã«ãªããŸãããã®åé¡ã解決ããã«ã¯ãã¯ã©ã¹ã¿ãŒAPIã«å¯ŸããŠGraphQLã¯ãšãªã䜿çšãããã¬ã€ããã¯ãã³ã³ãã€ã«ããå¿ èŠããããŸããã
ãŠã£ã¶ãŒããå€æŽãããŠãŒã¶ãŒãã©ãã£ãã¯ãåãæ¿ããã¡ã«ããºã ã¯ãããŠã³ã¿ã€ã ã®ãªãå±éã®æåŸã®éèŠãªèŠçŽ ã§ããå¶åŸ¡ãããããŒããã©ã³ãµãŒã¯ãæ¥ç¶ã®åªå€±ããŠãŒã¶ãŒãªã¯ãšã¹ãã®åŠçã«ããããšã©ãŒãããã³ãã¹ã¿ãŒã®å€æŽïŒããŒã¿ã¢ã¯ã»ã¹ã®ãšã©ãŒïŒãåé¿ããŸãããããã®3ã€ã®æ±ã®è©ã®æŽæ°ãšãšãã«ããã©ãŒã«ããã¬ã©ã³ããªå±éãåŸãããããã«èªååãããŸããã
ã¬ã¬ã·ãŒãšã®æŠã
ã客æ§ã¯ãã§ã«æ¢æã®ããŒã«ã¢ãŠãã¡ã«ããºã ãæã£ãŠããŸãããã€ã³ã¹ã¿ã³ã¹ã段éçã«å±éããã³æ§æããããŒã«ã§ãã次ã«ãéæ³ã® ansible-cartridgeïŒ githubïŒããã¯ãã¹ãŠã®åé¡ã解決ããŸããansible-cartridgeèªäœãã¢ããªã¹ã§ããããšã ããèæ ®ããŠããŸããã§ããã1ã€ã®å€§ããªåœ¹å²ã§ããããã®ããŸããŸãªæ®µéãã©ãã«ãšåå¥ã®ã¿ã¹ã¯ã§åºåãããŠããŸãããããæ倧éã«æŽ»çšããã«ã¯ãã¢ãŒãã£ãã¡ã¯ãã®é ä¿¡ããã»ã¹ã®å€æŽãã¿ãŒã²ãããã·ã³ã®ãã£ã¬ã¯ããªæ§é ã®å€æŽããªãŒã±ã¹ãã¬ãŒã¿ãŒã®å€æŽãªã©ãå¿ èŠã§ãããç§ã¯ãansible-cartridgeã䜿çšããŠãããã€ã¡ã³ããæ¹è¯ããã®ã«1ãæãè²»ãããŸãããã¢ããªã·ãã¯ãªåœ¹å²ã¯ãå®æãããã¬ã€ããã¯ã«é©åããŸããã§ããããã®åœ¢ã§ã¯ããŸããããŸããã§ããããããŠç§ã¯ååããã®ãã ã®è³ªåã«æ¢ããããŸããïŒãç§ãã¡ã¯ãããå¿ èŠã§ããïŒã
ç§ãã¡ã¯ãããããŸããã§ãã-ã¯ã©ã¹ã¿ãŒæ§æãåäžã®éšåããåé¢ããŸããã
- ã¹ãã¬ãŒãžã€ã³ã¹ã¿ã³ã¹ãã¬ããªã«ã»ããã«çµåããã
- ããŒãã¹ãã©ããvshardïŒã¯ã©ã¹ã¿ãŒããŒã¿ã·ã£ãŒãã£ã³ã°ã¡ã«ããºã ïŒ;
- ãã§ã€ã«ãªãŒããŒã®èšå®ïŒè»¢åããå Žåã®ãã¹ã¿ãŒã®èªååãæ¿ãïŒã
ãããã¯ããã¹ãŠã®ã€ã³ã¹ã¿ã³ã¹ã皌åããŠããå±éã®æçµæ®µéã§ããæ®å¿µãªãããä»ã®ãã¹ãŠã®ã¹ãããã¯ãã®ãŸãŸã«ããŠããå¿ èŠããããŸããã
ãªãŒã±ã¹ãã¬ãŒã¿ãŒã®éžæ
ãµãŒããŒäžã®ã³ãŒãã¯ãå®è¡ã§ããªãå Žåã¯åœ¹ã«ç«ã¡ãŸãããTarantoolã€ã³ã¹ã¿ã³ã¹ãéå§ããã³åæ¢ããããã®ãŠãŒãã£ãªãã£ãå¿ èŠã§ããansible-cartridgeã«ã¯ãsystemctlãµãŒãã¹ãã¡ã€ã«ãäœæããrpmããã±ãŒãžãæäœããããã®ã¿ã¹ã¯ãå«ãŸããŠããŸããããããç§ãã¡ã®ã¿ã¹ã¯ã®ç¹ç°æ§ã¯ã顧客ã®éåè·¯ã®ååšãšsudoç¹æš©ã®æ¬ åŠã§ãããããã¯ãsystemctlã䜿çšã§ããªãã£ãããšãæå³ããŸãã
-ããã«æã ã¯ãæä¹ çãªrootæš©éãå¿ èŠãšããªããªãŒã±ã¹ãã supervisordã..ãæåã«ãã¹ãŠã®ãµãŒããŒã«ã€ã³ã¹ããŒã«ãããœã±ãããã¡ã€ã«ãžã®ã¢ã¯ã»ã¹ã«é¢ããããŒã«ã«ã®åé¡ã解決ããå¿ èŠããããŸãããæ°ããansibleããŒã«ãsupervisordã§æ©èœããããã«èŠããŸãããããã«ã¯ãæ§æãã¡ã€ã«ã®äœæãæ§æã®æŽæ°ãã€ã³ã¹ã¿ã³ã¹ã®éå§ãšåæ¢ã®ã¿ã¹ã¯ãå«ãŸããŠããŸããããã¯ãããæ¬çªç°å¢ã«å ¥ããã®ã«ååã§ããã
å®éšã®ããã«ãansible-cartridgeã§supervisordã䜿çšããŠã¢ããªã±ãŒã·ã§ã³ãå®è¡ããæ©èœãè¿œå ããŸããããã®æ¹æ³ã¯æè»æ§ãäœãããšãå€æããå¥ã®ãã©ã³ãã§ã®å®äºããŸã åŸ ã£ãŠããŸãã
èªã¿èŸŒã¿æéã®ççž®
ã©ã¡ãã®ãªãŒã±ã¹ãã¬ãŒã¿ãŒã䜿çšããŠããã€ã³ã¹ã¿ã³ã¹ãèµ·åãããŸã§1æéåŸ ã€ããšã¯ã§ããŸããããããå€ã¯20åã§ããã€ã³ã¹ã¿ã³ã¹ããã®ãããå€ããé·ã䜿çšã§ããªãå Žåãèªåã¯ã©ãã·ã¥ãããªã¬ãŒãããã¢ã«ãŠã³ãã£ã³ã°ã·ã¹ãã ã«èšé²ãããŸããé »ç¹ãªäºæ ã¯ããŒã ã®äž»èŠãªããã©ãŒãã³ã¹ã«åœ±é¿ãäžããã·ã¹ãã éçºã®èšç»ãæãªãå¯èœæ§ããããŸããæ³çã«å¿ èŠãªå±éã®ããããã¬ãã¢ã ããŸã£ãã倱ããããããŸããããã²ã20å以å ã«ä¿ç®¡ããŠãã ããã
äºå®ïŒããŠã³ããŒãæéã¯ããŒã¿ã®éã«çŽæ¥äŸåããŸãããã°ããRAMã«ã¬ã€ãºããå¿ èŠãããã»ã©ãæŽæ°åŸã®ã€ã³ã¹ã¿ã³ã¹ã®èµ·åæéãé·ããªããŸãããŸããåããã·ã³äžã®ã¹ãã¬ãŒãžã€ã³ã¹ã¿ã³ã¹ããªãœãŒã¹ãããã£ãŠç«¶åããããšãèæ ®ããå¿ èŠããããŸããTarantoolã¯ãã¹ãŠã®ããã»ããµã³ã¢ã䜿çšããŠã€ã³ããã¯ã¹ãäœæããŸãã
ç§ãã¡ã®èŠ³å¯ã«åºã¥ããšã
memtx_memory
ã€ã³ã¹ã¿ã³ã¹ãããã®ãµã€ãº ã¯40GBãè¶ ããŠã¯ãªããŸããããã®å€ã¯ãã€ã³ã¹ã¿ã³ã¹ã®ãªã«ããªã«20åæªæºãããå Žåã«æé©ã§ãã1ã€ã®ãµãŒããŒäžã®ã€ã³ã¹ã¿ã³ã¹ã®æ°ã¯åå¥ã«èšç®ããããããžã§ã¯ãã®ã€ã³ãã©ã¹ãã©ã¯ãã£ãšå¯æ¥ã«é¢é£ããŠããŸãã
ã¢ãã¿ãªã³ã°ãæ¥ç¶ããŸã
ãã¹ãŠã®ã·ã¹ãã ãç£èŠããå¿ èŠããããTarantoolãäŸå€ã§ã¯ãããŸãããç§ãã¡ã®ç£èŠã¯ããã«ã¯çŸããŸããã§ããããããã¯å šäœããå¿ èŠãªã¢ã¯ã»ã¹ã®ååŸãæ¿èªãããã³ç°å¢ã®ã»ããã¢ããã«è²»ããããŸããã
ã¢ããªã±ãŒã·ã§ã³ã®éçºãšãã¬ã€ããã¯ã®äœæã®éçšã§ãã¡ããªãã¯ã¢ãžã¥ãŒã«ïŒ githubïŒãå°ãå€æŽããŸãã ãããã§ãã¡ããªãã¯ããããããé£ãã ã€ã³ã¹ã¿ã³ã¹ã®ååã§åå²ã§ããŸã-äœæãããã°ããŒãã«ã©ãã«ãç£èŠã·ã¹ãã ãšã®çµ±åã®çµæãã¯ã©ã¹ã¿ãŒã¢ããªã±ãŒã·ã§ã³ã®å šäœçãªåœ¹å²ãæããã«ãªã ãŸãããæ°ããã¿ã€ãã®åäœæ°ã¡ããªã㯠ã¯ãã·ã¹ãã ã®èŠä»¶ã®äžè¬åãããçãŸããŸããã
ããã§ãã·ã¹ãã ãžã®çŸåšã®èŠæ±æ°ã䜿çšãããŠããã¡ã¢ãªã®ãµã€ãºãã¬ããªã±ãŒã·ã§ã³ã©ã°ãããã³ãã®ä»ã®å€ãã®äž»èŠãªã¡ããªãã¯ã衚瀺ãããŸããããã«ããã£ããã§ã®éç¥ã䜿çšããŠæ§æãããŸããæãé倧ãªåé¡ã¯ãèªåè»äºæ ã®äžè¬çãªã·ã¹ãã ã«åé¡ãããæé€ããããã®æ確ãªSLAããããŸãã
ããŒã«ã«ã€ããŠå°ããã©ãã§ãäœããã©ã®ããã«å ¥æãããã®è©³çŽ°ãªèª¬æã¯ãetcdã«åéãã ããããããã¬ã°ã©ããšãŒãžã§ã³ã ãæ瀺ãåãåããŸãã JSON圢åŒã®ã¡ããªãã¯ã¯InfluxDBã«ä¿åãã ãŸããGrafanaãããžã¥ã¢ã©ã€ã¶ãŒãšããŠäœ¿çšã ããã³ãã¬ãŒãããã·ã¥ããŒããäœæããŸãã ããããŠæåŸã«ãã¢ã©ãŒã㯠kapacitorã
ãã¡ãããããã¯ç£èŠãå®è£ ããããã®å¯äžã®ãªãã·ã§ã³ã§ã¯ãããŸãããPrometheusã䜿çšã§ã ãã¡ããªãã¯ã¯å¿ èŠãªåœ¢åŒã§å€ãæå®ããæ¹æ³ãç¥ã£ãŠããã ãã§ããã¢ã©ãŒãã®å Žåãããšãã°zabbixãäŸ¿å© ã§ãã
ååã¯ãèšäºãTarantoolã®ç£èŠïŒãã°ãã¡ããªãã¯ãããã³ãããã®åŠçãã§ãTarantoolã®ç£èŠã®èšå®ã«ã€ããŠè©³ããæããŠãããŸãã ã
ãã®ã³ã°ã®èšå®
ç£èŠã«éå®ããããšã¯ã§ããŸãããã·ã¹ãã ã§äœãèµ·ãã£ãŠããããå®å šã«ææ¡ããã«ã¯ããã¹ãŠã®èšºæãåéããå¿ èŠããããŸããããã«ã¯ãã°ãå«ãŸããŸããããã«ããã°ã¬ãã«ãé«ãã»ã©ããããã°æ å ±ãå€ããªãããã°ãã¡ã€ã«ã倧ãããªããŸãã
ãã£ã¹ã¯å®¹éã¯ç¡éã§ã¯ãããŸãããç§ãã¡ã®ã¢ããªã±ãŒã·ã§ã³ã¯ãããŒã¯è² è·æã«1æ¥ãããæ倧1TBã®ãã°ãçæããå¯èœæ§ããããŸãããã®ãããªç¶æ³ã§ã¯ããã£ã¹ã¯ãè¿œå ã§ããŸãããé ããæ©ããã空ã容éãŸãã¯ãããžã§ã¯ãã®äºç®ãäžè¶³ããŸãããããããã¬ãŒã¹ãªãã§ãããã°æ å ±ã倱ãããã¯ãããŸããïŒäœããã¹ããïŒ
å±éã®æ®µéã®1ã€ã§ãlogrotateèšå®ãè¿œå ããŸãã ïŒ100MBã®ãã¡ã€ã«ãããã€ãçã®ãŸãŸã«ããŠãããã«ããã€ãå§çž®ããŸããéåžžã®æäœã§ã¯ãããã§24æé以å ã«ããŒã«ã«ã®åé¡ãèŠã€ããããšãã§ããŸãããã°ã¯ãå³å¯ã«å®çŸ©ããããã£ã¬ã¯ããªã«JSON圢åŒã§ä¿åãããŸãããã¹ãŠã®ãµãŒããŒãfilebeatå®è¡ããŒã¢ã³ ã¢ããªã±ãŒã·ã§ã³ã®ãã°ãåéãã«é·æä¿åã®ããã«ããããéä¿¡ãã ElasticSearchãããã®ã¢ãããŒãã«ããããã£ã¹ã¯ãªãŒããŒãããŒãšã©ãŒãçºçããªããªããé·æçãªåé¡ãçºçããå Žåã«ã·ã¹ãã ããã©ãŒãã³ã¹ãåæã§ããŸãããããŠããã®ã¢ãããŒãã¯å±éã«ããŸãé©åããŸãã
ãœãªã¥ãŒã·ã§ã³ãã¹ã±ãŒãªã³ã°ããŸã
éã¯é·ããŠãšãããããããªãã®éã®éäœããããŸãããééããç¹°ãè¿ããªãããã«ããããã€ã¡ã³ããæšæºåããCI / CDãã³ãã«ïŒGitlab + JenkinsïŒã䜿çšããŸãããã¹ã±ãŒãªã³ã°ãå€ãã®åé¡ãåŒãèµ·ããããœãªã¥ãŒã·ã§ã³ã®ãããã°ã«ã¯1ãæ以äžããããŸãããããããç§ãã¡ã¯å¯ŸåŠããŸããããããŠä»ãç§ãã¡ã¯ããªããšç§ãã¡ã®çµéšãå ±æããæºåãã§ããŠããŸããæé ãèŠãŠãããŸãããã
éçºè ãèªåã®åé¡ã®è§£æ±ºçããã°ããæå ¥ãããããæ¬çªç°å¢ã«ç¢ºå®ã«æäŸã§ããããã«ããã«ã¯ã©ãããã°ããã§ããïŒåœŒãããžã§ã³ãã³ã¹ãã¡ã€ã«ã奪ãïŒå€§èãªå¢çç·ã®èŒªéãæãããããè¶ ãããšå±éãäžå¯èœã«ãªãããšãæå³ããéçºè ã«ãã®éãæ¡å ããå¿ èŠããããŸãã
æ¬æ Œçãªãµã³ãã«ã¢ããªã±ãŒã·ã§ã³ãäœæããŸãããããã¯åãæ¹æ³ã§å±éããã培åºçãªåºçºç¹ã§ããããããç§ãã¡ã¯ããã«é¡§å®¢ãšååããŸãããgitãªããžããªãšJenkinsã¿ã¹ã¯ãèšå®ãããã³ãã¬ãŒããèªåçã«äœæããããã®ãŠãŒãã£ãªãã£ãäœæããŸãããéçºè ã¯ãã¹ãŠã«ã€ããŠãã¹ãŠã«1æéãããããããããžã§ã¯ãã¯æ¬çªç°å¢ã«ãªããŸãã
ãã€ãã©ã€ã³ã¯ãæšæºã®ã³ãŒããã§ãã¯ãšç°å¢èšå®ããå§ãŸããŸããããã«ããã®åŸã®å±éã®ããã«ãããã€ãã®æ©èœãã¹ããŸãŒã³ãšè£œåã«åšåº«ã眮ããŸãã次ã«ããŠããããã¹ããã§ãŒãºãå§ãŸããŸãã
æšæºã®Tarantoolãã¹ããã¬ãŒã ã¯ãŒã¯ luatestïŒ githubïŒããŠããããã¹ããšçµ±åãã¹ãã®äž¡æ¹ãæžã蟌ãããšãã§ããŸããTarantoolCartridgeãå®è¡ããã³æ§æããããã®è£å©ã¢ãžã¥ãŒã«ããããŸã ããŸããæè¿ã®ããŒãžã§ã³ã§ã¯ãã«ãã¬ããžãæå¹ã«ã§ã ãŸããç°¡åãªã³ãã³ãã§éå§ããŸãã
.rocks/bin/luatest --coverage
ãã¹ãã®æåŸã«ãåéãããçµ±èšã¯ãã³ãŒãã®å質ãšå®å šæ§ãè©äŸ¡ããããã®ãœãããŠã§ã¢ã§ããSonarQubeã«éä¿¡ãã ãŸããå éšã§ã¯ãQualityGateããã§ã«æ§æããŠããŸããèšèªïŒLuaãPythonãSQLãªã©ïŒã«é¢ä¿ãªããã¢ããªã±ãŒã·ã§ã³å ã®ãã¹ãŠã®ã³ãŒããæ€èšŒãããŸãããã ããLuaã«ã¯çµã¿èŸŒã¿ã®ãã³ãã©ãŒããªããããã«ãã¬ããžãäžè¬çãªåœ¢åŒã§è¡šãããã«ããã¹ãã®éå§åã«ã€ã³ã¹ããŒã«ããããã©ã°ã€ã³ããããŸãã
tarantoolctl rocks install luacov 0.13.0-1 # coverage
tarantoolctl rocks install luacov-reporters 0.1.0-1 #
åçŽãªã³ã³ãœãŒã«ããŒãžã§ã³ã¯æ¬¡ã®ããã«è¡šç€ºã§ããŸãã
.rocks/bin/luacov -r summary . && cat ./luacov.report.out
SonarQubeã®ã¬ããŒãã¯ã次ã®ã³ãã³ãã«ãã£ãŠçæãããŸãã
.rocks/bin/luacov -r sonar
ã«ãã¬ããžã®åŸããªã³ã¿ãŒã¹ããŒãžãå§ãŸããŸããTarantoolãã©ã°ã€ã³ã®1ã€ã§ãããluacheckïŒ githubïŒã䜿çšããŠã ãŸãã
tarantoolctl rocks install luacheck 0.26.0-1
ãªã³ã¿ãŒã®çµæãSonarQubeã«éä¿¡ãããŸãã
.rocks/bin/luacheck --config .luacheckrc --formatter sonar *.lua
ã³ãŒãã«ãã¬ããžçµ±èšãšãªã³ã¿ãŒã¯äžç·ã«ã«ãŠã³ããããŸããå質ã²ãŒããééããã«ã¯ããã¹ãŠã®æ¡ä»¶ãæºããå¿ èŠããããŸãã
- ãã¹ãã«ããã³ãŒãã«ãã¬ããžã¯å°ãªããšã80ïŒ ã§ãªããã°ãªããŸããã
- å€æŽã«ãã£ãŠæ°ããèããçºçããããšã¯ãããŸããã
- é倧ãªåé¡ã®ç·æ°ã¯0ã§ãã
- éèŠã§ãªãæ ªã®ç·æ°ã¯5æªæºã§ãã
Quality GateãééããåŸãã¢ãŒãã£ãã¡ã¯ãããã€ã¯åŠçããå¿ èŠããããŸããæã ã¯ããã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ãTarantoolã«ãŒããªããžã䜿çšããããšã決ããã®ã§ãæã ã¯ã䜿çšã«ãŒããªããž-CLIïŒ githubã®ãïŒæ§ç¯ãããã ãããã¯ãã¯ã©ã¹ã¿ãŒåãããTarantoolã¢ããªã±ãŒã·ã§ã³ãããŒã«ã«ã§å®è¡ïŒå®éã«ã¯éçºïŒããããã®å°ããªãŠãŒãã£ãªãã£ã§ãã圌女ã¯ãŸããããŒã«ã«ãšDockerã®äž¡æ¹ã§ã¢ããªã±ãŒã·ã§ã³ã³ãŒãã䜿çšããŠDockerã€ã¡ãŒãžãšã¢ãŒã«ã€ããäœæããæ¹æ³ãç¥ã£ãŠããŸãïŒããšãã°ãç°ãªãã¢ãŒããã¯ãã£ã®ã¢ãŒãã£ãã¡ã¯ããæ§ç¯ããå¿ èŠãããå ŽåïŒãã¢ã»ã³ããª
tar.gz
ã¯æ¬¡ã®ã³ãã³ãã§å®è¡ãããŸãã
cartridge pack tgz --name <nme> --version <vrsion>
çµæã®ã¢ãŒã«ã€ãã¯ãArtifactoryã Mail.ru CloudStorageãªã©ã®ä»»æã®ãªããžããªã«ã¢ããããŒããããŸã ã
ããŠã³ã¿ã€ã ãªãã§å±é
ãããŠããã€ãã©ã€ã³ã®æåŸã®ã¹ãããã¯ãããã€ã¡ã³ãèªäœã§ããç·šéã®ç¶æ ã«å¿ããŠãããŒãªã³ã°ã¯ããŸããŸãªãã¹ããŸãŒã³ã§å®è¡ãããŸãããããã¿ã«ã¯1ã€ã®ãŸãŒã³ãå²ãåœãŠãããŸãããªããžããªã«ããã·ã¥ãããã³ã«ããã€ãã©ã€ã³å šäœãèµ·åããŸããããªãã¯ãå€éšã·ã¹ãã ãšã®çžäºäœçšããã¹ãããããšãã§ããããã€ãã®æ©èœé åã¯ããã®ããã«ãããªããäœæããå¿ èŠããããŸã ããŒãžèŠæ±ã§ ãã¹ã¿ãŒã»ãªããžããªã®ãã©ã³ããããã ããæ¬çªç°å¢ã§ã¯ãå€æŽãåãå ¥ããããããŒãžãã¿ã³ãæŒãããåŸã«ã®ã¿ããŒãªã³ã°ãéå§ãããŸãã
ããŠã³ã¿ã€ã ã®ãªãå±éã®éèŠãªèŠçŽ ãæãåºãããŠãã ããã
- ããŒã¿ã»ã³ã¿ãŒã®æŽæ°ã
- ã¬ããªã«ã»ããã®ãã¹ã¿ãŒã®åãæ¿ãã
- ã¢ã¯ãã£ããªããŒã¿ã»ã³ã¿ãŒã®ãã©ã³ãµãŒãèšå®ããŸãã
ã¢ããã°ã¬ãŒããããšãã¯ãããŒãžã§ã³ãšããŒã¿ã¹ããŒãã®äºææ§ãç£èŠããå¿ èŠããããŸããããããã®æé ã§ãšã©ãŒãçºçãããšãæŽæ°ã¯åæ¢ããŸãã
æŽæ°ã¯ã次ã®ããã«æŠç¥çã«è¡šãããšãã§ããŸãã
ããã§ãæŽæ°ã«ã¯ãµãŒããŒã®åèµ·åã䌎ããŸãããã€ãããã€ãç¶è¡ã§ããããç解ããããã«ãã€ã³ã¹ã¿ã³ã¹ã®ç¶æ ãåŸ æ©ããå¥ã®ãã¬ã€ããã¯ããããŸãã Tarantool Cartridgeã«ã¯ã¹ããŒããã·ã³ããããRolesConfiguredç¶æ ãåŸ æ©ããŠããŸã ãããã¯ãã€ã³ã¹ã¿ã³ã¹ãå®å šã«æ§æãããŠããããšãæå³ããŸãïŒãããŠãç§ãã¡ã«ãšã£ãŠã¯ããªã¯ãšã¹ããåãå ¥ããæºåãã§ããŠããŸãïŒãã¢ããªã±ãŒã·ã§ã³ãåããŠãããã€ããå Žåã¯ãæªæ§æã®ç¶æ ãåŸ ã€å¿ èŠããããŸã ã
å šäœãšããŠããã®å³ã¯ãããŠã³ã¿ã€ã ã®ãªãå±éã®æŠèŠã瀺ããŠããŸããããå€ãã®ããŒã¿ã»ã³ã¿ãŒã«ç°¡åã«æ¡åŒµã§ããŸããå¿ èŠã«å¿ããŠããã¹ã¿ãŒãå€æŽããçŽåŸã«ïŒã€ãŸããããŒã¿ã»ã³ã¿ãŒïŒ1ãšäžç·ã«ïŒãã¹ãŠã®ããã¯ã¢ãããã¢ãŒã ããæŽæ°ãããã1ã€ãã€æŽæ°ããããšãã§ããŸãã
ãã¡ãããç§ãã¡ã¯èªåãã¡ã®éçºããªãŒãã³ãœãŒã¹ã«ãããããªãã®ã§ãããããŸã§ã®ãšããããããã¯ç§ã®ansible-cartridgeãã©ãŒã¯ïŒopomuc / ansible-cartridgeïŒã§å©çšã§ããŸããã ãããã¡ã€ã³ãªããžããªã®ãã¹ã¿ãŒãã©ã³ãã«ç§»åããèšç»ããããŸãã
äŸã¯ããã«ãããŸãïŒ exampleïŒãæ£ããæ©èœããã«ã¯ããµãŒããŒã
supervisord
ãŠãŒã¶ãŒçšã«æ§æããå¿ èŠã ãããŸã
tarantool
ãæ§æã³ãã³ã㯠ããã«ãããŸããã¢ããªã±ãŒã·ã§ã³ãå«ãã¢ãŒã«ã€ãã«ã¯ããã€ããªãå«ãŸããŠããå¿ èŠããããŸã
tarantool
ã
ã·ã§ã«ããŒå±éãéå§ããããã®äžé£ã®ã³ãã³ãïŒ
# ( )
ansible-playbook -i hosts.yml playbook.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.0.0-0.tar.gz' \
--extra-vars 'app_version=1.0.0' \
--tags supervisor
# 1.2.0
# dc2
ansible-playbook -i hosts.yml master.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.2.0-0.tar.gz' \
--limit dc2
# â dc1
ansible-playbook -i hosts.yml playbook.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.2.0-0.tar.gz' \
--extra-vars 'app_version=1.2.0' \
--tags supervisor \
--limit dc1
# dc1
ansible-playbook -i hosts.yml master.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.2.0-0.tar.gz' \
--limit dc1
# â dc2
ansible-playbook -i hosts.yml playbook.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.2.0-0.tar.gz' \
--extra-vars 'app_version=1.2.0' \
--tags supervisor \
--limit dc2
# , dc1
ansible-playbook -i hosts.yml master.yml \
-b --become-user tarantool \
--extra-vars 'base_dir=/data/tarantool' \
--extra-vars 'cartridge_package_path=./getting-started-app-1.2.0-0.tar.gz' \
--limit dc1
ãã®ãã©ã¡ãŒã¿
base_dir
ã¯ããããžã§ã¯ãã®ãããŒã ããã£ã¬ã¯ããªãžã®ãã¹ã瀺ããŸã ãããŒã«ã¢ãŠãåŸããµããã£ã¬ã¯ããªãäœæãããŸãã
<base_dir>/run
-å¶åŸ¡ãœã±ããããã³pidãã¡ã€ã«çšã<base_dir>/data
-.snapãã¡ã€ã«ãš.xlogãã¡ã€ã«ãããã³TarantoolCartridgeæ§æã®å Žåã<base_dir>/conf
-ã¢ããªã±ãŒã·ã§ã³èšå®ããã³ç¹å®ã®ã€ã³ã¹ã¿ã³ã¹çšã<base_dir>/releases
-ããŒãžã§ã³ç®¡çãšãœãŒã¹ã³ãŒãçšã<base_dir>/instances
-ã¢ããªã±ãŒã·ã§ã³ã®åã€ã³ã¹ã¿ã³ã¹ã®çŸåšã®ããŒãžã§ã³ãžã®ãªã³ã¯ã
ãã©ã¡ãŒã¿
cartridge_package_path
ã¯ããèªäœãç©èªã£ãŠããŸãããç¹æ®æ§ããããŸãã
- ãã¹ã
http://
ãŸãã¯https://
ã§å§ãŸãå Žåãã¢ãŒãã£ãã¡ã¯ãã¯ãããã¯ãŒã¯ããããªããŒããããŸãïŒããšãã°ããã®é£ã§çºçããã¢ãŒãã£ãã¡ã¯ãããïŒã - ãã以å€ã®å Žåããã¡ã€ã«ã¯ããŒã«ã«ã§æ€çŽ¢ãããŸã
ãã®ãã©ã¡ãŒã¿ãŒ
app_version
ã¯ããã©ã«ããŒå ã®ããŒãžã§ã³ç®¡çã«äœ¿çšãããŸã
<base_dir>/releases
ãããã©ã«ãã¯
latest
ã§ãã
ã¿ã°
supervisor
ã¯ããªãŒã±ã¹ãã¬ãŒã¿ãŒãšããŠäœ¿çšãããããšãæå³ã
supervisord
ãŸãã
å±éãéå§ããããã®å€ãã®ãªãã·ã§ã³ããããŸãããæãä¿¡é Œã§ããã®ã¯å€ãè¯ããã®
Makefile
ã§ããæ¡ä»¶ä»ãã³ãã³ã
make deploy
ã¯ä»»æã®CI \ CDã«å«ããããšãã§ãããã¹ãŠããŸã£ããåãããã«æ©èœããŸãã
çµæ
ããã§å šéšã§ãïŒããã§ãJenkinsã«æ¢è£œã®ãã€ãã©ã€ã³ãã§ãã仲ä»æ¥è ãæé€ãããå€æŽã®é ä¿¡é床ãéåžžèã«ãªããŸããããŠãŒã¶ãŒæ°ã¯å¢å ããŠãããæ¬çªç°å¢ã§ã¯ãåœç€Ÿã®ãœãªã¥ãŒã·ã§ã³ã®ã¿ã䜿çšããŠãã§ã«500ã®ã€ã³ã¹ã¿ã³ã¹ããããã€ãããŠããŸããæé·ããäœå°ããããŸãã
ãŸãããããã€ããã»ã¹èªäœã¯çæ³ããã¯ã»ã©é ããã®ã®ãDevOpsããã»ã¹ãããã«éçºããããã®åŒ·åºãªåºç€ãæäŸããŸããã·ã¹ãã ãæ¬çªç°å¢ã«è¿ éã«æäŸããé »ç¹ã«ç·šéããããšãæããªãããã«ãå®è£ ãå®å šã«è¡ãããšãã§ããŸãã
ãŸããã¢ããªã¹ãæã¡èŸŒãããšã¯äžå¯èœã§ããããã®æ®åãæåŸ ããããšãç§ãã¡ã®æèšã«ãªããŸãããã¬ã€ããã¯ã®å解ãã€ã³ã¹ããŒã«ã®å段éã§ã®åœ¹å²ã®å²ãåœãŠãåšåº«ãæè»ã«æ瀺ããæ¹æ³ãå¿ èŠã§ãããã€ãç§ãã¡ã®éçºã¯ãã¹ã¿ãŒã«å«ãŸãããã¹ãŠãããã«è¯ããªãã§ãããïŒ
ãªã³ã¯
- ansible-cartridgeã®ã¹ããããã€ã¹ãããã¬ã€ãïŒ
- TarantoolCartridgeã«ã€ããŠã¯ãã¡ããã芧ãã ããã
- Kubernetesãžã®ãããã€ã«ã€ããŠïŒ
- Tarantoolã®ç£èŠïŒãã°ãã¡ããªãã¯ãããã³ãããã®åŠçã
- ãã«ããå¿ èŠãªå Žåã¯ãTelegramãã£ããã«ãåãåãããã ããã