有没有人能够将Go Hello World快速入门演示用于Google App Engine托管虚拟机?

时间:2014-12-25 00:07:36

标签: google-app-engine go

我试图按照文档here

进行操作
gcloud config set project <project>
gcloud components update app
gcloud components update gae-go
goapp get google.golang.org/appengine
# remove existing containers & images just to be sure
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
gcloud preview app setup-managed-vms
cd $GOPATH/src/google.golang.org/appengine/demos/helloworld
gcloud --verbosity debug preview app run --enable-mvm-logs .

一切顺利到最后一行,这会在启动实例时产生&#34;内部错误&#34;:

DEBUG: Running gcloud.preview.app.run with _Args({'admin_host': None, 'allow_skipped_files': False, 'api_host': None, 'appidentity_email_address': None, 'appidentity_private_key_path': None, 'auth_domain': 'gmail.com', 'blobstore_path': None, 'clear_datastore': False, 'dart_dev_mode': None, 'dart_pub_serve_host': None, 'dart_sdk': None, 'datastore_consistency_policy': 'time', 'datastore_path': None, 'default_gcs_bucket_name': None, 'docker_host': None, 'enable_cloud_datastore': False, 'enable_mvm_logs': True, 'enable_sendmail': False, 'format': None, 'h': None, 'help': None, 'host': None, 'jvm_flag': None, 'log_level': None, 'logs_path': None, 'markdown': None, 'max_module_instances': None, 'modules': ['.'], 'php_executable_path': None, 'project': None, 'python_startup_script': None, 'quiet': None, 'require_indexes': False, 'shell': None, 'show_mail_body': False, 'smtp_allow_tls': False, 'smtp_host': None, 'smtp_password': None, 'smtp_user': None, 'storage_path': None, 'use_mtime_file_watcher': False, 'user_output_enabled': None, 'verbosity': 'debug'}). WARNING: The [application] field is specified in file [/home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld/app.yaml]. This field is not used by gcloud and should be removed. DEBUG: Found Cloud SDK root: /home/dallan/tools/google-cloud-sdk DEBUG: Found App Engine SDK root: /home/dallan/tools/google-cloud-sdk/platform/google_appengine DEBUG: Command sys.path: ['/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/antlr3', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/ipaddr', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/rsa', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/pyasn1', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/pyasn1_modules', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/concurrent', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/cherrypy', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/distutils', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/requests', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/six', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/websocket', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/docker', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/webob-1.2.3', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1', '/home/dallan/tools/google-cloud-sdk/./lib', '/home/dallan/tools/google-cloud-sdk/lib/googlecloudsdk/gcloud', '/home/dallan/tools/google-cloud-sdk/lib', '/usr/lib/python2.7/', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload'] Module [default] found in file [/home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld/app.yaml] DEBUG: Detected docker environment variables: DOCKER_HOST=tcp:// localhost:2376, DOCKER_CERT_PATH=/home/dallan/.docker, DOCKER_TLS_VERIFY=1 DEBUG: Sent event: Event(category='Executions', action='gcloud', label=u'2014.12.19', value=0) INFO: Looking for the Dockerfile in /home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld INFO: Using Dockerfile found in /home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld DEBUG: Found Cloud SDK root: /home/dallan/tools/google-cloud-sdk DEBUG: Found images: [u'gcloud-credentials-image:latest', u'google/appengine-log-server:latest', u'google/appengine-log-processor:latest', u'google/appengine-go:latest', u'google/appengine-java:latest', u'google/appengine-python27:latest', u'busybox:latest', u'google/docker-registry:latest'] DEBUG: Found image: google/appengine-go DEBUG: Running [dev_appserver.py] with: --allow_skipped_files=False --application=metal-shift-360 --auth_domain=gmail.com --clear_datastore=False --datastore_consistency_policy=time --dev_appserver_log_level=debug --enable_cloud_datastore=False --enable_mvm_logs=True --enable_sendmail=False --log_level=debug --require_indexes=False --show_mail_body=False --skip_sdk_update_check=True --smtp_allow_tls=False --use_mtime_file_watcher=False /home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld/app.yaml INFO: Skipping SDK update check. INFO: Starting API server at: http:// localhost:49580 DEBUG: Detected docker environment variables: DOCKER_HOST=tcp:// localhost:2376, DOCKER_CERT_PATH=/home/dallan/.docker, DOCKER_TLS_VERIFY=1 DEBUG: Sent event: Event(category='Commands', action='gcloud.preview.app.run', label='unknown', value=0) DEBUG: _add_watch_for_path('/home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld') INFO: Looking for image_id for image with tag google/appengine-log-server INFO: Creating container... INFO: Container f243742e897d9c38c7c075bf7a6eedd3c054d68c356018c0268ba421dcab477f created. INFO: Health checks starting for instance 0. DEBUG: Performing health check for instance 0. INFO: Starting Go VM Deployment process INFO: Starting module "default" running at: http:// localhost:8080 DEBUG: Dispatching request to after 0.0000s pending INFO: Starting admin server at: http:// localhost:8000 DEBUG: Starting process ['/home/dallan/tools/google-cloud-sdk/platform/google_appengine/goroot/bin/go-app-builder', '-app_base', '/home/dallan/test/testvm3/src/google.golang.org/appengine/demos/helloworld', '-arch', '6', '-dynamic', '-goroot', '/home/dallan/tools/google-cloud-sdk/platform/google_appengine/goroot', '-nobuild_files', '^^$', '-unsafe', '-gopath', '/home/dallan/test/testvm3', '-print_extras', '-vm', 'helloworld.go'] with input='', env={'GOARCH': 'amd64', 'GOOS': 'linux'}, cwd=None INFO: Go VM Deployment process failed: [Errno 104] Connection reset by peer ERROR: Internal error while starting instance. Traceback (most recent call last): File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1823, in _start_instance if not inst.start(): File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/instance.py", line 274, in start self._runtime_proxy.start() File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_proxy_go.py", line 130, in start self._vm_runtime_proxy.start(dockerfile_dir=dst_deployment_dir) File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_proxy.py", line 196, in start self._module_configuration.major_version, runtime_config.instance_id) File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/log_manager.py", line 172, in add _create_table(l) File "/home/dallan/tools/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/log_manager.py", line 138, in _create_table response = conn.getresponse() File "/usr/lib/python2.7/httplib.py", line 1045, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 409, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 365, in _read_status line = self.fp.readline(_MAXLINE + 1) File "/usr/lib/python2.7/socket.py", line 476, in readline data = self._sock.recv(self._rbufsize) error: [Errno 104] Connection reset by peer

任何想法出了什么问题? docker version产生

Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa
OS/Arch (client): linux/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa

go version产生

go version go1.4 linux/amd64

可能存在的问题 - gcloud preview app run生成的Dockerfile包含:

FROM google/appengine-go
..snip..
ADD . /app
RUN /bin/bash /app/_ah/build.sh

但是当我直接使用

进入google / appengine-go容器时
docker run --rm -it --entrypoint /bin/bash google/appengine-go

我发现/ app目录是完全空的,并且helloworld应用程序中没有_ah目录,所以我不确定/app/_ah/build.sh应该在哪里来自(哪里。在文件系统中的任何地方都没有build.sh文件。

非常感谢任何帮助。我整天都花在这上面,我很难过。

1 个答案:

答案 0 :(得分:1)

我做了两处更改,Hello World演示应用终于工作了:

  1. 从app.yaml
  2. 中删除application: helloworld
  3. 修改生成的Dockerfile以在apt-get update &&
  4. 之前插入apt-get install