python - Google Cloud VM 在部署时创建新版本

标签 python google-app-engine deployment google-compute-engine gcloud

我在 Google Cloud 上运行虚拟机,并使用他们的 SDK 通过以下命令进行部署:

gcloud preview app deploy ./app.yaml

部署有效,但是对于每个部署都会创建一个新实例,只能通过将版本 ID 添加到域名来访问。我尝试通过开发人员仪表板删除旧实例,但之后它们直接重新启动。

部署时如何删除新建的实例并默认覆盖主域上的默认版本?

最佳答案

要直接从 gcloud 执行此操作,请使用以下两个标志:

  • --set-default:

    Set the deployed version to be the default serving 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.

(均来自 gcloud preview app deploy --help)。

如果每次都将 --version 设置为相同,则部署在该 URL 的当前版本将被覆盖,并且不会在每次部署时创建新版本。

如果您使用--set-default,部署的版本可以只使用域名访问(没有版本作为子域)。

在开发者控制台中手动删除其他版本将是摆脱它们的最简单方法。

关于python - Google Cloud VM 在部署时创建新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31056462/

相关文章:

python - 如何在 matplotlib 中并排绘制堆叠直方图?

python - Pandas :根据多级首次出现合并数据框

python - itertools Product() 函数与 sum

python - 我怎样才能洗牌我从 Postgresql 得到的结果?

php - PHP GAE 上的 Amazon S3 无法使用 curl 扩展

.net - 用 Nemerle 编写的应用程序是否需要包含任何 DLL 文件?

tomcat - 使用build部署到生产的最简单方法

java - GAE DataStore 复合索引无法工作/无法识别

google-app-engine - 使用 JPA 注释编码类时出现 JAXBException

tomcat - tomcat会自动编译servlet吗?