如何在App Engine上部署标准Go App

时间:2019-07-26 00:04:42

标签: google-app-engine go gcloud

我在Google Cloud Platform上创建了一个App Engine项目,并遵循了一个非常基本的quick start tutorial for Go,但是当尝试使用gcloud app deploy部署我的应用程序时,它看起来像是在尝试使用Docker进行部署(灵活的环境),而我想使用标准环境进行部署。如何避免使用Docker并部署此应用?

$ gcloud app deploy
<...>

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 1 file to Google Cloud Storage                 ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.                                                                                                                      
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build ... status: FAILURE.
Error ID: 581A171A.
Error type: BuildError.
Error message: 2019/07/25 23:59:26 Building from Go source in /tmp/staging/srv/gopath/src/<project_name>, with main package at <project_name>
2019/07/25 23:59:26 Building /tmp/staging/srv/gopath/src/<project_name>, saving to /tmp/staging/usr/local/bin/start
2019/07/25 23:59:30 Wrote build output to /builder/outputs/output
2019/07/25 23:59:30 Wrote output to /tmp/staging/usr/local/bin/start
2019/07/25 23:59:30 Making tarball /tmp/tar-out406385400/app.tar.gz
2019/07/25 23:59:31 Creating app image on GCR: <...>
2019/07/25 23:59:32 Failed to create app image on GCR: [/bin/appender.par --src-image us.gcr.io/gae-runtimes/go112:go112_20190613_1_12_6_RC00 --tarball /tmp/tar-out406385400/app.tar.gz --dst-image us.gcr.io/<project_name>/app-engine-tmp/app/ttl-2h:4d75e939-3879-42b5-8fec-da14ad651baf]: Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/bin/appender.par/__main__.py", line 90, in <module>
  File "/bin/appender.par/__main__.py", line 79, in main
  File "/bin/appender.par/containerregistry/client/v2_2/docker_session_.py", line 71, in __init__
  File "/bin/appender.par/containerregistry/client/v2_2/docker_http_.py", line 198, in __init__
  File "/bin/appender.par/containerregistry/client/v2_2/docker_http_.py", line 301, in _Refresh
containerregistry.client.v2_2.docker_http_.TokenRefreshException: Bad status during token exchange: 403
{"errors":[{"code":"DENIED","message":"Token exchange failed for project '<project_name>'. Access denied."}]}.

1 个答案:

答案 0 :(得分:0)

我遇到了完全相同的错误。我尝试切换到另一种语言只是为了确保错误仍然与拒绝访问有关。 我的猜测是帐单。我有一个从未启用计费功能的旧帐户。免费试用版和免费版都不提供$ 300。在过去,我们无需注册即可注册和部署标准AppEngine。 一旦启用计费功能(使用300美元的免费试用版?),部署便成功了。