简体   繁体   English

gcloud deploy 永远不会完成更新服务

[英]gcloud deploy never finish with Updating service

I'm trying to deploy a python app to App Engine.我正在尝试将 python 应用程序部署到 App Engine。 I've already deploy this app before but for some reason now it upload the files but then write Updating service [default].../ and never finishes.我之前已经部署过这个应用程序,但出于某种原因,现在它上传了文件,但随后写入了Updating service [default].../并且永远不会完成。

I'm using Windows 10 and all I can see after few minutes it is running is ERROR: (gcloud.app.deploy) .我正在使用 Windows 10,几分钟后我能看到它运行的是ERROR: (gcloud.app.deploy)

The command I run is gcloud app deploy --project my-proj -v 1 --quiet server/app.yaml我运行的命令是gcloud app deploy --project my-proj -v 1 --quiet server/app.yaml

I have the server side app in server sub directory.我在服务器子目录中有服务器端应用程序。

Any ideas how to diagnose this problem?任何想法如何诊断这个问题?

UPDATE1 I've run the command with debug flag and I see this come every 5 seconds: UPDATE1我已经运行带有调试标志的命令,我看到它每 5 秒出现一次:

Updating service [default].../DEBUG: Received operation: [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e]

DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

Updating service [default]...-DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

Updating service [default]...\DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

Updating service [default].../DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

Updating service [default]...|DEBUG: Operation [apps/my-app/operations/b0647556-93af-4fd8-b0a7-f4ae43393e1e] not complete. Waiting 5s.

在我们的例子中,这是由导致 500 错误的软件错误引起的 - 例如,我相信在部署过程中 App Engine 会进行简单的健康检查以验证应用程序是否已成功部署,如果失败,它将永远循环。

I had the same problem, so the solution for me was to deploy the app from console ( https://console.cloud.google.com ).我遇到了同样的问题,所以我的解决方案是从控制台( https://console.cloud.google.com )部署应用程序。 I cloned my git repo in the source code folder, after installing project, I run the command: gcloud app deploy --project [google-project-name]我在源代码文件夹中克隆了我的 git repo,安装项目后,我运行命令:gcloud app deploy --project [google-project-name]

This was happening to me with the v2 endpoints.这发生在我的 v2 端点上。 For backwards compatibility, I had added the old Servlet mapping of _ah/spi in my web.xml.为了向后兼容,我在 web.xml 中添加了_ah/spi的旧 Servlet 映射。 This caused the application to get stuck at Updating service [default]... and never finish.这导致应用程序卡在Updating service [default]...并且永远不会完成。 It looks like just having the mapping for _ah/api works for backwards compatibility, so there must be some backend magic that is happening on the appengine side.看起来只有_ah/api的映射可以向后兼容,所以在 appengine 端肯定有一些后端魔法。

I had exactly the same issue.我有完全相同的问题。 This is what I found out:这是我发现的:

I followed @Daniel Hernandez's suggestion and uploaded the app from a cloned git repository inside cloud shell.我遵循了@Daniel Hernandez 的建议,并从 Cloud Shell 内的克隆 git 存储库上传了该应用程序。 It worked.有效。

Then I went ahead and cloned that same repository that was working in cloud shell, but instead I cloned it into another folder in my computer.然后我继续克隆了在 cloud shell 中工作的同一个存储库,但我将它克隆到了我计算机的另一个文件夹中。 I deployed the app without any problem.我部署了该应用程序,没有任何问题。

This made me suspicious so I started looking into what files were different from these two setups.这让我产生了怀疑,所以我开始研究哪些文件与这两种设置不同。 I found out that in my original setup (the one that was failing) I had two extra folders:我发现在我的原始设置(失败的那个)中,我有两个额外的文件夹:

env/
lib/

These correspond to the local development folders for virtualenv and the extra libraries.这些对应于 virtualenv 的本地开发文件夹和额外的库。 Note that these files were "ignored" from both .gitignore and the skip_files directive in app.yaml .请注意,这些文件被.gitignoreapp.yamlskip_files指令“忽略”。

I deleted these two directories and tried to upload again and it worked.我删除了这两个目录并尝试再次上传并且它起作用了。

If you have a new project in my case it was a flag如果你在我的情况下有一个新项目,它是一个标志

I had:我有:

"deploy": "gcloud app deploy --project quantified-self-io --quiet --promote --stop-previous-version --version=v1 --verbosity=info",

The flag --stop-previous-version was causing my issue since there was no prev version running I suppose.标志--stop-previous-version导致了我的问题,因为我想没有运行 prev 版本。

Updating Gcloud SDK fixed the issue for me: gcloud components update更新 Gcloud SDK 为我解决了这个问题: gcloud components update

As per https://stackoverflow.com/a/52428069/219657根据https://stackoverflow.com/a/52428069/219657

There are probably many different things that can cause this problem, so even though there is an already accepted answer in the OP's case I think it's worth documenting other possibilities on this question.可能有很多不同的事情会导致这个问题,所以即使在 OP 的案例中已经有一个已经被接受的答案,我认为值得记录关于这个问题的其他可能性。

In my case it occurred because of pip's relatively new backtracking dependency resolver which, due to some underconstrained dependencies in my requirements.txt file, was causing pip to download many versions of some packages in order to determine the right dependencies.在我的例子中,它的发生是因为 pip 相对较新的回溯依赖解析器,由于我的requirements.txt文件中的一些依赖不足,导致 pip 下载某些包的许多版本以确定正确的依赖关系。 This can be very slow and was causing the build to time out.这可能非常慢,并导致构建超时。 Better constraining my dependencies resolved the issue.更好地约束我的依赖关系解决了这个问题。

You can see what the build is doing in the Cloud Logs Explorer filtered by the "Cloud Build" resource type.您可以在按“Cloud Build”资源类型过滤的 Cloud Logs Explorer 中查看构建正在执行的操作。 If there is a way to stream these logs via the CLI I'm not sure, but would love to be enlightened if so.如果有办法通过 CLI 访问这些日志 stream 我不确定,但如果是这样的话,我很乐意得到启发。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM