{"id":12678,"date":"2017-08-25T13:00:43","date_gmt":"2017-08-25T04:00:43","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=12678"},"modified":"2017-08-25T15:19:36","modified_gmt":"2017-08-25T06:19:36","slug":"hello-app-engine-go-%e8%a8%80%e8%aa%9e%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6-google-app-engine-%e5%85%a5%e9%96%80%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=12678","title":{"rendered":"Hello, App Engine! GO \u8a00\u8a9e\u3092\u4f7f\u3063\u3066 Google App Engine \u5165\u9580\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u5f53\u793e\u3067\u306f GCP \uff08 Google Cloud Platform \uff09 \u3092\u4f7f\u7528\u3059\u308b\u6a5f\u4f1a\u304c\u5897\u3048\u3066\u304d\u3066\u3044\u307e\u3059\u3002<br \/>\nGCP \u3068\u306f\u3001 Google \u304c\u63d0\u4f9b\u3059\u308b\u3001\u69d8\u3005\u306a\u30a4\u30f3\u30d5\u30e9\u57fa\u76e4\u3084 API \u3092\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<br \/>\n\u305d\u306e\u4e2d\u306e\u4e00\u3064\u304c GAE ( Google App Engine ) \u3067\u3059\u3002<\/p>\n<p>GAE \u3068\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u3084\u74b0\u5883\u69cb\u7bc9\u306a\u3069\u306f\u5168\u3066 Google \u306b\u3084\u3063\u3066\u3082\u3089\u3044\u3001<br \/>\n\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3051\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3001\u30af\u30e9\u30a6\u30c9\u3067\u5b9f\u884c\u3067\u304d\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001 GAE \u306e\u74b0\u5883\u69cb\u7bc9\u306b\u59cb\u307e\u308a\u3001\u5b9a\u756a\u306e\u300cHello,\uff57orld\uff01\u300d\u3092\u3084\u3063\u3066\u307f\u307e\u3059\uff01<\/p>\n<p><!--more--><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\"> GAE \u3068\u306f<\/h3>\n<\/div>\n<p>GAE \u3068\u306f\u3001 PaaS \uff08 Platform as a Service \uff09 \u306b\u5206\u985e\u3055\u308c\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<br \/>\n\u4f5c\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u884c\u74b0\u5883\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u30b5\u30fc\u30d0\u30fc\u7ba1\u7406\u304c\u4e0d\u8981\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3084\u30b9\u30c8\u30ec\u30fc\u30b8\u3082\u5897\u6e1b\u306b\u5408\u308f\u305b\u3066\u30b9\u30b1\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30c7\u30d7\u30ed\u30a4\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\u3055\u3089\u306b\u3001cron\u3084\u30b8\u30e7\u30d6\u30b9\u30b1\u30b8\u30e5\u30fc\u30ea\u30f3\u30b0\u306e\u6a5f\u80fd\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3055\u3089\u306b\u3055\u3089\u306b\u3001\u7121\u6599\u67a0\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u74b0\u5883\u306f2\u7a2e\u985e\u3042\u308a\u3001 Standard \u3068 Flexible \u3067\u3059\u3002<br \/>\nFlexible Environment \u3067\u4f7f\u7528\u3067\u304d\u308b\u8a00\u8a9e\u306f\u4ee5\u4e0b\u3067\u3059\u3002<br \/>\n \u30fbPython<br \/>\n \u30fbJava<br \/>\n \u30fbPHP<br \/>\n \u30fbGO<br \/>\n \u30fbNode.js<br \/>\n \u30fbRuby<br \/>\n \u30fb.NET<\/p>\n<p>\u8981\u306f\u3001\u597d\u304d\u306a\u8a00\u8a9e\u304c\u4f7f\u3048\u3066\u3001\u30a2\u30d7\u30ea\u958b\u767a\u306b\u5c02\u5ff5\u3067\u304d\u308b\u74b0\u5883\u3067\u3059\u3002<\/p>\n<p>\u4f55\u306f\u3068\u3082\u3042\u308c\u3001\u7c21\u5358\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01\uff01<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<\/div>\n<p>\u307e\u305a\u306f <a href=\"https:\/\/console.cloud.google.com\" target=\"_blank\" rel=\"nofollow\">GCP \u306e\u7ba1\u7406\u753b\u9762<\/a> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<br \/>\n\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u306a\u3044\u4eba\u306f\u30a2\u30ab\u30a6\u30f3\u30c8\u4f5c\u6210\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n\u753b\u9762\u5de6\u4e0a\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u9078\u629e\u3092\u958b\u304d\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" src=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2017\/08\/97a03f3e962ec159ac09d84b0194d283.png\" alt=\"\u30d5\u309a\u30ed\u30b7\u3099\u30a7\u30af\u30c8\u9078\u629e\" width=\"380\" height=\"46\" class=\"aligncenter size-full wp-image-12742\" \/><\/p>\n<p>\u6b21\u306b\u65b0\u898f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" src=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2017\/08\/7d79b501613ca3b3c7123845c5c185c2-1.png\" alt=\"\u30d5\u309a\u30ed\u30b7\u3099\u30a7\u30af\u30c8\u4f5c\u6210\" width=\"1024\" height=\"521\" class=\"aligncenter size-full wp-image-12745\" \/><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u958b\u767a\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b<\/h3>\n<\/div>\n<p>\u958b\u767a\u3059\u308b\u306b\u306f\u3001 gcloud \u30b3\u30de\u30f3\u30c9\u304c\u5fc5\u8981\u3067\u3059\u306e\u3067\u3001\u74b0\u5883\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u3053\u306e\u8a18\u4e8b\u3067\u306f Mac \u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/cloud.google.com\/sdk\/docs\/quickstart-mac-os-x\" target=\"_blank\" rel=\"nofollow\">Cloud SDK ( GCP \u958b\u767a\u7528\u306eSDK)<\/a> \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3044\u304d\u307e\u3059\uff01<\/p>\n<h4 style=\"text-align: left; border-bottom: 1px solid #009688;\">1. Python \u306e\u78ba\u8a8d<\/h4>\n<p>Python\u304c\u5165\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre><code>python -V\n<\/code><\/pre>\n<p>\u203bPython\u306f2.7\u304c\u5fc5\u8981\u3067\u3059<br \/>\n\u203bpyenv\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u3001 Mac \u306e OS \u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u3001<a href=\"https:\/\/github.com\/pyenv\/pyenv\/wiki\/Common-build-problems\" target=\"_blank\" rel=\"nofollow\">\u3053\u3061\u3089<\/a>\u306b\u8f09\u3063\u3066\u3044\u308b\u5bfe\u51e6\u65b9\u304c\u5fc5\u8981\u306a\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059<\/p>\n<h4 style=\"text-align: left; border-bottom: 1px solid #009688;\">2. SDK \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h4>\n<p>\u81ea\u5206\u306e\u30de\u30b7\u30f3\u306b\u3042\u3063\u305f SDK \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3057\u307e\u3059\u3002<br \/>\n\u5c55\u958b\u5f8c\u306b\u4efb\u610f\u306e\u5834\u6240\u306b google-cloud-sdk \u30d5\u30a9\u30eb\u30c0\u6bce\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<h4 style=\"text-align: left; border-bottom: 1px solid #009688;\">3. \uff08\u7701\u7565\u53ef\uff09 SDK \u30c4\u30fc\u30eb\u3092\u6709\u52b9\u5316<\/h4>\n<p>google-cloud-sdk \u30d5\u30a9\u30eb\u30c0\u306e\u4e0a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001 gcloud \u30b3\u30de\u30f3\u30c9\u306e\u88dc\u5b8c\u304c\u6709\u52b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>.\/google-cloud-sdk\/install.sh\n<\/code><\/pre>\n<h4 style=\"text-align: left; border-bottom: 1px solid #009688;\">4. SDK \u306e\u521d\u671f\u5316<\/h4>\n<p>\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n\u9014\u4e2d\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084\u30c7\u30d5\u30a9\u30eb\u30c8\u30be\u30fc\u30f3\u306b\u95a2\u3057\u3066\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre><code>gcloud init\n<\/code><\/pre>\n<h4 style=\"text-align: left; border-bottom: 1px solid #009688;\">5. gcloud \u306e\u8a2d\u5b9a\u78ba\u8a8d<\/h4>\n<p>\u4ee5\u4e0b\u3067\u3001 gcloud \u3084\u95a2\u9023\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>gcloud -v\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u3067\u3001 gcloud \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084\u30a2\u30ab\u30a6\u30f3\u30c8\u3001\u30be\u30fc\u30f3\u306a\u3069\u306e\u8a2d\u5b9a\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>gcloud info\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30a2\u30d7\u30ea\u3092\u4f5c\u308b<\/h3>\n<\/div>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u3063\u3066\u884c\u304d\u307e\u3059\u3002<br \/>\n\u3068\u306f\u8a00\u3063\u3066\u3082\u3001\u4eca\u56de\u306f\u5165\u9580\u7de8\u306a\u306e\u3067\u3000github \u304b\u3089\u30af\u30ed\u30fc\u30f3\u3057\u3066\u304d\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/cloud.google.com\/appengine\/docs\/standard\/go\/quickstart\" target=\"_blank\" rel=\"nofollow\">\u3053\u3061\u3089<\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001 helloworld \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3001\u4ee5\u4e0b\u306e2\u30d5\u30a1\u30a4\u30eb\u304c\u914d\u7f6e\u3055\u308c\u307e\u3059\u3002<br \/>\n \u30fbapp.yaml<br \/>\n \u30fbhello.go<\/p>\n<pre><code>git clone -b part1-helloworld https:\/\/github.com\/GoogleCloudPlatform\/appengine-guestbook-go.git helloworld\n<\/code><\/pre>\n<p>app.yaml \u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3002<br \/>\nhello.go \u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u672c\u4f53\u3067\u3059\u3002<br \/>\n\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308c\u3070\u300cHello, world!\u300d\u3068\u8868\u793a\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>helloworld \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre><code>cd helloworld\n<\/code><\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30a2\u30d7\u30ea\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/h3>\n<\/div>\n<p>\u4ee5\u4e0b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u30a2\u30d7\u30ea\u306e\u52d5\u4f5c\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>dev_appserver.py app.yaml\n<\/code><\/pre>\n<p>\u5b9f\u884c\u5f8c\u306b <a href=\"http:\/\/localhost:8080\/\" target=\"_blank\">http:\/\/localhost:8080\/<\/a> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u306b\u300cHello, world!\u300d \u3068\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u30a2\u30d7\u30ea\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b<\/h3>\n<\/div>\n<p>\u3067\u306f\u3001\u4f5c\u6210\u3057\u305f\u30a2\u30d7\u30ea\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>gcloud app deploy\n<\/code><\/pre>\n<p>\u30c7\u30d7\u30ed\u30a4\u5f8c\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u52d5\u4f5c\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>gcloud app browse\n<\/code><\/pre>\n<p>\u3053\u3061\u3089\u3082\u30d6\u30e9\u30a6\u30b6\u306b\u300cHello, world!\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u7ba1\u7406\u753b\u9762\u4e0a\u3067\u3082\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u307e\u3068\u3081<\/h3>\n<\/div>\n<p>Google \u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u30af\u30a4\u30c3\u30af\u30b9\u30bf\u30fc\u30c8\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u5927\u4f53\u306e\u611f\u899a\u306f\u3064\u304b\u3081\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u7c21\u5358\u306b GO \u8a00\u8a9e\u3092\u4f7f\u3063\u305f GAE \u306e\u5165\u9580\u7de8\u3092\u884c\u3044\u307e\u3057\u305f\u3002<br \/>\n\u6b21\u56de\u306f GO \u8a00\u8a9e\u3067\u3001\u3082\u3063\u3068\u8907\u96d1\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u4f5c\u6210\u306e\u8a18\u4e8b\u3092\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u793e\u3067\u306f GCP \uff08 Google Cloud Platform \uff09 \u3092\u4f7f\u7528\u3059\u308b\u6a5f\u4f1a\u304c\u5897\u3048\u3066\u304d\u3066\u3044\u307e\u3059\u3002 GCP \u3068\u306f\u3001 Google \u304c\u63d0\u4f9b\u3059\u308b\u3001\u69d8\u3005\u306a\u30a4\u30f3\u30d5\u30e9\u57fa\u76e4\u3084 API \u3092\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002 \u305d\u306e\u4e2d\u306e\u4e00\u3064\u304c GAE ( Google App Engine ) \u3067\u3059\u3002 GAE \u3068\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u3084\u74b0\u5883\u69cb\u7bc9\u306a\u3069\u306f\u5168\u3066 Google \u306b\u3084\u3063\u3066\u3082\u3089\u3044\u3001 \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3051\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3001\u30af\u30e9\u30a6\u30c9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12740,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12678"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=12678"}],"version-history":[{"count":18,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12678\/revisions"}],"predecessor-version":[{"id":12821,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12678\/revisions\/12821"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/12740"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=12678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=12678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=12678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}