简体   繁体   English

在Google Computing Engine上更新托管VM的代码

[英]Updating code of managed vm on google compute engine

I understand this might be an easy solution, but I am very new to this so any help would be appreciated. 我知道这可能是一个简单的解决方案,但是我对此并不陌生,因此不胜感激。

I have been running through the hello world application for node.js with managed vms on google compute engine, and I have just done this stage 我一直在通过Google计算引擎上的托管虚拟机运行node.js的hello world应用程序,而我刚刚完成了此阶段

gcloud preview app deploy app.yaml --promote

Which has allowed me to put up the app, and it works. 这使我能够安装该应用程序,并且可以正常工作。

BUT HOW do I now update that code? 但是我现在如何更新该代码? If I run that command again it starts up new instances and essentially treats it like a new upload. 如果我再次运行该命令,它将启动新实例,并从本质上将其视为新上传。

You can deploy the updated version of your app by running the same command you used to deploy the app the first time, as indicate in this article : 您可以通过运行与首次部署应用程序相同的命令来部署应用程序的更新版本,如本文所述

If you update your app, you can deploy the updated version by entering the same command you used to deploy the app the first time. 如果您更新应用程序,则可以通过输入与首次部署应用程序相同的命令来部署更新的版本。 The new deployment creates a new version of your app and promotes it to the default version. 新的部署会创建您应用的新版本,并将其升级为默认版本。 The older versions of your app remain, as do their associated VM instances. 您的应用程序的较旧版本以及与之关联的VM实例也会保留。 Be aware that all of these app versions and VM instances are billable resources. 请注意,所有这些应用程序版本和VM实例都是可计费的资源。 For information about deleting or stopping your VM instances, see Cleaning up. 有关删除或停止VM实例的信息,请参阅清理。

Just in case anyone found this question looking for the same information, I finally seemingly worked out how to do it. 以防万一有人发现这个问题寻找相同的信息,我似乎终于找到了解决方法。

You need to attach the --version flag when you are deploying, instead of using --promote. 部署时需要附加--version标志,而不是使用--promote。

You can find the default version in google cloud console, by going menu (burger icon) -> app engine -> versions and you will see in that list one item with (default) by it. 您可以通过转到menu (burger icon) -> app engine -> versions ,在Google云控制台中找到默认menu (burger icon) -> app engine -> versions ,您会在列表中看到带有(默认)项的一项。

so then when deploying put that version string after --version and it will deploy without needlessly creating new things 因此,当部署时,将版本字符串放在--version之后,它将在无需不必要地创建新东西的情况下进行部署

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

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