ãã㯠ã¨ã ã¹ãªã¼ Advent Calendar 2022 Advent Calendar 2022 ã®4æ¥ç®ã®è¨äºã§ãã åæ¥ã¯ id:abouch ã«ãããReactã§ç®¡çç»é¢(SPA)ãä½ã£ãæã®æè¡é¸å®ã¨ãã ã§ããã
ã¨ã ã¹ãªã¼ã¨ã³ã¸ãã¢ãªã³ã°ã°ã«ã¼ã AIã»æ©æ¢°å¦ç¿ãã¼ã ã®ç¬¹å·ã§ãã 趣å³ã¯ãã¹ã±ã¨çãã¬ã§ããã®ã¨ããã¯ãNBAãéå¹ãã¦åè©å¤ã¨å ¨ç¶éããã¼ã ã®èºé²ã«æ¯æ¥ã¯ã¯ã¯ã¯ãã¦ãã¾ãã
ä»åã¯ã2022å¹´4æã«ãªãªã¼ã¹ããããã¾ã§éç¨ãã¦ããEUã®å»çå¾äºè åãã¡ãã£ã¢ãµã¼ãã¹ã®éçºã«ãããéçºã®å·¥å¤«ã¨ãæè¡çãªææ決å®ã«ã¤ãã¦ç´¹ä»ãã¾ãã ãªããã¡ãã¯ãGoogle Cloud Next 2022 ã§åãå 容ãçºè¡¨ãã¦ãããä»åã¯ãããå°ãæ·±å ããã¦ç´¹ä»ãã¾ãã
- ãµã¼ãã¹éçºã®èæ¯
- éçºã«éãã¦éè¦ãããã¤ã³ã
- æè¡çãªãã£ã¬ã³ã¸ãèæ ®ããææ決å®
- ã¾ã¨ã
- We are hiring!
ãµã¼ãã¹éçºã®èæ¯
ã¨ã ã¹ãªã¼ã¯ãã¢ã¡ãªã«ãã¤ã®ãªã¹ããã©ã³ã¹ãä¸å½ãªã©ã°ãã¼ãã«ã¸ç©æ¥µçã«äºæ¥å±éãã¦ãã¾ãã ä»åã¯ããã©ã³ã¹ã®ã°ã«ã¼ãä¼ç¤¾ã§ãã Vidal ã¨ååããEUã®ä¼å¡ã¢ã¯ãã£ããã£åä¸ã®ãããå»çå¾äºè åããã¥ã¼ã¹ãµã¼ãã¹ãæ°è¦ã«éçºãããã¨ã«ãªãã¾ããã
ä½å¶ã¨ãã¦ã¯ã以ä¸ã®åæ ã§éçºãé²ãã¾ããã
ã¨ã ã¹ãªã¼ï¼æ¥æ¬ï¼
- ä¼å¡ã¢ã¯ãã£ããã£åä¸ã®ããã®æ½çãã¦ãã¦ã®æä¾
- éçºå ¨è¬
Vidalï¼ãã©ã³ã¹ï¼
- ãµã¤ãã«æ²è¼ããã³ã³ãã³ãã®å¶ä½
- å種è¦å¶ã¸ã®å¯¾å¿ãµãã¼ã
- ä¼å¡åºç¤ã®æä¾
éçºã«éãã¦éè¦ãããã¤ã³ã
æ°è¦ãµã¼ãã¹ã®éçºã«éãã¦ç¹ã«éè¦ãããã¤ã³ãã¯ä»¥ä¸ã®3ç¹ã§ãã
- ç´ æ©ãPDCAãåãããã®é«éãªéçº
- éãããäºç®ã«å¯¾å¿ããããã®éçºã³ã¹ãã®åæ¸
- GDPR ãã¯ããã¨ããè¦å¶ã¸ã®å¯¾å¿
1ã¤ç®ã®é«éãªéçºã«ã¤ãã¦ã¯ãä¼å¡ç²å¾ããå®çãé²ãããããæ½çãæã¡ã¤ã¤ããã®çµæããå¦ã¶ã¨ããã«ã¼ããæ°å¤ãé«éã«åãå¿ è¦ãããã¾ãã ãã®ããéç¨è² è·ã極åä¸ãã¤ã¤ãå¤æ´ã容æã«ãã¦ãããã¨ãéè¦ã§ãã
2ã¤ç®ã®éçºã³ã¹ãã®åæ¸ã«ã¤ãã¦ã¯ãæ°è¦éçºã«éããªããã¨ã§ã¯ããã¾ãããç¹ã«ãµã¼ãã¹éçºåºç¤ã§ã¯ãéãããäºç®ã®ä¸ããæ大ã®ææãåºããããéçºã³ã¹ããå°ãã§ãæ¸ããå¿ è¦ãããã¾ãã
3ã¤ç®ã®è¦å¶ã¸ã®å¯¾å¿ã«ã¤ãã¦ã¯ãä»åãµã¼ãã¹ãå±éããEUã§ã¯GDPR ã¸å¯¾å¿ãããã¨ãå¿ é ã§ããããã®ããã®èª¿æ»ã»éçºãå¿ è¦ã«ãªãã¾ãã ã¾ããä»åã¯ããã©ã³ã¹ç¬èªã®è¦å¶ã¸ã®å¯¾å¿ãå¿ è¦ã«ãªã£ããããGDPR対å¿ã¨ä½µãã¦ãã©ã³ã¹ãã¼ã ã¨ã®ååãã¨ã¦ãéè¦ã§ããã
以ä¸ã§ã¯ãä¸è¨ã®ãã¤ã³ãæ¼ããã¤ã¤éçºãé²ããéã®å·¥å¤«ã«ã¤ãã¦ç´¹ä»ãã¾ãã
é«éãªéçº
é«éãªéçºã®ããã«ãä»åã®ããã¸ã§ã¯ãã§ã¯ä»¥ä¸ã®æè¡é¸å®ãå®æ½ãã¾ããã
- GKE Autopilot ã®å©ç¨
- GraphQL ã®ã¨ã³ããã¤ã³ããç¨æããããã³ãã¨ããã¯ã¨ã³ããåé¢
- ãã¤ã¯ããµã¼ãã¹ã«ã¯ããªã
ã¯ããã«ããµã¼ãã¹ãåãåºç¤ã¨ãã¦GKE Autopilotãå©ç¨ãããã¨ã決ãã¾ããã ãæ°è¦ãµã¼ãã¹éçºã«Kubernetesã®å©ç¨ã¯æªæã§ã¯ï¼ãã¨æãããããããã¾ããã ãã®æè¡é¸å®ã®èæ¯ã¨ãã¦ãçè ãå«ãéçºãæ å½ããã¨ã³ã¸ãã¢å ¨å¡ããæ®æ®µããæ¥æ¬ã§ã®ãµã¼ãã¹éçºã«GKEãæ¢ã«å©ç¨ãã¦ãããç¿çãã¦ãããã¨ãæãããã¾ãã ææ £ããç©ã使ããã¨ã§ãæ¢åã®è³ç£ï¼TerraformããCIã®å®è£ ãªã©ï¼ãæµç¨ãã¤ã¤ãããã¹ã¿ã¼ãããã·ã¥ãåããã¨æãã¾ãã ã¾ããä»åã¯Autopilotãåãã¦å°å ¥ãã¦ã¿ã¾ããã Autopilotã¯Kubernetesã¯ã©ã¹ã¿ãæ§æãããã¼ãã®ç®¡çãGoogleã«ä»»ãããã¨ãã§ããGKEã®ã¢ã¼ãã§ãããã«ãããã¼ãã®ç®¡çã®æéãåæ¸ãããéçºè ã¯ã¢ããªã±ã¼ã·ã§ã³ã®éçºã«éä¸ãããã¨ãã§ãã¾ãã Autopilotã®å°å ¥ã«ä¼´ããã©ãã«ã¯ç¹ã«ãªããã¨ã¦ãå®å®ãã¦ããã®ã§ããã®ãã¦ãã¦ãæ¥æ¬ã®éçºã«ãã£ã¼ãããã¯ããå°å ¥ãé 次é²ãã¦ããã¨ããã§ãã
次ã«GraphQLã®å°å ¥ã¨ãããã³ãã¨ã³ãã¨ãããã¯ã¨ã³ãã®åé¢ã§ãã ããã¯ãæ¨ä»ã¡ã¸ã£ã¼ãªéçºæ¹éã§ã¯ããã¾ãããããã³ãã¨ããã¯ãåé¢ãã¦ç¬ç«ãã¦éçºãããã¨ã«ããéçºã®é«éåãçã£ããã®ã§ã GraphQLã®ã¹ãã¼ããåæã¨ãã¦ç¸äºã®ããã¨ããè¦å®ãããã¨ã§ãã¹ã ã¼ãºã«éçºãããã¨ãã§ãã¾ããã ä»åã®ããã¸ã§ã¯ãã§ã¯ãã¨ã³ã¸ãã¢3åããã¶ã¤ã1åã§éçºãé²ããã®ã§ããããã®æ§æã«ãããã¨ã§ãã¶ã¤ãã®ã¡ã³ãã¼ã«ãããã³ãã®éçºã®ä¸é¨ãæ å½ãã¦ããããã¨ãã§ãã¾ããã
æå¾ã«ãã¤ã¯ããµã¼ãã¹ã«ã¯ããªãã¨ããææ決å®ã«ã¤ãã¦ã§ãã ãã®ä½å¶ã§ãµã¼ãã¹ãåå²ãã¦éçºãé²ãã¦ããããããèµ·ãããã¨ã¯ãåå²ãããµã¼ãã¹ãä¿®æ£ããGraphQLã¹ãã¼ããå¤æ´ãã対å¿ããããã³ããå¤æ´ããã¨ãããã¨ã1人ãè¡ãã¨ãããã¨ã§ãããç¹ã«ãµã¼ãã¹ãåå²ããã¡ãªãããããã¾ããã ãªã®ã§ãã»ã¨ãã©ã®ãµã¼ãã¹ã¯åå²ããã1ã¤ã®ã¢ããªã±ã¼ã·ã§ã³ã¨ãã¦å®è£ ãé²ãã¾ããã ãã ããå°æ¥çãªãµã¼ãã¹ã®åå²ã¯ãããããã¨ã¨èããåå²ããã§ãããé¨åãæ³å®ããéçºãæèãã¾ããã
以ä¸ãä»åéçºããã¢ããªã±ã¼ã·ã§ã³ã®ã¢ã¼ããã¯ãã£å³ã§ãã Dataã¨æ¸ãã¦ããBigQueryã®ã³ã³ãã¼ãã³ã以å¤ã¯å ¨ã¦GKE Autopilotã®ã¯ã©ã¹ã¿ä¸ã§åãã¦ãã¾ãã ä¸å¤®ã®Backendã®ä¸ã®GraphQL + Contentã¨ããé¨åããå°æ¥åå²ããã§ããããã¥ã¼ã¹ã³ã³ãã³ããé ä¿¡ããã³ã³ãã¼ãã³ãã¨GraphQLã®ã³ã³ãã¼ãã³ããåããã£ãé¨åã§ãã
éçºã³ã¹ãã®åæ¸
éçºã³ã¹ãã®åæ¸ã«ã¯ã以ä¸ã®åãçµã¿ãå®æ½ãã¾ããã
- Spot Podã®å©ç¨
- DBã¤ã³ã¹ã¿ã³ã¹ã1ã¤ã«éç´
1ã®Spod Podã¯ã Google Cloudã®äºåã®ã³ã³ãã¥ã¼ãã£ã³ã°ãªã½ã¼ã¹ãå©ç¨ãã¦ãä¸å®æéå¾ã«Podãå¼·å¶çµäºãã¦ãã¾ã代ããã«ãèµ·åããPodã®æéã大ããå²å¼ãããã¨ããä»çµã¿ã§ãã ç¹ã«éçºç°å¢ã®å ¨ã¦ã®Podã«é©ç¨ãããã¨ã§ãå¤§å¹ ã«ã³ã¹ããåæ¸ã§ãã¾ããã
次ã«ãDBã¤ã³ã¹ã¿ã³ã¹ã®éç´ã«ã¤ãã¦ã§ããDBã¤ã³ã¹ã¿ã³ã¹ã¯ã¯ã©ã¦ãã³ã³ãã¼ãã³ãã®ä¸ã§ãç¹ã«ã³ã¹ãããããã³ã³ãã¼ãã³ãã®1ã¤ã§ãã ä»åã®éçºã§ã¯ãã®æéã®ç¯ç´ã®ããã1ã¤ã®ã¤ã³ã¹ã¿ã³ã¹ã«éç´ãã¦éçºãã¾ããã ãã ããå è¿°ããéããµã¼ãã¹åå²ãæèããæ§æã«ãããããDBå é¨ã®ãã¼ã¿ãã¼ã¹ã¯ãµã¼ãã¹åä½ã§åå²ãã¾ããã ãããããã¨ã§ãä¸æã«åå²äºå®ã®ãµã¼ãã¹éã®ãã¼ãã«å士ã®joinãªã©ãçºçããªãããã«ããå°æ¥çãªãµã¼ãã¹åå²ã®éã«å¥ãããããããã«è¨è¨ãã¾ããã
è¦å¶ã¸ã®å¯¾å¿
EUåã§ã®ãµã¼ãã¹éå¶ã«ã¯ãGDPRã¯ãã¡ããããµã¼ãã¹ãå±éããåå½ã®è¦å¶ã«å¯¾ãã対å¿ãå¿ é ã§ããä»åã¯ä»¥ä¸ã®å¯¾å¿ãå®æ½ãã¾ããã
- GDPRã¸ã®å¯¾å¿
- ãã©ã³ã¹å½å ã®è¦å¶ã¸ã®å¯¾å¿
ã¾ã1ã¤ç®ã®GDPRã®å¯¾å¿ã«ã¤ãã¦ã¯ããµã¼ãã¹è¦ç´ã®ä½æããå種åæç»é¢ã®ããã³ãã¸ã®å®è£ ãå®æ½ãã¾ããã éçºã«ããã£ã¦ã¯ãVidalã®ãã¼ã¿é¨éã®æ å½è ã¨å¯ã«é£æºããè¦ç´ã¸ã®è¨è¼å 容ã®èª¿æ´ãåæåå¾ç®æã®æ´ãåºãããã¶ã¤ã³ã®èª¿æ´ãªã©ãç´°ããå®æ½ãã¾ããã
次ã«ãã©ã³ã¹å½å ã®è¦å¶ã¸ã®å¯¾å¿ã«ã¤ãã¦ã§ãã éçºå½åãã¦ã¼ã¶ã®è¡åãã°ãã¼ã¿åå¾ã®ããã«Google Analyticsãå©ç¨ããæ³å®ã§ããã³ãã¨ã³ãããã³ãã¼ã¿é£æºã®å®è£ ãé²ãã¦ãã¾ããã ãªãªã¼ã¹ç´åã®2æã«ãã©ã³ã¹å½å±ããGoogle Analyticsã®å©ç¨ã¯éæ³ã§ããæ¨ã®çºè¡¨ãããã¾ããã
ããã«ã¯ããªãå°ã£ãã®ã§ããã対å¿ããªãããã«ã¯ãããªããããã¡ã³ãã¼ã§ç¸è«ãããã°è¨é²ãã¼ã«ãèªä½ãããã¨ã«ãã¾ããã ããã¯ã¨ã³ãã«ã¯ããªã¯ã¨ã¹ãã«å«ã¾ããpayloadããã®ã³ã°ããã ãã®ã·ã³ãã«ãªAPIãä½æãããã®ãã°ãCloud LoggingããLog Sinkãç¨ãã¦BigQueryã¸é£æºããæ§æã«ãã¦ãã¾ãã ããã³ããããã®APIãå¼ã¶éã«ããã©ããã³ã°ããå 容ãå«ãã¦ãªã¯ã¨ã¹ããéãããã«ãããã¨ã§è¡åãã°ãã¼ã¿ã®åå¾ãå®ç¾ãã¾ãã APIã®å®è£ ã®ãã¡ä¸»è¦ãªå®è£ ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãï¼èª¬æã®ããã«ä¸è¦ãªé¨åãçç¥ãã¦ãã¾ãï¼ã
func handle(w http.ResponseWriter, r *http.Request) { var request map[string]interface{} err := json.NewDecoder(r.Body).Decode(&request) if err != nil { w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(err.Error())) logger.Error().Err(err).Send() return } logger.Info().Labels( commonLabel, zerodriver.Label("type", fmt.Sprint(requestType)), ). Interface("request", request). Send() w.WriteHeader(http.StatusOK) }
å®è£ ã«ã¯æä½ã®zerodriverã¨ããæ§é åãã°åºåã®ããã®ãã®ã³ã°ã©ã¤ãã©ãªãå©ç¨ããrequestã®å 容ã以ä¸ã®é¨åã§Cloud Loggingã«åºåããã®ã¿ã®ã·ã³ãã«ãªå®è£ ã§ãã
logger.Info().Labels( commonLabel, zerodriver.Label("type", fmt.Sprint(requestType)), ). Interface("request", request). Send()
åºåãããã°ã¯ããã¼ã¸ããµã¼ãã¹ã®ã¿ã§BigQueryã¾ã§é£æºãããæ§æã«ãªã£ã¦ãããå®è£ è² è·ã¯ãã¡ãããéç¨è² è·ã®ä½æ¸ã«ãè²¢ç®ãã¦ãã¾ãã
Google Analyticsããèªåãã°è¨é²ãã¼ã«ã«å¤æ´ããå¾ã®ã¢ã¼ããã¯ãã£ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã
æè¡çãªãã£ã¬ã³ã¸ãèæ ®ããææ決å®
ããããå°ãè¦ç¹ãå¤ãã¦ããã®ããã¸ã§ã¯ãã§åãçµãã ãæè¡çãªãã£ã¬ã³ã¸ãã«ã¤ãã¦ããã®èãã®èæ¯ãä¸å¿ã«ç°¡åã«ç´¹ä»ãããã¨æãã¾ãã
ã¨ã ã¹ãªã¼ã§ã¯ãæè¡é¸å®ã¯å®è£ ãæ å½ãããã¼ã / ã¡ã³ãã¼ã«ä»»ãããã¦ãã¾ãã ããã社å ã«æè¡çãªå¤æ§æ§ãçãã§ãããå人çã«ãè¯ãæåã ãªã¨æã£ã¦ãã¾ãã
æ®æ®µã®æè¡é¸å®ã¯ãããã¸ã§ã¯ãã®æ§è³ªãæè¿ã®ãã¬ã³ããå¦ç¿ã³ã¹ããªã©ãç·åçã«èæ ®ãã¦è¡ããã¾ãã
ããããä»åã®ããã¸ã§ã¯ãã®æè¡é¸å®ã§ã¯ãã¡ã³ãã¼å ¨å¡ãç· åã¨ã¯ãªãªãã£ã«è²¬ä»»ãæã¤åæã§ãç©æ¥µçã«ãã£ã¬ã³ã¸ãã¦ããæ¹åã¨ãã¾ããã ããã£ã¬ã³ã¸ãããã¨ããè¨èã¯ãããã§ã¯ãåã«æ°ããæè¡ãé¸ã¶ã¨ãããã¨ã§ã¯ãªããéçºããã¡ã³ãã¼ãæ £ãã¦ããªãã¨ãããã¨ãçç±ã«ãããé¸æããªãã¨ããå¤æãããã ã¡ã³ãã¼ããé¢ç½ãããã¨æããæè¡ãæ¡ç¨ãããã¨ãããã¨ãæå³ãã¦ãã¾ãã
ä»åã®ä¾ã§ã¯ãGKE AutopilotãGraphQLã®æ¡ç¨ã®ä»ãORMã¨ãã¦entãããã³ãã¨ã³ãã«Reactãæ¡ç¨ãããã¨ãªã©ãæãããã¾ãã GKE Autopilotã¯ãªãªã¼ã¹å½æã¾ã æ¯è¼çæ°ãããµã¼ãã¹ã§ããããGraphQLããReactã¯æ¢ã«ã¡ã¸ã£ã¼ã§æ¡ç¨äºä¾ãå¤ããã®ã§ããã¨æãã¾ãã
ãã®ãã£ã¬ã³ã¸ã¯ãã¡ã³ãã¼ãããã楽ããã§éçºãããã¨ãã§ããããã«ãªãããã®ãã¨ãè¯ãææã«ã¤ãªããã¨ããçãã®ãã¨å®æ½ãã¾ããã
ä¾ãã°ãReactã®æ¡ç¨ã§ã¯ããªãªã¼ã¹å½æã社å ã§ã®å©ç¨ã¯è¥å¹²Vueãåªå¢ã¨ããã¨ããã§ããããã¶ã¤ãã®å¤§æãVueã®çµé¨ãããã¾ããã é å½ã«ããã°Vueãæ¡ç¨ãããããªç¶æ³ã®ä¸ã§ã¯ãããã®ã®ãã¡ã³ãã¼å ã§è°è«ã®çµæReactã®æ¹ããé¢ç½ãã ãããã¨ãªããReactãæ¡ç¨ãããã¨ã«ãªãã¾ããã ãã£ããã¢ããã«ã¯å¤§æãå«ãã¡ã³ãã¼å ¨å¡ãå¤å°è¦å´ããé¨åãããã¾ããããæè¡é¸å®ã®èæ¯ãå¾æ¼ããã楽ããã§éçºãããã¨ãã§ãã¾ããã çµæã¨ãã¦åé¡ãªãç· ãåãã«éã«åããããã¨ãã§ããã®ã¯ãã¡ããã®ãã¨ãæåå³åã§ã¯ããã¾ããã¯ãªãªãã£çã«ãè¯ããã®ãã§ããã¨æãã¾ãã
ãã¡ãããã£ã¬ã³ã¸ã«ã¯ãããã¨ã°ããã§ã¯ãªãããªã¹ã¯ããããã¨ãç¥ã£ã¦ããå¿ è¦ãããã¾ãã ãªã¹ã¯ã®ã³ã³ããã¼ã«ã誤ãã¨ãä¸æ £ããªæè¡ããã«æã£ãããå¤ãã®æéã使ã£ã¦ãã¾ããå質ãä¸ããããªããç· åã«éã«åããªããªã©ãçºçãããã¨ã¯æ³åã«é£ãããã¾ããã
ããããçåãã¤ã¢ã¹ãå¼·ãã«ããã£ãäºä¾ã§ã¯ããã¾ããããã®ãããªæè¡é¸å®ã®æ¹åãé¢ç½ãã®ã§ã¯ãªãã§ããããã
ã¾ã¨ã
ä»åã¯ãã°ãã¼ãã«åãã¡ãã£ã¢ãµã¼ãã¹ã®éçºã«ããã工夫ã¨ãæè¡çãªææ決å®ã«ã¤ãã¦ç´¹ä»ãã¾ããã ãã®ããã¸ã§ã¯ãã¯ç¾å¨ãã¨ã³ãã³ã¹éçºãã¬ã³ã¬ã³é²ãã¦ããã¨ããã§ãã ãµã¼ãã¹ã®æ¨ªå±éãªã©ããããªã大ããªææã«ã¤ãªããããã«é å¼µã£ã¦ããããã¨æã£ã¦ãã¾ãã
We are hiring!
ã¨ã ã¹ãªã¼ã§ã¯ãä¸çåå°ã®ã¡ã³ãã¼ã¨ååããªãããå»çãåé²ããããããã¯ããçã¿åºãã¨ã³ã¸ãã¢ãåºãåéä¸ã§ãã
ã°ãã¼ãã«ã«å¤§ããªã¤ã³ãã¯ããä¸ããæ©ä¼ãå¤æ°ããã¾ãã®ã§ãæããã¯ï¼ã¨ããæ¹ã¯ã«ã¸ã¥ã¢ã«é¢è«ããå¿åãå¾ ã¡ãã¦ãã¾ãï¼