简体   繁体   English

每次我尝试部署时都会得到 - (gcloud.preview.app.deploy) 错误响应:[4] DEADLINE_EXCEEDED

[英]Every time I try to deploy I get - (gcloud.preview.app.deploy) Error Response: [4] DEADLINE_EXCEEDED

I'm new to Google cloud and I'm trying to do my first deploy to it.我是谷歌云的新手,我正在尝试对它进行第一次部署。 My first deploy is a Ruby on Rails project.我的第一个部署是一个 Ruby on Rails 项目。

I'm basically following this guide in the google cloud documentation .我基本上遵循谷歌云文档中的本指南 The only difference being that I'm using my own project instead of the 'hello world' project they supply.唯一的区别是我使用的是我自己的项目而不是他们提供的“hello world”项目。

This is my app.yaml file这是我的 app.yaml 文件

runtime: custom
vm: true
entrypoint: bundle exec rackup -p 8080 -E production config.ru
resources:
  cpu: 0.5
  memory_gb: 1.3
  disk_size_gb: 10

When I go to my project directory and run gcloud preview app deploy it starts the deploy but appears to eventually time out.当我转到我的项目目录并运行gcloud preview app deploy它会启动部署,但似乎最终会超时。 It gives the error (gcloud.preview.app.deploy) Error Response: [4] DEADLINE_EXCEEDED .它给出了错误(gcloud.preview.app.deploy) Error Response: [4] DEADLINE_EXCEEDED

Doing some research I found running gcloud preview app deploy with --verbosity debug gives extra debug info but it doesn't help me find whats causing it to timeout.做了一些研究,我发现使用--verbosity debug运行gcloud preview app deploy会提供额外的调试信息,但它不能帮助我找到导致超时的原因。

Here is the last chunk of the console log.这是控制台日志的最后一块。

Bundle complete! 35 Gemfile dependencies, 102 gems now installed.
Bundled gems are installed into ./vendor/bundle.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Post-install message from compass:
    Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
DEBUG: Operation [operations/build/guidir-1286/MmFkZjNmOGYtZDhhZi00NTJmLTk0YWEtMmQzMjBmM2JkOTg2OlVT] complete. Result: {
    "metadata": {
        "@type": "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata", 
        "build": {
            "finishTime": "2016-04-20T01:55:44.961635Z", 
            "status": "TIMEOUT", 
            "timeout": "600.000s", 
            "projectId": "guidir-1286", 
            "id": "2adf3f8f-d8af-452f-94aa-2d320f3bd986", 
            "source": {
                "storageSource": {
                    "object": "us.gcr.io/guidir-1286/appengine/default.20160420t110030:latest", 
                    "bucket": "staging.guidir-1286.appspot.com"
                }
            }, 
            "steps": [
                {
                    "args": [
                        "us.gcr.io/guidir-1286/appengine/default.20160420t110030:latest"
                    ], 
                    "name": "gcr.io/cloud-builders/dockerizer"
                }
            ], 
            "startTime": "2016-04-20T01:45:43.216420Z", 
            "logsBucket": "staging.guidir-1286.appspot.com", 
            "images": [
                "us.gcr.io/guidir-1286/appengine/default.20160420t110030:latest"
            ], 
            "createTime": "2016-04-20T01:45:41.861657Z"
        }
    }, 
    "done": true, 
    "name": "operations/build/guidir-1286/MmFkZjNmOGYtZDhhZi00NTJmLTk0YWEtMmQzMjBmM2JkOTg2OlVT", 
    "error": {
        "message": "DEADLINE_EXCEEDED", 
        "code": 4
    }
}
DEBUG: (gcloud.preview.app.deploy) Error Response: [4] DEADLINE_EXCEEDED
Traceback (most recent call last):
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 654, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 1401, in Run
    resources = command_instance.Run(args)
  File "/Users/Robert/google-cloud-sdk/lib/surface/preview/app/deploy.py", line 507, in Run
    config_cleanup)
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 195, in BuildAndPushDockerImages
    storage_client)
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 245, in _BuildImagesWithCloudBuild
    image.tag, cloudbuild_client)
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/cloud_build.py", line 181, in ExecuteCloudBuild
    retry_callback=log_tailer.Poll)
  File "/Users/Robert/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/api/operations.py", line 69, in WaitForOperation
    encoding.MessageToPyValue(completed_operation.error)))
