Google App EngineでマネージドSSLが全ユーザーに無料提供、HTTPSの導入が簡単に。証明書の更新もGoogleにおまかせで心配無用 - Publickey ã¨ãããã¥ã¼ã¹ãç®ã«ããã®ãå é±ã®ç«ææ¥ã»9æ19æ¥ã
ãGAE ãã©ãã©ã便å©ã§æé«ã«ãªã£ã¦ãã£ã¦ããªã......ãã¨æããé ãç®ãããåã¯ãããããå¤åGAEã¦ã¼ã¶ã¼ã¨è¨ã£ã¦ãå·®ãæ¯ãã¯ãªããããè¨é²ï¼ãã®ããã°ï¼ã«ããã¨ã2009å¹´ã« GAE ã触ãå§ãã¦ãããGAE ãã¡ã¤ã³ã§æ±ã Web èµ·æ¥ã«ã¨ã³ã¸ãã¢ã¨ãã¦åãã¦ãããã¨ãããï¼2012 - 2013ï¼ããªã®ã§ãæã®ä¸ä¾¿......ãããèåããªé ã® GAE ã¯ã¤ã¤ã¨ããã»ã©è§¦ãåãã¦ããã
ããããã£ã¦ãä»åã®å ±ã¯ã¨ã¦ãå¬ããã£ããããã ã§ãããã¾ããããã GAE ã§ããããããã¨ãããããªã...ãã¨æã£ã¦ããã¨ããã§ããã£ãã®ã§ãä»åã®ã¢ãããã¼ãã¯ãããªèªåã®æãåããããã®ã«ååãªã¤ã³ãã¯ããæã£ã¦ãã
ã¡ããã©ããã©ã¤ããªéçãµã¤ããå ¬éããããªã¨ãæã£ã¦ããã¨ããã ã£ãããããã GitHub Pages ã¨ãã§ãå ¨ç¶ã³ãã¯è¶³ããã®ã ãã©ãç¬èªãã¡ã¤ã³ã§SSLåã¨ãªãã¨ãCloudFront ãªã©ã® CDN ãæã¾ãªãã¨ãããªãã£ãããããããã¨ã¯ããã¤ã§ã触ãã GAE ã¢ããªã±ã¼ã·ã§ã³ããæå ã«ã²ã¨ã¤ãæã£ã¦ããããæ°åã§ããã£ãã®ã§ããGAE + ã«ã¹ã¿ã ãã¡ã¤ã³ + SSL + éçã³ã³ãã³ãé ä¿¡ãã®çµã¿åãããããã®ä¼æ¥ãå©ç¨ãã¦è©¦ãã¦ã¿ãã
èªåç¨ã«ä½æ¥ãããã¤ãã§ã«ããã°ã®ãã¿ã«ããªãããªãã¨ãã¹ã¯ãªã¼ã³ã·ã§ããã交ãã¤ã¤æé ãã¡ã¢ããªããä½æ¥ããã¦ããã ãã©ããããä¸è¦ã ã£ããããããªããããã«è¶ ç°¡åã ã£ããæã¯ãæåã§è¨¼ææ¸ããã¦ãã®ããããã£ãã大å¤ã ã£ãã®ã«ãªã...ãããªãã¦ããããªè害æããµããææ³ã°ããåºã¦ãããããç°¡åã ã£ãã®ã§ãã¿ãªããããã²ã試ãããã
- GAEã®ã«ã¹ã¿ã ãã¡ã¤ã³ç¡æSSLåã»æé
- 1. æ°è¦ããã¸ã§ã¯ãã®ä½æ
- 2. ãªã¼ã¸ã§ã³ã®é¸æ
- 3. ç»é¢ã®æ示ï¼ãã¥ã¼ããªã¢ã«ï¼ã«å¾ã
- 4. [è¨å®] ã¿ããéã
- 5. 使ç¨ããããã¡ã¤ã³ã®è¨å®ããã
- 6. ãã¡ã¤ã³ã®ç¢ºèªãå®äº
- 7. è¤æ°ãã¡ã¤ã³ã®ãããã³ã°ã®ç¢ºèª
- 8. DNS ã¬ã³ã¼ãã®æ´æ°
- 9. ãããçµããï¼
- 10. congrats!!
- éçãã¡ã¤ã«ãå«ãããã¸ã§ã¯ãã®ãããã¤
- GAE ã¯æé«ï¼
- åè
GAEã®ã«ã¹ã¿ã ãã¡ã¤ã³ç¡æSSLåã»æé
ã¾ã㯠GAE ã¢ããªã±ã¼ã·ã§ã³ã«ã«ã¹ã¿ã ãã¡ã¤ã³ããã¦ã¦ãããã SSLï¼httpsï¼åããã¨ããããã対象㮠GAE ã¢ããªã±ã¼ã·ã§ã³ãç¨æããã¨ãããããã£ã¦ããã©ãããã¯æ¬çãããªãã®ã§ããã£ã¨ããã¾ããã㨠GCP ã¢ã«ã¦ã³ãã»Billing ã¢ã«ã¦ã³ãã¯æã£ã¦ãï¼è¨å®ããã¦ãï¼åæã§ã
1. æ°è¦ããã¸ã§ã¯ãã®ä½æ
ããã
ã§ä½ããä»æ§ãæã¨å¤ãã£ã¦ãªããã°ãããã¸ã§ã¯ãåã¯ã°ãã¼ãã«ã§ã¦ãã¼ã¯ã§ããå¿ è¦ããããï¼ä»ã¯ãããã¸ã§ã¯ãIDãã£ã¦ã®ãå¥ã«ããããæ°ã«ããªãã¦ã大ä¸å¤«ããï¼ï¼
2. ãªã¼ã¸ã§ã³ã®é¸æ
æ±äº¬ãªã¼ã¸ã§ã³ãããã¨ãå¥è·¡ã§ãã...ãã
3. ç»é¢ã®æ示ï¼ãã¥ã¼ããªã¢ã«ï¼ã«å¾ã
å°æ¥çã«ã¯éçãµã¤ãããããã¤ãããã®ã ãã©ãå·®ãå½ããã¯ã«ã¹ã¿ã ãã¡ã¤ã³ã®SSLåã試ãããã®ã§ããã¥ã¼ããªã¢ã«ã®æ示ã«å¾ã£ã¦ä½æ¥ãé²ãã¦ãããå 容ã¨ãã¦ã¯ããµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤ã«ãªãã
é¸æè¨èªã«ãããã®ãããããªããã©ããã¥ã¼ããªã¢ã«ãå®äºããã http://<project-name>.appspot.com
ã§ä»¥ä¸ã®ãããªç»é¢ãéããããã«ãªã£ã¦ãã¯ãã
4. [è¨å®] ã¿ããéã
ã«ã¹ã¿ã ãã¡ã¤ã³ã®è¨å®ãã§ããããªã¿ããããã横㮠[SSL証ææ¸] ã®ã¿ãããã¨ã§ä½¿ãã®ããªã
ã¨ããããããã§ã¯ [ã«ã¹ã¿ã ãã¡ã¤ã³ã追å ] ãã¿ã³ãæ¼ãã
5. 使ç¨ããããã¡ã¤ã³ã®è¨å®ããã
ããã¨ãä¸ã®ãããªè¡¨ç¤ºã«ãªãã
<project-name>.appspot.com
ã®ä»£ããã«ä½¿ããããã¡ã¤ã³ï¼ããã§ã¯ hoge.example.com
ã¨ããï¼ãå
¥åãã[確èª] ãã¿ã³ãæ¼ããããã¨å¥ã¿ããéãã¦ããã®ãã¡ã¤ã³ã®ææ権ã®ç¢ºèªã¨ãã®ããã¼ã«å
¥ãã
ããããã¯ãTXTã¬ã³ã¼ãã追å ããããã¦ãã¡ã¤ã³ã®ææ権確èªãå®äºããããããã¾ã§ã¯ GAE åºæã®è©±ã§ã¯ãªãã®ã§ããã§ã¯å²æã
6. ãã¡ã¤ã³ã®ç¢ºèªãå®äº
確èªå®äºï¼4. ã§éããå¥ã¿ãã¯ãã®ã¾ã¾éãã¡ãã£ã¦ãããå ã®ã¿ãã®æ¹ã«ãã [ç¶è¡] ãã¿ã³ãæ¼ãã
7. è¤æ°ãã¡ã¤ã³ã®ãããã³ã°ã®ç¢ºèª
åã¯ä»å㯠hoge.example.com
ã <project-name.appspot.com>
ã«å²ãå½ã¦ããããããã§è¯ãã£ãã®ã ãã©ãã©ãããè¤æ°ã®ãã¡ã¤ã³ã®å²ãå½ã¦ãã§ãããããï¼ 5. ã§å
¥åãããã¡ã¤ã³ã«ã¯ããã¤ããããã¡ã¤ã³ï¼ example.com
ï¼ã®æå®ãåºæ¥ããã ãããï¼
ã¨ããããä»å㯠1:1 ã®ãããã³ã°ãã§ããã°ããã§ããã£ãã®ã§ãä¸è¦ãªãã®ãåãé¤ã㦠[ãããã³ã°ãä¿å] ã
OKï¼ã[ç¶è¡] ï¼
8. DNS ã¬ã³ã¼ãã®æ´æ°
ä»åº¦ã¯ä¸ã®ãããªè¡¨ç¤ºãã§ãã
A ã¬ã³ã¼ã㨠AAAA ã¬ã³ã¼ããã対象ã®ãã¡ã¤ã³ãç»é²ãã¦ãã DNS ã«è¿½å ããã
9. ãããçµããï¼
ããã¨ããSSLã»ãã¥ãªãã£ãã®ã¨ããããGoogleã管çãèªåæ´æ°ãã¨ãªãããã¼ãã£ã³ã°ã¢ãã¡ã¼ã·ã§ã³ã表示ããã¦......ãã
ãã°ããå¾ ã¤ã¨ãã管ç証ææ¸ãæå¹ã«ãªãã¾ããããã¡ãã»ã¼ã¸ãï¼ [SSL証ææ¸] ã®ã¿ãã¯åºçªããªãã£ãï¼
10. congrats!!
ã¢ã¶ã¤ã¯ã§ãªãã®ãã£ã¡ãããããã¨ã¯æããã©ãã¡ããã¨ã«ã¹ã¿ã ãã¡ã¤ã³ã§ã㤠https
㪠URL ã§ãããã»ã©ã®ãHello, World!!ããã¡ããã¨è¡¨ç¤ºããã¦ããï¼
ãã¨ã¯ããã«ãæ¬æ¥åºãããéçãµã¤ãã®ãã¡ã¤ã«ãªã©ãå«ãããã¸ã§ã¯ãããããã¤ããã°ããã ããã£ã¦ãã¨ã«ãªãã
éçãã¡ã¤ã«ãå«ãããã¸ã§ã¯ãã®ãããã¤
1. SDK ã®æºå
ãããã¤ã«ã¯ SDK ãããã¨ãããã¾ã ã®äººã¯ãããããã¦ã³ãã¼ãã»ã¤ã³ã¹ãã¼ã«ãã㦠gcloud
ã®æºåããããã®å¾ GAE ã® SDK ããããããã¦ã³ãã¼ãã»ã¤ã³ã¹ãã¼ã«ããã
2. ãããã¤å¯¾è±¡ã¨ãªããã¡ã¤ã«é¡ãç¨æãã
ä»åã¯ã試ããªã®ã§ãæä½éã£ã¦ãã¨ã§é©å½ãªãã£ã¬ã¯ããªï¼PRJ_DIR
ï¼ãæã£ã¦ããã«ä»¥ä¸ã®ãã®ãæå
ã«ç¨æããã
PRJ_DIR/app.yaml
- ããã¸ã§ã¯ãå®ç¾©ãã¡ã¤ã«
PRJ_DIR/hello.go
- ã¢ããªã±ã¼ã·ã§ã³
PRJ_DIR/static/html/index.html
- ãããé ä¿¡ããéçã³ã³ãã³ãã«è¦ç«ã¦ã
ã¾ã㯠app.yaml
ã
<project-name>
ã¯ããã¸ã§ã¯ãåã«ç½®ãæãããversion
ã¯å¾ã§ãåºã¦ãããã©ããã¼ã¸ã§ã³çªå·ã¿ãããªããã handlers
ã®ã¨ããã§ãã«ã¼ãã£ã³ã°çãªãã®ãå®ç¾©ãããä¸ã®ä¾ã ã¨ãã«ã¼ã /
ã¸ã®ã¢ã¯ã»ã¹ã¯ static/html/index.html
ãé
ä¿¡ãããã以å¤ã¯ã¢ããªã±ã¼ã·ã§ã³ã«ãã¿ãããªæãããªã
ãããªã¢ããªã±ã¼ã·ã§ã³å´ hello.go
ã¯ãã·ã³ãã«ã«ã
ã«ã¼ã /
以å¤ã®ã¢ã¯ã»ã¹ã®ãã¡ã /hello
ããã³ããªã³ã°ã㦠Hello, world! by go-app
ãã¬ã¹ãã³ã¹ããã¦ããã
æå¾ã«éçã³ã³ãã³ãã§ãã static/html/index.html
ã
説æä¸è¦ã§ãããï¼
3. ãããã¤ã®å®è¡
ä¸è¨ã®ãã¡ã¤ã«é¡ãç½®ãã¦ãã WORK_DIR
å
㧠goapp deploy
ãå®è¡ãååå®è¡æã«ã¯ãã©ã¦ã¶ãéããèªè¨¼å¦çãæã¾ãã
$ goapp deploy 08:46 PM Application: <project-name>; version: 100 08:46 PM Host: appengine.google.com 08:46 PM Starting update of app: <project-name>, version: 100 08:46 PM Getting current resource limits. 08:46 PM Scanning files on local disk. 08:46 PM Cloning 1 static file. 08:46 PM Cloning 2 application files. 08:46 PM Uploading 3 files and blobs. 08:46 PM Uploaded 3 files and blobs. 08:46 PM Compilation starting. 08:46 PM Compilation: 1 files left. 08:47 PM Compilation completed. 08:47 PM Starting deployment. 08:47 PM Checking if deployment succeeded. 08:47 PM Deployment successful. 08:47 PM Checking if updated app version is serving. 08:47 PM Completed update of app: <project-name>, version: 100
ããã§ãããã¤å®äºãï¼GAE ã«ä½ãããããã¤ããã®ãä¹ ãã¶ãã ã£ãã®ã§ãæããæããããªã£ã¦ãã¾ã£ãï½ï¼
4. ãã¼ã¸ã§ã³ã®åãæ¿ã
ãããã¤ãå®äºããããã¨ãã£ã¦ãããã«ãã®å 容ã«ã¢ã¯ã»ã¹ã§ããããã«ãªãããã§ã¯ãªããWeb ã³ã³ã½ã¼ã«ã«æ»ãããµã¤ãã¡ãã¥ã¼ãã [ãã¼ã¸ã§ã³] ãé¸ã¶ã
ããã»ã© version: 100
ã¨ãã¦ãããã¤ãããã®ããªã¹ãã¢ããããã¦ããã®ã¯ããããã©ããã©ãã£ãã¯å²ãå½ã¦
ã¨ããã¨ããã 0%
ã«ãªã£ã¦ããããããåãæ¿ããªããã°ãããªãã
ãã¼ã¸ã§ã³ 100
ã®ãã®ã«ãã§ãã¯ãå
¥ããç¶æ
ã§å³ä¸ã® [ãã©ãã£ãã¯ã移è¡] ãæ¼ãã¦......ãã
åãæ¿ãã£ãï¼
5. ã¢ã¯ã»ã¹ãã¦ç¢ºèªãã¦ã¿ã
ãã£ãã確èªãã¦ã¿ããã¾ãã¯ã«ã¼ã /
ã«ã¢ã¯ã»ã¹ããå ´åã®è¡¨ç¤ºãä¸ã§ä½ã£ã index.html
ã表示ããã¦ããã°ããã
OKï¼
ã¤ã¥ã㦠/hello
ã«ã¢ã¯ã»ã¹ãã¦ã¿ããGo ã§æ¸ããã¢ããªã±ã¼ã·ã§ã³ããã®ã¬ã¹ãã³ã¹ã確èªã§ããã°OKã
ãã¡ãã OKï¼ä»¥ä¸ï¼
GAE ã¯æé«ï¼
ã¨ããããã§ãGAE ããã¸ã§ã¯ãã«å¯¾ããã«ã¹ã¿ã ãã¡ã¤ã³ã®è¨å®ã¨SSLåãããã¦ç°¡åãªéçã³ã³ãã³ãã®ãããã¤ã®æé ã§ããããã SSL åã«ã¤ãã¦ã¯ãä½æ¥éçã«ã¯ã«ã¹ã¿ã ãã¡ã¤ã³ã®è¨å®ã¨åãåéã§ãGoogle ããã "ã¤ãã§ã«" "åæã«" 証ææ¸ããã¦ã¦ããã¦ãã ããã¨ãããããã
åé ã§ãæ¸ãããã©ããéçãµã¤ãã®é
ä¿¡ããããã ãããã§ãã«ã¹ã¿ã ãã¡ã¤ã³ã§SSLåããã¦ãå¿
è¦ã¯ãããã¿ãããªã¨ãã®ããã£ã¨ãæ軽ãªæ段ã®çé ã¨ã㦠GAE ãèºãåºããããããªããªã¼ãã¨æã£ããããã§ãã /hello
ã¿ãããªã¢ããªã±ã¼ã·ã§ã³ãåããããããªå ´åã«ã¯ãã¢ã¯ã»ã¹ã«å¿ãã¦ã¤ã³ã¹ã¿ã³ã¹ãèµ·åããããç¸å¿ã®èª²éãçºçãããã©ãéçã³ã³ãã³ãã¸ã®ã¢ã¯ã»ã¹ã®å ´åã¯ããããªãï¼ãã¨ãã£ã¦å®å
¨ã«ç¡æã£ã¦ããã§ããªãã®ã§ããã¯æ³¨æï¼ã
å人çã«ãã¡ããã©ãã¾ Go ã§ã® Web ã¢ããªã±ã¼ã·ã§ã³éçºã®åå¼·ããã¦ããã¨ããã§ããããçé㧠spin-up ãã Go ã® GAE ã¨ã®ç¸æ§ã¯æ群ãã¨ãããã¨ã§ãä»åã®ããããã¾ããããã GAE ã§ããããããã¨ãããããªãããè¡åã«ç§»ãããããã£ããã«ãããã¨æãã¾ãï¼