æ¬è¨äºã¯ãSRE Advent Calendar 2019ã®20æ¥ç®ã®æ稿ã§ãã@katsuhisa__ ããéããã¾ãã
ä»å¹´ã®6æã«ç»å£ããéã«ãSelf-Serviceã§ç©äºãé²ãããã¨ã®å¤§åãã¨ãSREãSelf-Serviceãæ§ç¯ãããã¨ã«è²¬åã®ä¸ç«¯ãæã¤ãã¨ã«ã¤ãã¦ã話ãã¾ããã
ãclass SRE implements DevOpsãã¨ããè¨èãããã¾ãããç§ã¯SREãDevOpsãå®è£ ããã«ããã£ã¦å¤§åãªãã¨ã®1ã¤ã¯ãéçºè ã«ããSelf-Serviceãæ§ç¯ãããã¨ã ã¨èãã¦ãã¾ãã
Envoyéçºè ã®MattããDevOpsã¨ã¯ãéçºè ã24/365ã§ãµã¼ãã¹ã®éç¨ã«å¯¾ãã責任ãè² ãæ £è¡ã§ãããã¨ãããã¨ã¯æåã§ããç§ããã®è¨èã«å½±é¿ãåããSREãéçºè ã«ããéç¨ãæ¯ãããã¼ã«ãPlatformãéçºãããã¨ã¯ãSREã«ããã責åã®1ã¤ã§ããã¨èãã¦ãã¾ããï¼ãã¡ãããèªåãã¡ãææ¡ããç¯å²ã«ãããOpsæ¥åãå¹çåã»èªååããããã®å®è£ ã大åã§ããï¼
The human scalability of “DevOps” - Matt Klein - Medium
æ¬è¨äºã§ã¯ãããã¾ã§ã®çµé¨ããµã¾ãã¤ã¤ãä½é¨ã®è¯ãSelf-Serviceãæ§ç¯ããããã«å¿ è¦ãª3ã¤ã®å¿æ§ãã«ã¤ãã¦æè¦ãè¿°ã¹ããã¨æãã¾ããããã¡ã§ã¯ãããã£ã¦ããã¼ããããããã¨è¯ãã§ããã¼ãã¨ãã£ãæè¦ãããã°Twitterã§ãæè¦ããã ããã¨å¬ããã§ããã¨ã´ãµãã¾ãã
1. å¦ç¿ã³ã¹ããä½ããªããã工夫ãã
ç§ãåãä¼ç¤¾ã§ã¯ãéçºè
èªèº«ãTerraformã§Infraæ§ç¯ã§ããç°å¢ãæ´ã£ã¦ãã¾ããå
·ä½çã«ã¯ãPull Requestãã¤ããã°ãCIã§ã terraform plan
ã®å®è¡çµæãåããããã«ãªã£ã¦ããããããéçºè
ã«ããPull Requestãã¨ãCODEOWNERSã§ããSREã«ããã¬ãã¥ã¼ï¼ãã¼ã¸ãã®2ã¹ããããè¸ãã°ã誰ã§ãInfraæ§ç¯ãã§ããããã«ãªã£ã¦ãã¾ãã
çããã®åãä¼æ¥ã®ä¸ã§ãéçºè èªèº«ãTerraformã®ã³ã¼ããæ¸ãã¦Pull Requestãéã£ã¦ãããä¼ç¤¾ã¯ã©ããããããã§ãããããã¾ãã¯ããã®å²åã¯ã©ã®ãããã§ãããããâ¦ç§ãã¡ã®ä¼ç¤¾ã§ã¯ãæ°äººã®æå¿ãTerraformãæ¸ãã¦Pull Requestãéã£ã¦ããããã¨ã¯ããã©ãéçºè å ¨ä½ã«ãã®æåãåºã¾ã£ã¦ããã¨ã¯ä»ã®æè¨ãã¾ããã
ã§ã¯ããªãéçºè èªèº«ã§Infraæ§ç¯ã§ããã«ãé¢ããããå¾æ¥éããç°å¢æ§ç¯ãä¾é ¼ããã®ã§ããããããã®çç±ã®1ã¤ã«ãå¦ç¿ã³ã¹ãã®åé¡ãæããããã¨æãã¾ããå½åãSREã®ç§ãã¡ã¯ããéçºè èªèº«ã§Terraformã«ããInfraæ§ç¯ã§ããç°å¢ãæ´ããï¼ããã§Self-Serviceãæ¨é²ã§ããï¼ãã¨æãè¾¼ãã§ãã¾ãããã¨ããã®ããInfraç°å¢ã®å¤§åã¯ãSREãTerraformåããã§ã«è¡ã£ããããéçºè ã¯æ¢åã®Terraformãåèã«ã³ããããã ãã§æãéãã®Infraç°å¢ãæã«ãããã¨ãã§ããã¨æãã¦ããããã§ãã
ããããå®éã¯ããã§ã¯ããã¾ããã§ããããã¡ããããã®çç±ã¯Terraformã®ããã§ã¯ããã¾ãããå®éã¯ãç§ãã¡ã®ç°å¢ã«ãããTerraformã®å¦ç¿ã³ã¹ãã®å¤§åã¯ãæ¢åã®Infraæ§æã«é¢ããå¦ç¿ã³ã¹ãã§ãããæ¢åã®Terraformãã³ã¼ããã³ããããã°ã§ããï¼ã¨æã£ã¦ããã®ã¯ç§ãã¡SREã ãã§ã大åã®éçºè ã¯ãæ¢åã®Infraæ§æã«é¢ããç解度ãããã¾ã§é«ããªããããã©ãã¾ã§ãã³ããã§æµç¨ãã¦è¯ãããåãããªãç¶æ ã§ããã
ãã¡ãããç§ãã¡SREãéçºè ã«å¯¾ãã¦System Architectureãä¼ãããã¬ã¼ãã³ã°ãè¡ã£ã¦ã¯ããã®ã§ãããéãããå ´ã§ã¯ãæ¥åã§èªåãã¡ã«å¿ è¦ãªTerraformãã¹ã ã¼ãºã«æ¸ããã»ã©ã®ç解度ã«ã¯éãã¾ããã§ããããããã®çµé¨ãããå¦ç¿ã³ã¹ããé«ããã®ã¯ã¯ã¼ã¯ãã¥ãããã¨ãå®æãã¦ãã¾ããã¨ãããã¨ã§ãå¦ç¿ã³ã¹ããä¸ãããããããªãã¼ã ã§ã®åãçµã¿ã大åã ã¨æãã¦ãã¾ãã
2. Self-Serviceãã©ã®ããã«ä½¿ãã¹ããã®ææ³ããã¼ã ã§å¯¾è©±ãã
ç§ãã¡ã®ãã¼ã ã§ã¯ãéçºè ããã¿ã³ãã¯ãªãã¯ããã ãã§ãProductionã¸ã®Deployããã¼ã«ããã¯ãç°¡åã«è¡ããã¨ãã§ããããã«å®è£ ãã¦ãã¾ãããã®Deploy Pipelineã使ããã¨ã§ãéçºè ã¯SREã®æãåããã¨ãProduction Deployãå®äºããããã¨ãã§ãã¾ãããã¦ããã®èªååãããDeploy Pipelineãã¤ããã«ããã£ã¦ãSREã¯1ã¤å¤§ããªé¡ããè¾¼ãã¦ãã¾ãããããã¯ãæä½æ¥æ代ã«ã¯ãï¼SREã®ãªã½ã¼ã¹é½åã§ï¼é »åº¦ãå¢ãããªãã£ãDeployåæ°ããå¤§å¹ ã«å¢ããããã¨ãããã®ã§ãããå æ¥ã社ã®éçºããã°ã«ãæ¸ãã¾ããããç§ãã¡ã¯ããã¼ã ã§å¯¾è©±ãè¡ããã¨ã«ããããã®å¤åãå®ç¾ãããã¨ãã§ãã¾ããã
ã¤ã¾ããããªãªã¼ã¹é »åº¦ãé«ãã¤ã¤ãé害çºçé »åº¦ã®æ¥µå°åããç®æããã¨ãç§ãã¡ã«ã¨ã£ã¦æ±ãããã姿å¢ã§ããã¹ã¿ãã£ã¹ãéçºãã¼ã ã§ã¯ãéå»ã«ããªãªã¼ã¹é »åº¦ã«é¢ãã¦åé¡æèã®ããã¡ã³ãã¼ã®çºæ¡ããã£ããã¨ãããªãªã¼ã¹ãµã¤ã¯ã«ã¨éçºã¹ã¿ã¤ã«ãã«é¢ããæèçµ±ä¸ã®è©±ãåããè¡ããã¾ãããç¾å¨ãããªãªã¼ã¹é »åº¦ãé«ãã¤ã¤ãé害çºçé »åº¦ã®æ¥µå°åããç®æãéåã°ã§ã¯ããã¾ãããå°ãªãã¨ãä»ã®ã¹ã¿ãã£ã¹ãéçºãã¼ã ã«ã¯ãé害ãèµ·ãããªãããã«ãªãªã¼ã¹é »åº¦ãæ¸ããããããã°ãããã¨èããã¡ã³ãã¼ã¯ãã¾ããããããã£ãæåã®1ã¤1ã¤ãã¦ã¼ã¶ã¼ä¾¡å¤ã®æ大åã«ã¤ãªããã¨èãã¦ãã¾ãã
åã«Self-Serviceãã¤ãã以ä¸ã«ããclass SRE implements DevOpsãã¯å¥¥ãæ·±ããã®ã ã¨æã£ã¦ãã¾ãã
3. ãµã¼ãã¹éçºè ã¨SREã®éã«å£ããªããã¨
2ã®å 容ã¨ãéããã®ã§ããããµã¼ãã¹éçºè ã¨SREã®éã«ã¯ãå£ããªãæ¥é ããç¶ç¶çã«å¯¾è©±ã§ããç°å¢ãæ´ã£ã¦ããã¹ãã ã¨èãã¾ããã¾ãããã®çµæã¨ãã¦ãSelf-Serviceãæ®åãããã次ã®Self-Serviceåãã対象ãèããã¢ã¤ãã¢ãå¾ããããã®ãããã®ã§ã¯ãªãã§ããããã
ç§ãåãä¼ç¤¾ã§ã¯ããã¼ã ã§åã仲éãããµã¼ãã¹éçºè ã¨SREã®éã®å£ãã¤ãããªããããªæ´»åã«ç±å¿ã«åãçµãã§ãã¾ãã
æ社ã®SREã¯å½¹å²ãå¤å²ã«æ¸¡ããããçµç¹ãæ¥æ¿ã«æé·ããã¨ãã¤ãç ´ç¶»ãã¦ãã¾ãã¨ãããªã¹ã¯ãããã¾ãã. ãããã£ããªã¹ã¯ã«å¯¾ãã¦äºåã«å¯¾çãæã¤ããã®1æ段ã¨ãã¦ãSREãæã£ã¦ããç¥èãçµé¨åãå ±æãSREã¨ä¸ç·ã«æ©ãå ´ã¨ãã¦ãSRE Office Hoursãã¨ããæ´»åãæ¯é±éææ¥ã«æ ãè¨ãã¦å®æ½ãã¦ãã¾ã. ãã®æ´»åã¯ãã¤ã¯ããµã¼ãã¹ã«ã¤ãã¦ä½ã§ãèããOffice Hoursã«åå ãããï¼ã#ã¡ã«ã«ãªãªæ¥ã ã«å½±é¿ãåãã¦ä¼ç»ããä»ãéå¬ãç¶ãã¦ãã¾ã. â»2 æè¡æ¸ã®è¼ªèªããããã£ãæ´»åã®ä¸ç°ã§ããä»çµã¿ã¯ã©ããªã£ã¦ããã®ãããå¼ç¤¾ã§ã¯ã©ããªã®ããããããæ¹åãã¦ãããã®ã§ã¯ãªãããã¨ãã£ãçåãæã¤ãã£ããã ã£ãããè°è«ãããå ´ã¨ãã¦æ´»åãã¦ãã¾ã. 社å åå¼·ä¼ã®LTæ ã§ããSREãæã£ã¦ããç¥èãå ±æããå ´ã®1ã¤ã¨ãã¦å©ç¨ããã¦ããã£ã¦ãã¾ã.
ãã£ããã£ã¦ããä¼ã¨ã¯ ååã ãèãã¨ãã ãã 楽ããããªã ãã®ä¼ã§ãããå®æ ã¯è³ã£ã¦ã¾ããã Webãã¼ã ã¨SREãã¼ã ããã¼ã ã®å£æ ¹ãè¶ããäºãã®ç¥è¦ãæ´»ããã¦ãã¼ã 横æçãªèª²é¡ãã¢ãã¯ã¼ã¯ã§è§£æ±ºããä¼ ã§ãã
Self-Serviceã¨ã«ãã³ããè¨ã£ã¦ãã¾ãããçªãè©°ããã¨ãSelf-Serviceãæ§ç¯ãã人ã¨ã使ã人ï¼ãã©ã¯ãã£ã·ã§ãã¼ï¼ãããã ãã§ãããã®éã«æºãããã°ããäºãã«ãããã¤ããã¤ãã£ãèªååã¤ã±ã¦ãã¼ãã¼ãã®ããã«ã®ã¯ã·ã£ã¯ããã®ã§ã¯ãªããã¨æãã¾ããç¹°ãè¿ãã«ãªãã¾ããããclass SRE implements DevOpsãã®è¨èã®è£ã«ã¯ããããã£ãããããææåããã¦ããªãããã©ããã¼ã ã§åã大åãªåææ¡ä»¶ãããã¤ãå«ã¾ãã¦ããã®ã ã¨ç§ã¯ä¿¡ãã¦ãã¾ãã
çãããè¯ãSelf-Serviceã©ã¤ããï¼