Golang:托管 VM 应用程序的预览返回错误。

huangapple go评论104阅读模式
英文:

Golang: Preview of managed VM app returns error

问题

我正在尝试使用gcloud preview app run <path_to_app>命令预览一个Go Docker(App Engine ManagedVM)应用程序。

但是我一直收到以下错误:

Traceback (most recent call last):
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 985, in <module>
    main()
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 978, in main
    dev_server.start(options)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 774, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 182, in start
    _module, port = self._create_module(module_configuration, port)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in _create_module
    threadsafe_override=threadsafe_override)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1463, in __init__
    super(ManualScalingModule, self).__init__(**kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 514, in __init__
    self._module_configuration)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 237, in _create_instance_factory
    module_configuration=module_configuration)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py", line 78, in __init__
    timeout=self.DOCKER_D_REQUEST_TIMEOUT_SECS)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 740, in NewDockerClient
    client.ping()
  File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 711, in ping
    return self._result(self._get(self._url('/_ping')))
  File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 76, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/adapters.py", line 384, in send
    raise Timeout(e, request=request)
requests.exceptions.Timeout: (<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10631c7d0>, 'Connection to 192.168.59.104 timed out. (connect timeout=60)')
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

我确认使用boot2docker status命令,Docker正在运行,返回running。这之前是可以工作的,但是在机器重启后,似乎什么都不起作用了。有什么想法吗?

英文:

I'm trying to preview a Go docker (App Engine ManagedVM) app using the gcloud preview app run <path_to_app> command.

But I keep getting this error:

Traceback (most recent call last):
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py&quot;, line 83, in &lt;module&gt;
    _run_file(__file__, globals())
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py&quot;, line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py&quot;, line 985, in &lt;module&gt;
    main()
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py&quot;, line 978, in main
    dev_server.start(options)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py&quot;, line 774, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py&quot;, line 182, in start
    _module, port = self._create_module(module_configuration, port)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py&quot;, line 262, in _create_module
    threadsafe_override=threadsafe_override)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py&quot;, line 1463, in __init__
    super(ManualScalingModule, self).__init__(**kwargs)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py&quot;, line 514, in __init__
    self._module_configuration)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py&quot;, line 237, in _create_instance_factory
    module_configuration=module_configuration)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py&quot;, line 78, in __init__
    timeout=self.DOCKER_D_REQUEST_TIMEOUT_SECS)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py&quot;, line 740, in NewDockerClient
    client.ping()
  File &quot;/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py&quot;, line 711, in ping
    return self._result(self._get(self._url(&#39;/_ping&#39;)))
  File &quot;/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py&quot;, line 76, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py&quot;, line 468, in get
    return self.request(&#39;GET&#39;, url, **kwargs)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py&quot;, line 456, in request
    resp = self.send(prep, **send_kwargs)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py&quot;, line 559, in send
    r = adapter.send(request, **kwargs)
  File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/adapters.py&quot;, line 384, in send
    raise Timeout(e, request=request)
requests.exceptions.Timeout: (&lt;requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10631c7d0&gt;, &#39;Connection to 192.168.59.104 timed out. (connect timeout=60)&#39;)
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

I've confirmed that docker is up and running using boot2docker status which returns running This was working before but after a machine reboot, nothing seems to work. Any ideas?

答案1

得分: 4

主要问题是:

文件“/Users/jwesonga/google-cloud-sdk/platform/google_appengine
       /lib/requests/requests/adapters.py”,第384行,发送时出错
    raise Timeout(e, request=request)
requests.exceptions.Timeout:   
(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object 
at 0x10631c7d0>, '连接到192.168.59.104超时。 (连接超时=60)')
错误:(gcloud.preview.app.run) DevAppSever失败,错误代码为[1]

这通常是在使用代理时出现的情况,并在[pip问题1805][1]中讨论过。

据说在pip1.6中已经修复了这个问题,但以防万一,你可以尝试[alexandrem的解决方法][2]

/opt/venvs/ironic/lib/python2.6/site-packages/pip/_vendor/requests
/adapters.patch.py /opt/venvs/ironic/lib/python2.6/site-packages
/pip/_vendor/requests/adapters.py
209c209
if True or not proxy in self.proxy_manager:
   ^^^^

基本上,我只需在adapter.py的第209行的条件中添加一个True,以始终创建一个ProxyManager实例,从而跳过池管理器逻辑。
[1]: https://github.com/pypa/pip/issues/1805
[2]: https://github.com/pypa/pip/issues/1805#issuecomment-47827439

英文:

The main issue is:

File &quot;/Users/jwesonga/google-cloud-sdk/platform/google_appengine
       /lib/requests/requests/adapters.py&quot;, line 384, in send
    raise Timeout(e, request=request)
requests.exceptions.Timeout:   
(&lt;requests.packages.urllib3.connection.VerifiedHTTPSConnection object 
at 0x10631c7d0&gt;, &#39;Connection to 192.168.59.104 timed out. 
(connect timeout=60)&#39;)
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

Which is often the case when you have a proxy, and is discussed in [pip issue 1805][1]

It is supposed to be fixed in pip1.6, but just in case, you can try the [workaround of alexandrem][2]

/opt/venvs/ironic/lib/python2.6/site-packages/pip/_vendor/requests
/adapters.patch.py /opt/venvs/ironic/lib/python2.6/site-packages
/pip/_vendor/requests/adapters.py
209c209
if True or not proxy in self.proxy_manager:
   ^^^^

> basically I just add a True to the condition on line 209 of the adapter.py to always create a ProxyManager instance, thus skipping the pool manager logic.
[1]: https://github.com/pypa/pip/issues/1805
[2]: https://github.com/pypa/pip/issues/1805#issuecomment-47827439

答案2

得分: 0

gcloud命令启用了ah_host进程,并创建了您应用程序的Docker镜像,并将其传递给Docker守护程序。在您的情况下,似乎您的Docker守护程序没有响应该请求。因此,请执行"sudo docker -d"来检查Docker守护程序是否在您的计算机上运行。

还要检查您设置的证书路径是否正确,并且TLS_VERIFY的值是否为TRUE。

请查看文档[1]以了解在MacOS上安装Docker的详细步骤。

[1] https://docs.docker.com/installation/mac/

英文:

The gcloud command enable the ah_host process and also created the docker image of your app and passes it to the Docker daemon, in your case it seems that your docker daemon is not responding to the request. So to make sure,perform "sudo docker -d" to check if the Docker daemon is running on your machine or not.
Also check that, the path of the certificate you set correctly and value of the TLS_VERIFY is TRUE.

Go through the documentation [1] for the installation of Docker on MacOS

[1] https://docs.docker.com/installation/mac/

huangapple
  • 本文由 发表于 2015年4月11日 17:09:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/29576087.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定