OperationError: Error Response: [4] DEADLINE_EXCEEDED
ERROR: (gcloud.preview.app.deploy) Error Response: [4] DEADLINE_EXCEEDED

This is the furthest its gone, but sometimes its mid way through installing the gems before it times out and other times it doesn't even get upto installing the gems.这是最远的一次,但有时它会在超时之前安装 gems 的中途,而有时它甚至没有开始安装 gems。

How can I stop this from occurring?我怎样才能阻止这种情况发生?

There's a 10 minute default timeout for Docker builds (the mechanism by which runtime: custom App Engine builds work). Docker 构建有 10 分钟的默认超时( runtime: custom App Engine 构建工作的机制)。 You can increase this by running gcloud config set app/cloud_build_timeout [NUMBER OF SECONDS] .您可以通过运行gcloud config set app/cloud_build_timeout [NUMBER OF SECONDS]来增加它。

You could also work around by performing the build yourself:您也可以通过自己执行构建来解决:

docker build . -t gcr.io/myapp/myimage
gcloud docker push gcr.io/myapp/myimage
gcloud preview app deploy app.yaml --image-url=gcr.io/myapp/myimage

However, in general, your Docker builds shouldn't be taking this long.但是,一般来说,您的 Docker 构建不应花费这么长时间。 It's usually better to have a base image with all of your dependencies already built in, and just have the final build derive from that image and install your app.通常最好有一个已经内置了所有依赖项的基本映像,并且只需从该映像派生最终构建并安装您的应用程序。 This way, your builds will be much quicker.这样,您的构建会更快。

This error is raised when the overall request times out.当整个请求超时时会引发此错误。

The execution limit is 10 minutes for task queue requests.任务队列请求的执行限制为 10 分钟。 You can increase this timeout limit on google cloud shell, by typing gcloud config set app/cloud_build_timeout [TIMEOUT_SECONDS]您可以通过键入gcloud config set app/cloud_build_timeout [TIMEOUT_SECONDS]来增加 google cloud shell 的超时限制

Example示例

gcloud config set app/cloud_build_timeout 1000

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:(gcloud.preview.app.deploy)错误响应:[2]构建失败; - ERROR: (gcloud.preview.app.deploy) Error Response: [2] Build failed; 带有Gcloud的Rails错误:(gcloud.preview.app.deploy)错误响应:[13]意外错误。 部署版本: - Rails with Gcloud ERROR: (gcloud.preview.app.deploy) Error Response: [13] Unexpected Error. Deployed Version: 每次部署 Rails 应用程序时都会自动删除文件夹内容 - Folder contents are automatically deleted every time I deploy my Rails app 当我尝试部署Rails应用程序时,这里出现什么问题? - What is the issue here when I try to deploy my rails app? 为什么这个 Rails 应用无法部署到 GCLOUD? - Why does this Rails app fails to deploy to GCLOUD? 在服务器上部署Rails应用程序。 Unicorn和nginx日志似乎还可以。 但我收到301错误 - Deploy rails app on server. Unicorn and nginx logs as it seems are ok. But I get 301 error 为什么在尝试将Ruby on Rails应用程序部署到Heroku时出现错误? - Why I get an Error when trying deploy Ruby on Rails app to Heroku? 将应用程序部署到Heroku时出现500错误 - 500 error when I deploy my app to Heroku 嘿,我正在尝试在 heroku 上部署一个 Rails 应用程序,当我运行 git push heroku master 时收到以下错误消息 - hey I am trying to deploy a rails app on heroku, and i get the follow error message when i run git push heroku master 每当我尝试打开时,Heroku应用程序崩溃 - Heroku app crashes every time I try to open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM