gcloud应用程序部署不会删除以前的版本 [英] gcloud app deploy does not remove previous versions

查看:95
本文介绍了gcloud应用程序部署不会删除以前的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google App Engine上运行Node.js应用程序,使用以下命令来部署我的代码:

I am running a Node.js app on Google App Engine, using the following command to deploy my code:

gcloud app deploy --stop-previous-version

我想要的行为是终止所有运行早期版本的实例,但它们似乎始终存在.有什么我想念的吗?

My desired behavior is for all instances running previous versions to be terminated, but they always seem to stick around. Is there something I'm missing?

我意识到它们没有收到流量,但我仍在为它们付费,并且它们会引起一些背景遥测噪声.有没有更好的方法来运行此命令?

I realize they are not receiving traffic, but I am still paying for them and they cause some background telemetry noise. Is there a better way of running this command?

gcloud app instances list的示例输出: 如您所见,我正在运行两个不同的版本.

Example output of the gcloud app instances list: As you can see I have two different versions running.

推荐答案

由于错误的灵活实例未能在随后的部署中清除,因此我们在不到30天的时间内意外泄漏了免费的Google App Engine积分.当我们将其精确定位为原因时,它已经扩大到四个同时发生的实例,这些实例基本上已经消失了.

We accidentally blew through our free Google App Engine credit in less than 30 days because of an errant flexible instance that wasn't cleared by subsequent deployments. When we pinpointed it as the cause it had scaled up to four simultaneous instances that were basically idling away.

tl; dr::在部署时使用--version标志来指定版本名称.具有相同版本的现有实例将是 已替换,然后下次部署.

tl;dr: Use the --version flag when deploying to specify a version name. An existing instance with the same version will be replaced then next time you deploy.

那把我引向了--stop-previous-version的兔子洞.到目前为止,这是我发现的内容:

That led me down the rabbit hole that is --stop-previous-version. Here's what I've found out so far:

--stop-previous-version似乎不再受支持.在 gcloud app deploy参考页,但是如果您查看列出所有标志的页面顶部,则找不到它.

--stop-previous-version doesn't seem to be supported anymore. It's mentioned under Flags on the gcloud app deploy reference page, but if you look at the top of the page where all the flags are listed, it's nowhere to be found.

我尝试在设置该标志的情况下进行部署,以查看会发生什么,但似乎没有任何效果.仍然创建了一个新版本,我仍然必须进入并手动删除旧实例.

I tried deploying with that flag set to see what would happen but it seemingly had no effect. A new version was still created, and I still had to go in and manually delete the old instance.

gcloud-maven-plugin 回购,专门将该问题称为该插件的问题,但该问题似乎已被忽略.

There's an open Github issue on the gcloud-maven-plugin repo that specifically calls this out as an issue with that plugin but the issue has been seemingly ignored.

这时,最好的选择是将--version=staging或其他内容添加到gcloud deploy app.该标志的参考文档似乎表明它将替换共享该版本"的现有实例:

At this point our best bet at this point is to add --version=staging or whatever to gcloud deploy app. The reference docs for that flag seem to indicate that that it'll replace an existing instance that shares that "version":

-version = VERSION,-v VERSION

--version=VERSION, -v VERSION

此部署将创建或替换的应用版本.如果您未指定版本,则会为您生成一个版本.

The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you.

(重点是我的)

此外,Google自己的 app.yaml 参考文档 (该链接适用于Python文档,但仍然有用),专门将--version标志称为"preferred"(首选).部署时指定版本的方法:

Additionally, Google's own reference documentation on app.yaml (the link's for the Python docs but it's still relevant) specifically calls out the --version flag as the "preferred" way to specify a version when deploying:

推荐的方法是从app.yaml文件中删除版本元素,而使用命令行标志指定您的版本ID

The recommended approach is to remove the version element from your app.yaml file and instead, use a command-line flag to specify your version ID

这篇关于gcloud应用程序部署不会删除以前的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