google 应用引擎部署自定义虚拟机应用需要很长时间才能部署
google app engine deploy a custom vm app takes a long time to deploy
这是我的worker.yaml
runtime: custom #python27
api_version: 1
threadsafe: false
vm: true
service: worker
env_variables:
PYTHON_ENV: lab
network:
instance_tag: testing123
name: dev
handlers:
- url: /.*
script: Framework.Workers.PushQueues.worker.app
login: admin
Docker 文件
FROM us.gcr.io/smiling-diode-638/basic-algo-docker-v2
和控制台输出:
gcloud app deploy worker.yaml --verbosity='debug' ✱
DEBUG: Running gcloud.app.deploy with Namespace(__calliope_internal_deepest_parser=ArgumentParser(prog='gcloud.app.deploy', usage=None, description='Deploy the local code and/or configuration of your app to App Engine.', version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=False), account=None, authority_selector=None, authorization_token_file=None, bucket=None, calliope_command=<googlecloudsdk.calliope.backend.Command object at 0x108770290>, command_path=['gcloud', 'app', 'deploy'], configuration=None, credential_file_override=None, deployables=['worker.yaml'], docker_build=None, document=None, flatten=None, format=None, h=None, help=None, http_timeout=None, ignore_bad_certs=False, image_url=None, log_http=None, project=None, promote=None, quiet=None, server=None, skip_image_url_validation=False, skip_staging=False, stop_previous_version=None, trace_email=None, trace_log=None, trace_token=None, user_output_enabled=None, verbosity='debug', version=None).
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1beta5]
You are about to deploy the following services:
- smiling-diode-638/worker/20161109t165841 (from [/Volumes/ownhealth_dev/Backend/worker.yaml])
Deploying to URL: [https://worker-dot-smiling-diode-638.appspot.com]
Do you want to continue (Y/n)? Y
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [gs://staging.smiling-diode-638.appspot.com/].
If this is your first deployment, this may take a while...DEBUG: Host: appengine.google.com
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to https://appengine.google.com/api/vms/prepare?app_id=smiling-diode-638 headers={'X-appcfg-api-version': '1', 'content-length': '0', 'Content-Type': 'application/octet-stream'} body=
INFO: Attempting refresh to obtain initial access_token
INFO: Refreshing access_token
If this is your first deployment, this may take a while...\DEBUG: Got response: {bucket: vm-containers.smiling-diode-638.appspot.com, path: /containers}
If this is your first deployment, this may take a while...done.
Beginning deployment of service [worker]...
DEBUG: No staging command found for runtime [custom] and environment [MANAGED_VMS].
WARNING: Deployment of App Engine Flexible Environment apps is currently in Beta
INFO: Using Dockerfile found in /Volumes/ownhealth_dev/Backend
Building and pushing image for service [worker]
INFO: Refreshing access_token
INFO: Uploading [/var/folders/d1/lgf326px48s8w6cvj2f7ng200000gp/T/tmplQDUjR/src.tgz] to [us.gcr.io/smiling-diode-638/appengine/worker.20161109t165841:latest]
图片大小为3.5GB
一个多小时了,还在部署中。
编辑:
我尝试从本地网络机器部署,下载图像确实更快,但部署是无休止的,我得到 Error Response: [4] DEADLINE_EXCEEDED
附上我看到的所有错误
ERROR: build step "gcr.io/cloud-builders/docker@sha256:1b5a8642d04ef785f7dd2dbb0296f837895f50442fdfe5ebd0b04c206ab0b1b5" failed: exit status 2
我在哪里可以查看日志?
编辑#2:
我运行就是这样
gcloud preview app deploy worker.yaml --image-url=us.gcr.io/smiling-diode-638/basic-algo-docker-v2 --verbosity='debug'
得到
Error Response: [13] Timed out when starting VMs. It's possible that the application code is unhealthy
但我已将其添加到 worker.yaml
health_check:
enable_health_check: False
那么如何禁用运行状况检查??
大部分部署时间通常花在上传 docker 图像上,这在很大程度上取决于图像大小(在您的情况下相当大 - 3.5GB)、您的互联网连接上传速度和服务器的 "closeness" 到 GAE 区域数据中心。
通过从云托管的 VM(最好是托管在与您的 GAE 应用程序相同的区域中的 GCE 机器)执行部署,您可能会获得显着的上传速度提升。
构建图像也需要时间,其中一些是不可避免的。您也许可以加快速度,请参阅 How can I speed up Rails Docker deployments on Google Cloud Platform?
此外,与第一次部署应用程序相比,重新部署应用程序时需要执行一些不可避免的额外步骤,请参阅why does google appengine deployment take several minutes to update service
这是我的worker.yaml
runtime: custom #python27
api_version: 1
threadsafe: false
vm: true
service: worker
env_variables:
PYTHON_ENV: lab
network:
instance_tag: testing123
name: dev
handlers:
- url: /.*
script: Framework.Workers.PushQueues.worker.app
login: admin
Docker 文件
FROM us.gcr.io/smiling-diode-638/basic-algo-docker-v2
和控制台输出:
gcloud app deploy worker.yaml --verbosity='debug' ✱
DEBUG: Running gcloud.app.deploy with Namespace(__calliope_internal_deepest_parser=ArgumentParser(prog='gcloud.app.deploy', usage=None, description='Deploy the local code and/or configuration of your app to App Engine.', version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=False), account=None, authority_selector=None, authorization_token_file=None, bucket=None, calliope_command=<googlecloudsdk.calliope.backend.Command object at 0x108770290>, command_path=['gcloud', 'app', 'deploy'], configuration=None, credential_file_override=None, deployables=['worker.yaml'], docker_build=None, document=None, flatten=None, format=None, h=None, help=None, http_timeout=None, ignore_bad_certs=False, image_url=None, log_http=None, project=None, promote=None, quiet=None, server=None, skip_image_url_validation=False, skip_staging=False, stop_previous_version=None, trace_email=None, trace_log=None, trace_token=None, user_output_enabled=None, verbosity='debug', version=None).
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1beta5]
You are about to deploy the following services:
- smiling-diode-638/worker/20161109t165841 (from [/Volumes/ownhealth_dev/Backend/worker.yaml])
Deploying to URL: [https://worker-dot-smiling-diode-638.appspot.com]
Do you want to continue (Y/n)? Y
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [gs://staging.smiling-diode-638.appspot.com/].
If this is your first deployment, this may take a while...DEBUG: Host: appengine.google.com
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to https://appengine.google.com/api/vms/prepare?app_id=smiling-diode-638 headers={'X-appcfg-api-version': '1', 'content-length': '0', 'Content-Type': 'application/octet-stream'} body=
INFO: Attempting refresh to obtain initial access_token
INFO: Refreshing access_token
If this is your first deployment, this may take a while...\DEBUG: Got response: {bucket: vm-containers.smiling-diode-638.appspot.com, path: /containers}
If this is your first deployment, this may take a while...done.
Beginning deployment of service [worker]...
DEBUG: No staging command found for runtime [custom] and environment [MANAGED_VMS].
WARNING: Deployment of App Engine Flexible Environment apps is currently in Beta
INFO: Using Dockerfile found in /Volumes/ownhealth_dev/Backend
Building and pushing image for service [worker]
INFO: Refreshing access_token
INFO: Uploading [/var/folders/d1/lgf326px48s8w6cvj2f7ng200000gp/T/tmplQDUjR/src.tgz] to [us.gcr.io/smiling-diode-638/appengine/worker.20161109t165841:latest]
图片大小为3.5GB
一个多小时了,还在部署中。
编辑:
我尝试从本地网络机器部署,下载图像确实更快,但部署是无休止的,我得到 Error Response: [4] DEADLINE_EXCEEDED
附上我看到的所有错误
ERROR: build step "gcr.io/cloud-builders/docker@sha256:1b5a8642d04ef785f7dd2dbb0296f837895f50442fdfe5ebd0b04c206ab0b1b5" failed: exit status 2
编辑#2:
我运行就是这样
gcloud preview app deploy worker.yaml --image-url=us.gcr.io/smiling-diode-638/basic-algo-docker-v2 --verbosity='debug'
得到
Error Response: [13] Timed out when starting VMs. It's possible that the application code is unhealthy
但我已将其添加到 worker.yaml
health_check:
enable_health_check: False
那么如何禁用运行状况检查??
大部分部署时间通常花在上传 docker 图像上,这在很大程度上取决于图像大小(在您的情况下相当大 - 3.5GB)、您的互联网连接上传速度和服务器的 "closeness" 到 GAE 区域数据中心。
通过从云托管的 VM(最好是托管在与您的 GAE 应用程序相同的区域中的 GCE 机器)执行部署,您可能会获得显着的上传速度提升。
构建图像也需要时间,其中一些是不可避免的。您也许可以加快速度,请参阅 How can I speed up Rails Docker deployments on Google Cloud Platform?
此外,与第一次部署应用程序相比,重新部署应用程序时需要执行一些不可避免的额外步骤,请参阅why does google appengine deployment take several minutes to update service