ããã«ã¡ã¯ãæ ªå¼ä¼ç¤¾ã«ããã·ã®ã¨ã³ã¸ã㢠@imu ã§ãã
ã¯ããã«
ç§ã¯ã¤ã³ãã©ã«å¯¾ãã¦è¦ææèï¼è©³ããç¥ããªãï¼ããããissueã«å¯¾ãã¦çå ãã¦æ¹åãããã¨ãã¾ããã§ããããã®ã¾ã¾æ·±ã触ããã¨ã¯ãªãããªã¨æã£ã¦ããç¢å ãæ°è¦ãããã¯ãã®ã¤ã³ãã©æ§ç¯ããé¡ãããã¾ããã
ãã¡ããã¡ãä¸å®ãããªãã£ãã®ã§ãããæåããæ§ç¯ããæ©ä¼ãªãã¦æ»
å¤ã«ãªãã®ã§ãã£ã¬ã³ã¸ãããã¨ã«ï¼
ï¼å
å¿ã¯ãããããªããªã¨æã£ããã©â¦ï¼
ç§èªèº«ã¯ç¥ããªãé åã«ãã£ã¬ã³ã¸ãããã¨ã¯å¥½ããªã®ã§ã楽ããã§ãããã¨æãã¾ããã è¦ææèãããç§ãã©ã®ããã«ããªãªã¼ã¹ã§ããç°å¢ãæ§ç¯ãããå ±æã§ããã°ã¨æãã¾ãï¼
注æï¼æ¬å 容ã¯Î±çã¨ããä½ç½®ã¥ãã§æ§ç¯ãã¦ãããæ£å¼ãªãªã¼ã¹æã«ã¯é½åº¦å¤æ´ããã¦ããã¾ãã
Day 1ï¼æè¡é¸å®ï¼
å¼ç¤¾ã¯ã«ããã·ã¬ãã¼ãã¨ãããµã¼ãã¹ãæä¾ãã¦ãã¾ãããã®ãããã¯ãã¯AWSãå©ç¨ãã¦ããããã®æ§æãçä¼¼ã¦æ§ç¯ããã®äºå®ã§ããããã¤ã³ãã©ãè¦æãªç§ã«ã¨ã£ã¦ã¯è¥å¹²ãã¼ãã«ãé«ãã§ããã¾ãã¦ãä¸äººã§ããã¨ãªãã°å°æ´ã§ããâ¦ã
ã¨ãªãã°ãã¤ãããæ§ç¯ãããªãå¥ãµã¼ãã¹ãæ¤è¨ãã¦ãè¯ãã¨æããã¡ããã©ãã®é ã社å
ã§ãã¼ã¿åºç¤ãGCPå´ã«æ§ç¯ãã話ãä¸ãã£ã¦ããã®ã§ãæ°è¦ãããã¯ãã¯GCPã«æ§ç¯ãããã¨æãã¾ããã
GCPçµé¨è
ã¯ç¤¾å
ã«ãã¾ããã§ããããå¼ç¤¾ã®ããªã¥ã¼ã«ãβçãã¤ã³ãããããã®ã§ãã£ã¬ã³ã¸ãããã¨ä¼ãã¦ãéç¨ãèãããªãå ´åã¯å¥ã®ãµã¼ãã¹ã«ä¹ãæããã¨ãã話ã§GCPãæ¡ç¨ãã¾ãããï¼ã¨è¨ããããèªåä¸äººã§ãããªããã£ã¦ã¿ããæ¹ãæ¡ç¨ãããã£ãã®ãæ¬é³ï¼
ãããã£ããã£ã¬ã³ã¸ãå¼ç¤¾ã§ã¯åºæ¥ãã®ã§ãããããã§ãã
Day 2ï¼ã¤ã³ãã©æ§æå³ï¼
ã¨ã¯ããããããªãGCPã®ã³ã³ã½ã¼ã«ããããªã触ãã®ã¯ã¡ãã£ã¨ãã¼ãã«é«ãã§ãã ã©ããã£ãæ©è½ãæä¾ããã¦ãããåãããªãã¾ã¾é²ããããªãã®ã§ã¤ã³ãã©æ§æå³ãæ¸ãã¾ãããæ§æå³ãæ¸ããã¨ã§é ã®æ´çã«ããªããã誰ãã«èª¬æããã¨ã楽ã§ããã
ãããã¯ãã«å¿ è¦ãªæ©è½ããä½æããã¤ã³ãã©æ§æå³ï¼Î±çï¼ã§ãï¼
ã¤ã³ãã©å ¨ä½ã¯Î²ç以éã¾ã§è¦æ®ãã¦æ¸ãåºãã¾ããããæ£ç´ãããæ£ããã®ãä¸å®ãªãã§ãããâ¦ã
社å ã«GCPã®ã¤ã³ãã©çµé¨è ã¯ããªããããæ¥åå§è¨ã§é¢ãã£ã¦ããã¡ã³ãã¼ã«å£æã¡ããé¡ããã¾ããï¼
äºãæ§æå³ãå ±æãã¦ã¤ã³ãã©MTGãéå¬ããæ°ã«ãªãç¹ãã¢ããã¤ã¹ãããã ãã¾ããã
- αçã¾ã§ã®æéãçãã£ããã¨ããããä½ããããã«å¾ãã追å ã§ãããã®ã¯å¾åãã«ãã
- CI/CDãåãããã¨ãæèãã¦ãæå°æ§æããç®æã
æªçµé¨ããããçãªãã¨ã ã¨æãã¾ããããããªãå®ç§ãªãã®ãç®æãã¦ãã¾ã£ãã®ã§å°ããæ©ãä»çµã¿ã¥ããããããã¨ã«ãã¾ããã ï¼ãæ¥ããããªããããã¯ç§ã®åçç¹ï¼
æçµçã«Î±çã®ã¤ã³ãã©æ§æå³ã¯ãã¡ãã§ãï¼
Day 3-4ï¼Cloud Runã¨Firebase Hostingã«Deployï¼
Cloud Runã«Deploy
åºæ¬ã¯å
¬å¼ããã¥ã¡ã³ãï¼
ããã¥ã¡ã³ãã«å¾ã£ã¦APIãæå¹ã«ããããcloudbuild.yaml
ãæå°æ§æã§ä½æãã¾ããã
æªçµé¨ã ã¨ãããªãã¯æãã¦ã以ä¸ã®æå°æ§æã§ã¾ãDeployãããã確ããã¾ããã
- Cloud Buildã®Triggerãä½æ
- featureãã©ã³ãã§åãããã«è¨å®
- ãã¿æ¸ãã§
cloudbuild.yaml
ãä½æ
â»Githubã®é£æºã¯å ±éã¢ã«ã¦ã³ããå©ç¨ãã¾ãããï¼å人ã¢ã«ã¦ã³ãã ã¨äºæãã¬åé¡ã«ãªãã¾ãããã
å°ç·ãåºæ¥ãå¾ã¯BuildãCloud Runã¸ã®Deployã cloudbuild.yaml
ã«è¿½å ãã¦Deployã§ãã¾ããã
ï¼APIãæå¹ã«ããã権éå¨ãã§åºæ¥ãªããã¨ã¯ããã¾ãããâ¦ï¼
Firebaseã«Deploy
Webã¢ããªã±ã¼ã·ã§ã³ã®Deployã¯Firebaseãå©ç¨ãã¦ãå ¬å¼ããã¥ã¡ã³ããè¦ã¾ããã
ä½è£ä½è£ï¼ã¨æã£ã¦ããç¢å ãFirebaseå´ããããã¸ã§ã¯ããè¦ããªãã¨ããåé¡ã«å½ããã¾ããã
ãããããã¦ã³ãªã¹ãã«è¿½å ããããã¸ã§ã¯ãåã表示ãããªãï¼å¥ã®ããã¸ã§ã¯ãã¯è¡¨ç¤ºããã¦ããã®ã«â¦ã
ããã¥ã¡ã³ãçãæ¢ãã¾ãããæ¤è¨ãä»ãããä»ã®ããã¸ã§ã¯ãã®å·®åãè¦ãã¨æªããç®æãããã¾ããã
çµè«ã¯GCPã§æ°è¦ããã¸ã§ã¯ããä½æããã¨ããããã¸ã§ã¯ãåã¨ããã¸ã§ã¯ãIDãåä¸ã«ãã¦ããã¨è¡¨ç¤ºãããªãã§ãã
ä¸åº¦ããã¸ã§ã¯ããä½æããã¨ããã¸ã§ã¯ãIDã¯ç·¨éã§ããªããããæ°è¦ããã¸ã§ã¯ã㧠kaminashi-blog-123
ã¨ããã°è¡¨ç¤ºããã¾ããã
åå ãåãã£ãã®ã§æ°ããä½ãç´ããã¨ã«â¦ã
Day 5ï¼Cloud SQL for MySQLã®ã¤ã³ã¹ã¿ã³ã¹ä½æï¼
ã¤ã³ã¹ã¿ã³ã¹ãä½æããã ããªã®ã§ãå ¬å¼ããã¥ã¡ã³ããè¦ã¦æå°æ§æã§ä½æãã¾ããã
αçã®ããåºæ¬æå°æ§æã§ã¤ã³ã¹ã¿ã³ã¹ãä½æãã¦ãã¾ãã CPUãã¡ã¢ãªçã¯å©ç¨è æ°ã®å¢å ã«ä¼´ã£ã¦ãéæå¤æ´ããã¦ããã¾ãï¼
Golangã§Cloud SQL for MySQLã«æ¥ç¶ããã¨ããä¸è¨ããã¥ã¡ã³ããåèã«ãã¾ããããæ¥ç¶æååã //cloudsql
ã«ãªãã®ã§æ³¨æãã¦ãã ããã
ãã¨ã¯Cloud Buildãåå®è¡ãã¦DBæ¥ç¶ã¾ã§åºæ¥ã¦ãããã¨ã確èªãã¦ãããã§ãã
Day 6ï¼Cloud Runã®ã«ã¹ã¿ã ãã¡ã¤ã³è¨å®ï¼
ã«ããã·ã¬ãã¼ãã§AWS Route53ãå©ç¨ãã¦ããã®ã§ãã¡ãã使ãã¾ãã
å ¬å¼ããã¥ã¡ã³ããè¦ãã°å°ããã¨ã¯ãªãã£ãã§ãï¼ cloud.google.com
HTTPS æ¥ç¶ç¨ã®ããã¼ã¸ã証ææ¸ãèªåçã«çºè¡ãæ´æ°ãããã®ã§ä¾¿å©ã§ããããããã£ãç´°ãããã¨ãGCPå´ããã£ã¦ãããã®ã§é常ã«å©ãã£ã¦ã¾ãã
ã¡ãªã¿ã«ãããã³ã°ãçµããã¾ã§ã«40åãããæããã¾ããã
è©°ã¾ã£ããã¤ã³ã
- ã°ã°ã£ãã¨ãã«å ¬å¼ããã¥ã¡ã³ããããªãã¦å人ããã°ãåèã«ããã¨ãå 容ãå¤ãå ´åãå¤ãã£ãã®ã§å ¬å¼ããã¥ã¡ã³ããè¦ããï¼
- GCPã®APIãµã¼ãã¹ã®æå¹åããµã¼ãã¹ã¢ã«ã¦ã³ããªã©ã«æ¨©éä»ä¸ã¯ãTry&Errorãç¹°ãè¿ããããªãã
- Cloud Loggingã§Cloud Buildã®ã¨ã©ã¼ãè¦ãã¨ããããããããä¸è¦§ã§åãããªãã®ãé£ç¹ã
ãããã«
ã¤ã³ãã©æªçµé¨ã®ç§ãçéã§ã¤ã³ãã©æ§ç¯åºæ¥ãã®ããæ¥åå§è¨ã®ã¡ã³ãã¼ã¨é±æ¬¡ã§å£æã¡ããéæå°ã£ãã¨ãã«ç¸è«åºæ¥ããã¨ãè¦å ã ã¨æãã¾ããè¦æãªç§ã«å¯¾ãã¦ãã¢ããããã¦ããã ããããæ§ã ãªææ¡ããã¦ããã ããã³ãã«å©ããã¾ããã
ã¾ãã¯æåã§åãç°å¢ãæ§ç¯ããã®ãåªå ãããããä»ã§ã¯Terraformåãå¥ã®ç°å¢ãä½ã£ãããç§èªèº«ãã¤ã³ãã©ã«å¯¾ããæèãå¤ããã¾ããã ãããããã£ã¦ã¿ãããããã¯ã©ãããã°ãããã ããï¼ãªã©ã®èª²é¡ãä¸ãã解決ãã¦ããã®ã楽ãããªãã¾ããã
ã¨ã¯ãããã¾ã æ£å¼ãªãªã¼ã¹ã¾ã§ã«ãããã¨ã¯ããã¾ãï¼ãªãªã¼ã¹å¾ãé½åº¦æ¹åããã¦ããå¿ è¦ãããã®ã§ãã£ã¬ã³ã¸ããããããã¾ããã
ã¾ããä»ã®ãã§ã¼ãºã¯é åã«ç¸ãããªãåãæ¹ãåºæ¥ã¦ãã«ããã·ã§ã¯ãã£ã¦ã¿ãããã¨ãå®ç¾ãã¦ã¿ãããã¨ãªã©ãå¶ããããç°å¢ã ã¨æã£ã¦ãã¾ãï¼
ãããã«ããã·æ°ã«ãªããªã¼ãã¨æã£ãæ¹ã¯ã«ã¸ã¥ã¢ã«ã«ã話ã§ããã°ãªã¨æãã¾ãã®ã§ãTwitterã®DMãä¸è¨ã®æ¡ç¨æ å ±ãµã¤ããããé£çµ¡ãå¾ ã¡ãã¦ããã¾ãï¼
æå¾ã¾ã§èªãã§ããã ãããããã¨ããããã¾ããï¼ careers.kaminashi.jp