{"id":34720,"date":"2023-06-08T17:00:45","date_gmt":"2023-10-31T19:36:29","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/"},"modified":"2024-04-30T07:54:13","modified_gmt":"2024-04-29T23:54:13","slug":"%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/","title":{"rendered":"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386"},"content":{"rendered":"<p>\u4f7f\u7528Docker Compose\u8f7b\u677e\u642d\u5efa\u6700\u65b0\u7248\u672c\u7684Google App Engine Go\u8fd0\u884c\u65f6\u5f00\u53d1\u73af\u5883\u7684\u6545\u4e8b\uff0c\u6216\u8005\u4f20\u64ad\u53ef\u6210\u672c\u5408\u7406\u8fd0\u8425\u670d\u52a1\u5668\u7684App Engine\u7684\u6545\u4e8b\u3002<\/p>\n<h1>\u592a\u957f\u4e86\uff0c\u6ca1\u770b\u3002<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u74b0\u5883\u69cb\u7bc9<\/ul>\n<\/li>\n<\/ul>\n<p>https:\/\/github.com\/pistatium\/appgengine-go112-datastore-docker-compose<br \/>\n\u52d5\u304f\u30b5\u30f3\u30d7\u30eb\u306f\u3053\u3061\u3089\u3002<\/p>\n<p>docker-compose up -d \u3067\u958b\u767a\u74b0\u5883\u304c\u7acb\u3061\u4e0a\u304c\u308a\u307e\u3059\u3002<br \/>\n\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u3059\u308b\u306a\u308a\u3054\u81ea\u7531\u306b\u3002<\/p>\n<p>App Engine + Datastore \u306e\u69cb\u6210<\/p>\n<p>\u975e\u5e38\u306b\u5b89\u4fa1\u3067\u306e\u30b5\u30fc\u30d0\u30fc\u904b\u7528\u304c\u53ef\u80fd\u3002<br \/>\n\u7b2c\u4e00\u4e16\u4ee3\u304b\u3089\u7b2c\u4e8c\u4e16\u4ee3\u306e\u79fb\u884c\u306f\u3061\u3087\u3063\u3068\u3064\u3089\u3044\u3002<br \/>\n\u4eca\u304b\u3089\u3084\u308b\u306a\u3089\u7b2c\u4e8c\u4e16\u4ee3\u306e Go 1.12 \u3092\u4f7f\u3046\u3068\u826f\u3055\u305d\u3046\u3002<\/p>\n<hr \/>\n<h2>\u5e94\u7528\u5f15\u64ce\u7410\u4e8b<\/h2>\n<p>\u5982\u679c\u53ea\u5bf9\u672c\u5730\u5f00\u53d1\u73af\u5883\u611f\u5174\u8da3\u7684\u8bfb\u8005\u53ef\u4ee5\u7565\u8fc7\u672c\u7ae0\u8282\u3002<\/p>\n<h3>\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528 App Engine\uff1f<\/h3>\n<p>2011\u5e74\u3054\u308d\u304b\u3089\u81ea\u524d\u306e\u30d6\u30ed\u30b0\u30b7\u30b9\u30c6\u30e0\u3092 App Engine(Python) \u4e0a\u306b\u69cb\u7bc9\u3057\u3066\u904b\u7528\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30b5\u30fc\u30d0\u30ec\u30b9\u3067\u30e1\u30f3\u30c6\u3044\u3089\u305a\u3001\u3068\u304b\u6025\u306a\u30a2\u30af\u30bb\u30b9\u5897\u3067\u3082\u5bfe\u5fdc\u3057\u3084\u3059\u3044\u3001\u306a\u3069\u306a\u3069\u30e1\u30ea\u30c3\u30c8\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u4e00\u756a\u306e\u5229\u70b9\u306f \u904b\u7528\u30b3\u30b9\u30c8\u306e\u4f4e\u3055 \u3067\u3059\u3002<br \/>\nApp Engine \u306f\u30b5\u30fc\u30d0\u30ec\u30b9\u69cb\u6210\u304c\u4e00\u822c\u7684\u306b\u306a\u308b\u524d\u304b\u3089\u5f93\u91cf\u8ab2\u91d1\u65b9\u5f0f\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u63d0\u4f9b\u3057\u3066\u3044\u3066\u3001\u7528\u9014\u306b\u3088\u3063\u3066\u306f\u6708\u984d\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u3092\u501f\u308a\u308b\u3088\u308a\u5b89\u304f\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u5b66\u751f\u306e\u9803\u304b\u3089\u6d3b\u7528\u3057\u3066\u3044\u305f\u306e\u3067\u30e9\u30f3\u30cb\u30f3\u30b0\u30b3\u30b9\u30c8\u3092\u6291\u3048\u308b\u304b\u306f\u91cd\u8981\u3067\u3057\u305f\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1ee537434c4406c17ea1\/8-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u81ea\u5206\u306e\u30d6\u30ed\u30b0 \u306e\u904b\u7528\u306b\u304b\u304b\u3063\u3066\u3044\u308b\u8cbb\u7528\u63a8\u79fb\u306a\u306e\u3067\u3059\u304c\u3001\u3060\u3044\u305f\u3044 2000PV\/\u6708 \u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u3055\u3070\u3044\u3066\u6570\u5341\u5186\/\u6708\u7a0b\u5ea6\u306b\u6291\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30ec\u30f3\u30bf\u30eb\u30d6\u30ed\u30b0\u30b5\u30fc\u30d3\u30b9\u3067\u3082\u5e83\u544a\u6d88\u3059\u3060\u3051\u3067\u6570\u767e\u5186\u639b\u304b\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u5727\u5012\u7684\u306a\u30b3\u30b9\u30d1\u3067\u3059\u306d\u3002<br \/>\nPV\u3084\u6a5f\u80fd\u306b\u3088\u3063\u3066\u306f App Engine \u304c\u63d0\u4f9b\u3059\u308b \u7121\u6599\u67a0\u5185\u3067\u306e\u904b\u7528 \u3082\u53ef\u80fd\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u9879\u3002<\/p>\n<p>Web\u30b5\u30fc\u30d0\u30fc\u30ea\u30bd\u30fc\u30b9 (App Engine)<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 (Datastore)<\/p>\n<p>\u30c9\u30e1\u30a4\u30f3 + SSL (https:\/\/\u3007\u3007.appspot.com)<\/p>\n<p>\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u3068\u306f\u3044\u3048\u30c9\u30e1\u30a4\u30f3\u304c\u542b\u307e\u308c\u3066\u308b\u306e\u304c\u5f37\u3044\u3067\u3059\u306d\u3002<br \/>\nGoogle Cloud Run \u3084 Amazon API Gateway \u304c\u5410\u304d\u51fa\u3059\u6a5f\u68b0\u7684\u306a\u30c9\u30e1\u30a4\u30f3\u3088\u308a\u3082\u6574\u3063\u305f\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\nappspot.com \u3068\u3044\u3046\u30eb\u30fc\u30c8\u30c9\u30e1\u30a4\u30f3\u3082\u500b\u4eba\u306e\u6210\u679c\u7269\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u8a70\u307e\u3063\u3066\u308b\u611f\u3058\u304c\u3057\u3066\u60aa\u304f\u306a\u3044\u3067\u3059\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u4ee5\u4f4e\u5ec9\u7684\u6210\u672c\u8fd0\u8425\u535a\u5ba2\uff0c\u6211\u5f3a\u70c8\u63a8\u8350\u8003\u8651\u4f7f\u7528App Engine\u3002<br \/>\n\u901a\u8fc7\u81ea\u5df1\u642d\u5efa\u535a\u5ba2\uff0c\u4f60\u4e5f\u80fd\u81ea\u7136\u5730\u638c\u63e1\u7f51\u9875\u5e94\u7528\u7a0b\u5e8f\u7684\u77e5\u8bc6\u3002<\/p>\n<h3>\u4e91\u6570\u636e\u5b58\u50a8\uff08Firestore\u6570\u636e\u5b58\u50a8\u6a21\u5f0f\uff09<\/h3>\n<p>App Engine \u3092\u5229\u7528\u3059\u308b\u4e0a\u3067\u6b20\u304b\u305b\u306a\u3044\u306e\u304c Datastore \u3068\u547c\u3070\u308c\u308b NoSQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3059\u3002<br \/>\nCloud SQL \u306a\u3069\u3092\u4f7f\u3063\u3066 RDB \u3068\u63a5\u7d9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u3044\u3064\u30a2\u30af\u30bb\u30b9\u3055\u308c\u308b\u304b\u308f\u304b\u3089\u306a\u3044\u72b6\u6cc1\u3067\u5e38\u6642\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8d77\u52d5\u3057\u3066\u7f6e\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u306f\u8cbb\u7528\u7684\u306b\u4e0d\u5229\u3067\u3059\u3002<br \/>\nDatastore \u3067\u3042\u308c\u3070\u8aad\u307f\u66f8\u304d\u306e\u30aa\u30da\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u307f\u306e\u8ab2\u91d1\u984d\u3067\u6e08\u307f\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b Datastore \u3001\u6614\u306f App Engine \u5c02\u7528\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u72ec\u7acb\u3057\u3001\u6700\u8fd1\u3067\u306f Cloud Firestore \u306b\u7d71\u5408\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1ee537434c4406c17ea1\/17-0.png\" alt=\"image.png\" \/><\/div>\n<p>GCP \u4e0a\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u7acb\u3061\u4e0a\u3052\u305f\u969b\u306f Cloud Firestore \u3092\u30cd\u30a4\u30c6\u30a3\u30d6\u30e2\u30fc\u30c9\u3067\u52d5\u304b\u3059\u304b\u3001Datastore\u30e2\u30fc\u30c9\u3067\u52d5\u304b\u3059\u304b\u805e\u304b\u308c\u307e\u3059\u3002\u3053\u306e\u9078\u629e\u80a2\u306f\u6392\u4ed6\u7684\u306a\u306e\u3067\u4e00\u5ea6\u8a2d\u5b9a\u3057\u3066\u3057\u307e\u3046\u3068\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u3059\u3054\u304f\u96d1\u306b\u3044\u3048\u3070\u30e6\u30fc\u30b6\u30fc\u304c\u76f4\u63a5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u306a\u3051\u308c\u3070 Datastore \u30e2\u30fc\u30c9\u3092\u4f7f\u3048\u3070\u3088\u3055\u305d\u3046\u3067\u3059\u3002\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5358\u4f4d\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30eb\u30fc\u30eb\u304c\u4f7f\u3048\u306a\u3044\u4ee3\u308f\u308a\u306b\u6027\u80fd\u9762\u3067\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u5e94\u7528\u5f15\u64ce\u8fd0\u884c\u65f6\u73af\u5883\u7684\u53d8\u5316<\/h3>\n<p>\u9577\u304f\u904b\u7528\u3057\u3066\u3044\u308b\u3068 App Engine \u306e\u5b9f\u884c\u74b0\u5883\u306e\u5909\u5316\u306b\u3082\u5bfe\u5fdc\u3057\u306a\u304f\u3066\u306f\u306a\u308a\u307e\u305b\u3093\u3002<br \/>\n\u30b5\u30fc\u30d0\u30ec\u30b9\u3060\u304b\u3089\u3068\u3044\u3063\u3066\u30e1\u30f3\u30c6\u306a\u3057\u3067\u305a\u3063\u3068\u52d5\u304f\u308f\u3051\u3067\u306f\u306a\u3044\u3088\u3046\u3067\u3059\u3002<br \/>\n\u81ea\u5206\u304c\u7d4c\u9a13\u3057\u305f\u3068\u3053\u308d\u3067\u3044\u3046\u3068 Python 2.5 \u306e\u74b0\u5883\u304c\u505c\u6b62\u3057\u305f\u308a\u3001\u30c7\u30d7\u30ed\u30a4\u306e\u30b3\u30de\u30f3\u30c9\u3084\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u5909\u308f\u3063\u305f\u308a\u3068\u3044\u3046\u3053\u3068\u304c\u6642\u3005\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002\u5148\u65e5\u3082\u30c7\u30d7\u30ed\u30a4\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u308910,000\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u4e0a\u9650\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3066\u7126\u308a\u307e\u3057\u305f\u2026\u3002<\/p>\n<p>\u305d\u3057\u3066 Python2 \u7cfb\u306f Python \u81ea\u4f53\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u4eca\u5e74\u3044\u3063\u3071\u3044\u3067\u7d42\u4e86\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306b\u5bfe\u3059\u308b App Engine \u5074\u304b\u3089\u306e\u30a2\u30ca\u30a6\u30f3\u30b9\u304c\u898b\u5f53\u305f\u3089\u306a\u3044\u3067\u3059\u304c\u3001\u305f\u3068\u3048\u5229\u7528\u3067\u304d\u3066\u3082\u4f7f\u308f\u306a\u3044\u65b9\u304c\u8ce2\u660e\u3067\u3059\u3002<\/p>\n<p>\u3068\u306a\u308b\u3068 Python 3\u7cfb\u3078\u4e57\u308a\u63db\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001Python 3.7 \u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u306f App Engine \u306e \u7b2c\u4e8c\u4e16\u4ee3 \u3068\u547c\u3070\u308c\u308b\u74b0\u5883\u3067\u5b9f\u884c\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3064\u307e\u308a \u4ed5\u69d8\u304c\u30ac\u30e9\u30c3\u3068\u5909\u308f\u3063\u3066\u3057\u307e\u3046 \u308f\u3051\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u307e\u3067\u306f App Engine \u7528\u306b\u30e9\u30a4\u30d6\u30e9\u30ea\u3084\u5b9f\u884c\u74b0\u5883\u304c\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3055\u308c\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u7b2c\u4e8c\u4e16\u4ee3\u306f\u7d20\u306e Python \u306b\u8fd1\u3044\u5f62\u3067\u52d5\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nApp Engine \u306b\u4f9d\u5b58\u3057\u306a\u3044\u72b6\u614b\u3067\u958b\u767a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u305f\u3081\u3001Docker\u3084\u5225\u306e\u30b7\u30b9\u30c6\u30e0\u3078\u306e\u79fb\u690d\u6027\u304c\u3042\u304c\u308a\u5b09\u3057\u3044\u53cd\u9762\u3001\u904e\u53bb\u306e App Engine \u306e\u30bd\u30fc\u30b9\u3092\u79fb\u884c\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3064\u3089\u307f\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u500b\u4eba\u7684\u306b\u306f Memcache \u3068\u547c\u3070\u308c\u308b\u30e1\u30e2\u30ea\u30ad\u30e3\u30c3\u30b7\u30e5\u6a5f\u80fd\u304c\u6d88\u3048\u3066\u3057\u307e\u3046\u306e\u304c\u53b3\u3057\u3044\u3067\u3059\u306d\u3002<br \/>\n\u7b2c\u4e00\u4e16\u4ee3\u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u3067\u3042\u308c\u3070\u30ad\u30e3\u30c3\u30b7\u30e5\u7528\u306e\u30b5\u30fc\u30d3\u30b9\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u305f\u5b89\u4fa1\u306b\u5229\u7528\u3067\u304d\u305f\u306e\u3067\u3059\u304c\u3001\u7b2c\u4e8c\u4e16\u4ee3\u3067\u306f SDK \u5074\u306b\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u306e\u3067 Cloud Memorystore \u306a\u3069\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3059\u308b\u5fc5\u8981\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\n\u8cbb\u7528\u6291\u3048\u3066\u904b\u7528\u3059\u308b\u305f\u3081\u306b\u306f\u3057\u3070\u3089\u304f\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u6a5f\u69cb\u6301\u305f\u306a\u3044\u307b\u3046\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u306d\u2026\u3002<br \/>\n\u4e00\u5fdc\u3001App Engine \u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u547c\u3070\u308c\u305f\u3068\u304d\u3001\u3057\u3070\u3089\u304f\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u751f\u5b58\u3057\u3066\u4f7f\u3044\u307e\u308f\u3057\u304c\u884c\u308f\u308c\u308b\u306e\u3067\u3001\u6574\u5408\u6027\u304c\u4e0d\u8981\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u76ee\u7684\u3067\u3042\u308c\u3070\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570(\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u5916\u5074)\u306b\u5165\u308c\u3066\u304a\u304f\u3053\u3068\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h3>\u524d\u5f80 Go \u7684\u8fd0\u884c\u65f6\u7cfb\u7edf<\/h3>\n<p>\u56e0\u4e3a\u6700\u8fd1\u6b63\u5728\u5b66\u4e60Go\u8bed\u8a00\uff0c\u6240\u4ee5\u6211\u8003\u8651\u5982\u679c\u91cd\u5199\u7684\u8bdd\uff0c\u4e0d\u8981\u7528Python\uff0c\u800c\u662f\u7528Go\u6765\u5199\u3002<br \/>\n\u5b83\u7684\u7f16\u8bd1\u901f\u5ea6\u5f88\u5feb\uff0c\u751f\u6210\u7684\u6784\u5efa\u7ed3\u679c\u4e5f\u5f88\u5c0f\uff0c\u6240\u4ee5\u5728\u670d\u52a1\u5668\u7aef\u4f7f\u7528\u5f88\u65b9\u4fbf\u3002\u867d\u7136\u8868\u8fbe\u80fd\u529b\u6709\u70b9\u5f31\uff0c\u6709\u65f6\u5019\u63cf\u8ff0\u4f1a\u6bd4\u8f83\u56f0\u96be\uff0c\u4f46\u5b83\u5f88\u5bb9\u6613\u4e0a\u624b\uff0c\u9010\u6e10\u53d8\u5f97\u719f\u6089\u3002<\/p>\n<p>\u5173\u4e8e Go \u7684\u8fd0\u884c\u65f6\u73af\u5883\uff0c\u7b2c\u4e00\u4ee3\u548c\u7b2c\u4e8c\u4ee3\u7684\u4ea4\u66ff\u5df2\u7ecf\u53d1\u751f\uff0c1.9 \u548c 1.11 \u662f\u7b2c\u4e00\u4ee3\uff0c1.12 \u662f\u7b2c\u4e8c\u4ee3\u3002\u867d\u7136 1.9 \u548c 1.11 \u662f\u540c\u4e00\u4ee3\uff0c\u4f46\u5185\u90e8\u7ed3\u6784\u76f8\u5f53\u4e0d\u540c\uff0c\u6240\u4ee5\u5728\u53c2\u8003\u6587\u6863\u65f6\u9700\u8981\u6ce8\u610f\u4f7f\u7528\u54ea\u4e2a\u7248\u672c\u7684\u8fd0\u884c\u65f6\u73af\u5883\u3002<\/p>\n<p>\u867d\u7136 Go 1.11 \u5e76\u4e0d\u50cf Python \u4e00\u6837\u5373\u5c06\u5230\u8fbe\u8bed\u8a00\u672c\u8eab\u7684\u6d88\u8017\u671f\u9650\uff0c\u6240\u4ee5\u5728\u77ed\u671f\u5185\u5e94\u8be5\u8fd8\u53ef\u4ee5\u4f7f\u7528\uff0c\u4f46\u8003\u8651\u5230\u4ee5\u540e\u4f1a\u9010\u6e10\u88ab\u7b2c\u4e8c\u4ee3\u53d6\u4ee3\uff0c\u5982\u679c\u73b0\u5728\u5f00\u59cb\uff0c\u53ef\u80fd\u53ea\u80fd\u9009\u62e9 1.12\u3002<\/p>\n<h2>\u5efa\u7acb\u5f00\u53d1\u73af\u5883<\/h2>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1ee537434c4406c17ea1\/27-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u6240\u4ee5\uff0c\u56de\u5230\u6b63\u9898\u3002<\/p>\n<p>\u4f7f\u7528Docker-compose\u6765\u8bbe\u7f6eApp Engine + Go 1.12 + Datastore\u7684\u672c\u5730\u5f00\u53d1\u73af\u5883\u3002<br \/>\n\u65e7\u7248App Engine\u5305\u542b\u4e86Datastore\u7684\u6a21\u62df\u5668\u548c\u7ba1\u7406\u754c\u9762\u7b49\u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e13\u7528\u547d\u4ee4\u6765\u4f7f\u7528\u3002\u7136\u800c\uff0c\u81ea\u4ece\u5b83\u88ab\u6574\u5408\u5230gcloud\u547d\u4ee4\u4e2d\u540e\uff0c\u53ea\u652f\u6301\u90e8\u7f72\u529f\u80fd\u800c\u5df2\u3002<br \/>\n\u5e78\u8fd0\u7684\u662f\uff0cDatastore\u7684\u6a21\u62df\u5668\u672c\u8eab\u4f5c\u4e3agcloud\u547d\u4ee4\u7684Beta\u7248\u5df2\u7ecf\u51c6\u5907\u597d\u4e86\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u5b83\u6765\u521b\u5efa\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<h3>\u6211\u60f3\u8981\u5b9e\u73b0\u7684\u76ee\u6807<\/h3>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Datastore \u306e\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3092\u8d77\u52d5\u3059\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Go 1.12 \u306e\u958b\u767a\u7528\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Go \u304b\u3089 Datastore \u306e\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3078\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u8aad\u307f\u66f8\u304d\u304c\u3067\u304d\u308b\u304b\u78ba\u8a8d<\/ol>\n<p>\u30ed\u30fc\u30ab\u30eb\u306e\u958b\u767a\u74b0\u5883\u3068\u3057\u3066\u3084\u308a\u305f\u3044\u3053\u3068\u306f\u3053\u306e4\u3064\u3067\u3059\u3002<br \/>\n\u3053\u308c\u3089\u304c docker-compose up -d \u3067\u30b7\u30e5\u30c3\u3068\u8d77\u52d5\u3067\u304d\u308c\u3070\u958b\u767a\u304c\u6357\u308a\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u8ba9\u6211\u4eec\u4e00\u70b9\u70b9\u770b\u770b\u9700\u8981\u4ec0\u4e48\u3002<\/p>\n<h3>\u542f\u52a8 Datastore \u7684\u6a21\u62df\u5668\u3002<\/h3>\n<pre class=\"post-pre\"><code>bash gcloud beta emulators datastore start\r\n<\/code><\/pre>\n<p>\u53ea\u8981\u80fd\u4f7f\u7528gcloud\u547d\u4ee4\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u542f\u52a8\u6a21\u62df\u5668\u3002<br \/>\n\u7531\u4e8e\u5b98\u65b9\u63d0\u4f9b\u4e86google\/cloud-sdk\u7684Docker\uff0c\u6240\u4ee5\u4f7f\u7528\u5b83\u5e94\u8be5\u5f88\u5bb9\u6613\u3002<\/p>\n<h3>2. Go 1.12 \u306e\u958b\u767a\u7528\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u308b<\/h3>\n<p>Go 1.12 \u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u3067\u306f\u666e\u901a\u306e Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u5909\u308f\u3089\u306a\u3044\u5f62\u3067 Go \u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308c\u307e\u3059\u3002<br \/>\n\u306a\u306e\u3067\u6a19\u6e96\u306e net\/http \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u305f\u308a\u3001\u5916\u90e8\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u3063\u305f\u308a\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u3081\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f Gin \u3068\u3044\u3046\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\n\u4e00\u70b9\u6ce8\u610f\u3059\u308b\u3068\u3053\u308d\u306f PORT \u3068\u3044\u3046\u74b0\u5883\u5909\u6570\u3092\u8aad\u307f\u53d6\u3063\u3066\u3001\u305d\u306e \u30dd\u30fc\u30c8\u756a\u53f7\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u308b\u5fc5\u8981\u304c\u3042\u308b\u70b9\u3067\u3059\u306d\u3002<br \/>\nCloudRun \u3067\u3082\u540c\u3058\u4ed5\u69d8\u306a\u306e\u3067 GCP \u4e0a\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7acb\u3061\u4e0a\u3052\u308b\u969b\u306f\u3053\u306e\u4ed5\u69d8\u306b\u3057\u3066\u304a\u304f\u3068\u4fbf\u5229\u305d\u3046\u3067\u3059\u3002<\/p>\n<h3>\u5c06Go\u7a0b\u5e8f\u914d\u7f6e\u4e3a\u53ef\u4ee5\u8bbf\u95eeDatastore\u6a21\u62df\u5668\u3002<\/h3>\n<p>\u7acb\u3061\u4e0a\u3052\u305f Web \u30b5\u30fc\u30d0\u30fc\u3067\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306e Datastore \u3092\u898b\u306b\u884c\u304f\u3088\u3046\u306b\u4fee\u6b63\u3092\u3057\u307e\u3059\u3002<br \/>\nGoogle \u306e SDK \u3092\u4f7f\u3046\u5834\u5408\u3001\u74b0\u5883\u5909\u6570\u306b DATASTORE_EMULATOR_HOST DATASTORE_PROJECT_ID \u306e2\u3064\u3092\u6e21\u3057\u3066\u3042\u3052\u308c\u3070\u30c7\u30fc\u30bf\u30b9\u30c8\u30a2\u3078\u306e\u5411\u304d\u5148\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b \u307f\u305f\u3044\u3067\u3059\u3002<br \/>\n\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u306e\u5909\u66f4\u304c\u3044\u3089\u306a\u3044\u306e\u3067\u672c\u756a\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3068\u304d\u3082\u7c21\u5358\u3067\u3059\u306d\u3002<br \/>\n\u3053\u3053\u3067\u8a2d\u5b9a\u3059\u308b \u30d7\u30ed\u30b8\u30a7\u30af\u30c8ID \u306f\u30ed\u30fc\u30ab\u30eb\u3067\u958b\u767a\u3059\u308b\u5834\u5408\u306f\u3001\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306e\u8d77\u52d5\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3057\u3066\u6e21\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8ID\u3068\u63c3\u3048\u308c\u3070\u4f55\u3067\u3082\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<h3>4. \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u8aad\u307f\u66f8\u304d\u304c\u3067\u304d\u308b\u304b\u78ba\u8a8d<\/h3>\n<pre class=\"post-pre\"><code>    <span class=\"n\">ctx<\/span> <span class=\"o\">:=<\/span> <span class=\"n\">context<\/span><span class=\"o\">.<\/span><span class=\"n\">Background<\/span><span class=\"p\">()<\/span>\r\n\r\n    <span class=\"n\">projectID<\/span> <span class=\"o\">:=<\/span> <span class=\"n\">os<\/span><span class=\"o\">.<\/span><span class=\"n\">Getenv<\/span><span class=\"p\">(<\/span><span class=\"n\">EnvKeyDatastoreProjectId<\/span><span class=\"p\">)<\/span>\r\n    <span class=\"n\">client<\/span><span class=\"p\">,<\/span> <span class=\"n\">err<\/span> <span class=\"o\">=<\/span> <span class=\"n\">datastore<\/span><span class=\"o\">.<\/span><span class=\"n\">NewClient<\/span><span class=\"p\">(<\/span><span class=\"n\">ctx<\/span><span class=\"p\">,<\/span> <span class=\"n\">projectID<\/span><span class=\"p\">)<\/span>\r\n\r\n    <span class=\"k\">if<\/span> <span class=\"n\">err<\/span> <span class=\"o\">!=<\/span> <span class=\"no\">nil<\/span> <span class=\"p\">{<\/span>\r\n            <span class=\"c\">\/\/ \u30a8\u30e9\u30fc\u51e6\u7406<\/span>\r\n    <span class=\"p\">}<\/span>\r\n\r\n    <span class=\"c\">\/\/ \u6700\u65b010\u4ef6\u53d6\u5f97<\/span>\r\n    <span class=\"n\">q<\/span> <span class=\"o\">:=<\/span> <span class=\"n\">datastore<\/span><span class=\"o\">.<\/span><span class=\"n\">NewQuery<\/span><span class=\"p\">(<\/span><span class=\"s\">\"Entry\"<\/span><span class=\"p\">)<\/span><span class=\"o\">.<\/span><span class=\"n\">Order<\/span><span class=\"p\">(<\/span><span class=\"s\">\"-created_at\"<\/span><span class=\"p\">)<\/span><span class=\"o\">.<\/span><span class=\"n\">Limit<\/span><span class=\"p\">(<\/span><span class=\"m\">10<\/span><span class=\"p\">)<\/span>\r\n<\/code><\/pre>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u306f\u3053\u3093\u306a\u5f62\u3067\u4f7f\u3048\u3070\u53d6\u5f97\u3067\u304d\u308b\u307f\u305f\u3044\u3067\u3059\u3002<br \/>\n\u8a73\u7d30\u306f\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9 \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u74b0\u5883\u5909\u6570\u3067 SDK \u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8ID \u3092\u6e21\u3057\u3066\u307e\u3059\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u3082\u518d\u5ea6\u30d7\u30ed\u30b8\u30a7\u30af\u30c8ID\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>\u5c06\u5176\u6574\u5408\u4e3aDocker Compose<\/h3>\n<p>\u65e2\u6709\u6240\u9700\u7684\u4fe1\u606f\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Docker Compose\u6574\u5408\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<pre class=\"post-pre\"><code>\r\n<span class=\"na\">version<\/span><span class=\"pi\">:<\/span> <span class=\"s1\">'<\/span><span class=\"s\">3'<\/span>\r\n<span class=\"na\">services<\/span><span class=\"pi\">:<\/span>\r\n  <span class=\"na\">env<\/span><span class=\"pi\">:<\/span>\r\n    <span class=\"na\">image<\/span><span class=\"pi\">:<\/span> <span class=\"s\">golang:1.12<\/span>\r\n    <span class=\"na\">environment<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">GO111MODULE=on<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">DATASTORE_EMULATOR_HOST=datastore:8059<\/span>  <span class=\"c1\"># datastore \u30b5\u30fc\u30d3\u30b9\u306e `$\u30db\u30b9\u30c8\u540d:$\u30dd\u30fc\u30c8` \u3092\u6307\u5b9a<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">DATASTORE_PROJECT_ID=local-app<\/span>  <span class=\"c1\"># \u958b\u767a\u74b0\u5883\u7528\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">PORT=8000<\/span>\r\n    <span class=\"na\">working_dir<\/span><span class=\"pi\">:<\/span> <span class=\"s\">\/opt\/app<\/span>\r\n    <span class=\"na\">volumes<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">.:\/opt\/app<\/span>  <span class=\"c1\"># \u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u540c\u671f<\/span>\r\n    <span class=\"na\">ports<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">8000:8000<\/span>  <span class=\"c1\"># \u30db\u30b9\u30c8\u30de\u30b7\u30f3\u304b\u3089 localhost:8000 \u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b<\/span>\r\n    <span class=\"na\">links<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">datastore:datastore<\/span>  <span class=\"c1\"># datastore \u3068\u3044\u3046\u30db\u30b9\u30c8\u540d\u3067 datastore \u30b5\u30fc\u30d3\u30b9\u3078\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b<\/span>\r\n    <span class=\"na\">command<\/span><span class=\"pi\">:<\/span> <span class=\"s\">bash -c \"go get github.com\/pilu\/fresh &amp;&amp; fresh -c .fresh.conf\"<\/span>  <span class=\"c1\"># \u30db\u30c3\u30c8\u30ea\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3088\u3046\u306b Fresh \u3092\u5c0e\u5165<\/span>\r\n\r\n  <span class=\"na\">datastore<\/span><span class=\"pi\">:<\/span>\r\n    <span class=\"na\">image<\/span><span class=\"pi\">:<\/span> <span class=\"s\">google\/cloud-sdk<\/span>\r\n    <span class=\"na\">environment<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">PROJECT_ID=local-app<\/span>  <span class=\"c1\"># \u958b\u767a\u74b0\u5883\u7528\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d (\u4e0a\u3068\u540c\u3058\u3067\u3042\u308c\u3070\u4f55\u3067\u3082\u53ef)<\/span>\r\n    <span class=\"na\">command<\/span><span class=\"pi\">:<\/span> <span class=\"s\">\/bin\/bash -c \"gcloud beta emulators datastore start --host-port 0.0.0.0:8059 --project $$PROJECT_ID --data-dir \/data\"<\/span>\r\n    <span class=\"na\">volumes<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">datastore_volume:\/data<\/span>\r\n<span class=\"na\">volumes<\/span><span class=\"pi\">:<\/span>\r\n  <span class=\"na\">datastore_volume<\/span><span class=\"pi\">:<\/span>  <span class=\"c1\"># \u6c38\u7d9a\u5316\u7528\u306b\u30dc\u30ea\u30e5\u30fc\u30e0\u3092\u5b9a\u7fa9<\/span>\r\n<\/code><\/pre>\n<p>\u8fd9\u5c31\u662f\u5df2\u7ecf\u5b8c\u6210\u7684 docker-compose.yml \u6587\u4ef6\u3002<\/p>\n<p>\u6211\u6b63\u5728\u5b9a\u4e49\u4e24\u4e2a\u670d\u52a1\uff0c\u4e00\u4e2a\u662f\u540d\u4e3aenv\u7684\u670d\u52a1\uff0c\u7528\u4e8e\u627f\u8f7dGo\u5e94\u7528\u7a0b\u5e8f\uff0c\u53e6\u4e00\u4e2a\u662f\u540d\u4e3adatastore\u7684\u670d\u52a1\uff0c\u7528\u4e8e\u8fd0\u884cDatastore\u6a21\u62df\u5668\u3002<\/p>\n<p>\u7531\u4e8e\u6bcf\u6b21\u91cd\u65b0\u542f\u52a8Docker Compose\u65f6\uff0c\u6570\u636e\u5b58\u50a8\u670d\u52a1\u4e2d\u7684\u6570\u636e\u4e22\u5931\u4f1a\u9020\u6210\u56f0\u6270\uff0c\u56e0\u6b64\u6211\u5df2\u5b9a\u4e49\u4e86\u4e00\u4e2a\u4e13\u7528volume\uff0c\u5e76\u6307\u5b9a\u5c06\u6570\u636e\u5199\u5165\u8be5volume\u4e2d\u3002\u9879\u76eeID\u4f7f\u7528\u4e34\u65f6\u6807\u8bc6\u4e3alocal-app\u3002<\/p>\n<p>Go \u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u304b\u3089\u306f links \u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u5185\u90e8\u7528\u306e\u30db\u30b9\u30c8\u540d\u3092\u8a2d\u5b9a\u3057\u3066\u307e\u3059\u3002\u5148\u7a0b\u306e\u74b0\u5883\u5909\u6570\u306b\u3053\u306e\u30db\u30b9\u30c8\u540d\u3092\u6e21\u3057\u3066\u3042\u3052\u308c\u3070\u901a\u4fe1\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u3042\u3068\u306f\u30bd\u30fc\u30b9\u5909\u66f4\u306e\u305f\u3073\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u8d77\u52d5\u3057\u76f4\u3059\u306e\u306f\u624b\u9593\u306a\u306e\u3067\u3001Fresh \u3068\u3044\u3046\u30db\u30c3\u30c8\u30ea\u30ed\u30fc\u30c9\u306e\u4ed5\u7d44\u307f\u3092\u5c0e\u5165\u3057\u3066\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067 docker-compose up -d \u3092\u5b9f\u884c\u3059\u308c\u3070\u958b\u767a\u74b0\u5883\u304c\u30b7\u30e5\u30c3\u3068\u7acb\u3061\u4e0a\u304c\u308b\u4ed5\u7d44\u307f\u304c\u5b8c\u6210\u3057\u307e\u3057\u305f\u3002<br \/>\nApp Engine \u3078\u306e\u5b9f\u969b\u306e\u30c7\u30d7\u30ed\u30a4\u3082 gcloud app deploy \u30b3\u30de\u30f3\u30c9\u3092\u53e9\u3051\u3070\u305d\u306e\u307e\u307e\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<br \/>\n(DATASTORE_PROJECT_ID \u3092\u672c\u756a\u74b0\u5883\u3067\u3082\u8a2d\u5b9a\u3057\u3066\u3042\u3052\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002)<\/p>\n<p>2019\/11\/06 \u8ffd\u8a18:<br \/>\nhttps:\/\/cloud.google.com\/datastore\/docs\/activate?hl=ja#datastore-permissions-for-app-engine<br \/>\nApp Engine \u304b\u3089 Datastore \u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b Permission \u306e\u8a2d\u5b9a\u3082\u5fc5\u8981\u3067\u3057\u305f\u3002<\/p>\n<hr \/>\n<p>\u5c31\u5dee\u8981\u5927\u529b\u5730\u5199\u5e94\u7528\u7a0b\u5e8f\u4e86\u3002\u8bf7\u4e00\u5b9a\u8981\u8bd5\u8bd5\u770b\u4f7f\u7528App Engine\uff0c\u5b83\u5f88\u6709\u8da3\uff01\uff08\u5fc5\u987b\u5728\u5e74\u5e95\u524d\u91cd\u65b0\u8bbe\u8ba1\u535a\u5ba2&#8230;\uff09<\/p>\n<h2>\u66f4\u65b0\uff1a2019\u5e7411\u670807\u65e5<\/h2>\n<p>\u66f4\u65b0App Engine\u4ee5\u652f\u6301\u66f4\u591a\u65b0\u7684\u8fd0\u884c\u65f6\u73af\u5883\uff1aNode.js 12\u3001Go 1.13\u3001PHP 7.3\u548cPython 3.8\u3002\u770b\u8d77\u6765Go 1.13\u7684\u8fd0\u884c\u65f6\u73af\u5883\u5df2\u7ecf\u53d1\u5e03\u4e86\u6d4b\u8bd5\u7248\u3002\u5728\u8bed\u8a00\u4e0a\u8fdb\u884c\u4e86\u66f4\u65b0\uff0c\u4f46\u5728\u89c4\u683c\u4e0a\u53d8\u5316\u4f3c\u4e4e\u4e0d\u662f\u5f88\u5927\u5427\u3002<\/p>\n<h2>\u8bf7\u53c2\u8003<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Cloud Datastore \u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306e\u5b9f\u884c<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GAE\u7b2c\u4e8c\u4e16\u4ee3+Go v1.12\u3067echo\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3059\u308b(2019\u5e74\u5ea6\u7248)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">GAE\/SE Python\u30e9\u30f3\u30bf\u30a4\u30e0\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3078\u306e\u9053<\/ul>\n<div>\u622a\u81f32019\u5e7411\u67085\u65e5<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528Docker Compose\u8f7b\u677e\u642d\u5efa\u6700\u65b0\u7248\u672c\u7684Google App Engine Go\u8fd0\u884c\u65f6\u5f00\u53d1\u73af\u5883\u7684\u6545\u4e8b [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34720","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528app-engine\uff0c\u6240\u4ee5\u7528docker-compose\u5feb\u901f\u642d\u5efa\u4e86go-datastore\u7684\u5f00\u53d1\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386\" \/>\n<meta property=\"og:description\" content=\"\u4f7f\u7528Docker Compose\u8f7b\u677e\u642d\u5efa\u6700\u65b0\u7248\u672c\u7684Google App Engine Go\u8fd0\u884c\u65f6\u5f00\u53d1\u73af\u5883\u7684\u6545\u4e8b [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528app-engine\uff0c\u6240\u4ee5\u7528docker-compose\u5feb\u901f\u642d\u5efa\u4e86go-datastore\u7684\u5f00\u53d1\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-31T19:36:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T23:54:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1ee537434c4406c17ea1\/8-0.png\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/\",\"name\":\"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-10-31T19:36:29+00:00\",\"dateModified\":\"2024-04-29T23:54:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528app-engine\uff0c\u6240\u4ee5\u7528docker-compose\u5feb\u901f\u642d\u5efa\u4e86go-datastore\u7684\u5f00\u53d1\/","og_locale":"zh_CN","og_type":"article","og_title":"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386","og_description":"\u4f7f\u7528Docker Compose\u8f7b\u677e\u642d\u5efa\u6700\u65b0\u7248\u672c\u7684Google App Engine Go\u8fd0\u884c\u65f6\u5f00\u53d1\u73af\u5883\u7684\u6545\u4e8b [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528app-engine\uff0c\u6240\u4ee5\u7528docker-compose\u5feb\u901f\u642d\u5efa\u4e86go-datastore\u7684\u5f00\u53d1\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-31T19:36:29+00:00","article_modified_time":"2024-04-29T23:54:13+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1ee537434c4406c17ea1\/8-0.png"}],"author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/","name":"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-10-31T19:36:29+00:00","dateModified":"2024-04-29T23:54:13+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u6211\u60f3\u63a8\u5e7f\u4f7f\u7528App Engine\uff0c\u6240\u4ee5\u7528Docker Compose\u5feb\u901f\u642d\u5efa\u4e86Go + Datastore\u7684\u5f00\u53d1\u73af\u5883\u7684\u7ecf\u5386"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e6%83%b3%e6%8e%a8%e5%b9%bf%e4%bd%bf%e7%94%a8app-engine%ef%bc%8c%e6%89%80%e4%bb%a5%e7%94%a8docker-compose%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%ba%86go-datastore%e7%9a%84%e5%bc%80%e5%8f%91\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=34720"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34720\/revisions"}],"predecessor-version":[{"id":90652,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34720\/revisions\/90652"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=34720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=34720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=34720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}