如何将一个应用引擎应用部署到多个项目 [英] How to deploy one app engine app to multiple projects

查看:121
本文介绍了如何将一个应用引擎应用部署到多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我想要创建 dev stage prod >环境中使用不同的GCP项目。

基本上它们运行相同的代码,只是在不同的孤立环境中运行它们。



我现在在命令行中使用 gcloud app deploy 部署应用程序。



如何有效地将应用程序部署到不同的项目?

我必须做 gcloud init 来更改我的每次配置默认项目?

必须有一些更好的做法。



或者,是否有更好的方式让我在应用上下文中设置 dev ...环境引擎?
$ b $ p

感谢。

解决方案

对于Python应用程序,您可以在app.yaml文件中设置应用程序。这使您可以为每个项目使用不同的数据。这是当您使用appcfg.py命令进行部署时。

  application:myproject 
version:alpha-001
运行时:python27
api_version:1
线程安全:true

处理程序:
- url:/
脚本:home.app

如果您不想为每个项目更改此文件中的应用程序值,可以运行以下命令:

  appcfg.py -A< YOUR_PROJECT_ID> -V v1更新myapp / 

https://cloud.google.com/appengine/docs/python/config/appref


如果您未在文件中指定应用程序,请在部署时使用appcfg命令中的--application选项。使用gcloud app deploy命令进行部署时,此元素将被忽略。



My problem is that I want to create dev, stage, prod environments by using different GCP projects.

Basically they are running the same code, just running them in different isolated environments.

I'm using gcloud app deploy in command line to deploy app right now.

How can I efficiently deploy an app to different project?
Do I have to do gcloud init to change my configuration of default project every time?
There must be some better practices.

Or, is there a better way for me to set up dev... environments in the context of app engine?

Thanks.

解决方案

For Python applications, you can set application in the app.yaml file. This allows you to use different data for each project. This is when you deploy using the appcfg.py command.

application: myproject
version: alpha-001
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
  script: home.app

If you don't want to change the application value in this file for each project, you can run the following:

appcfg.py -A <YOUR_PROJECT_ID> -V v1 update myapp/

https://cloud.google.com/appengine/docs/python/config/appref

If you do not specify the application in the file, use the --application option in the appcfg command when you deploy. This element is ignored when you deploy using the gcloud app deploy command.

这篇关于如何将一个应用引擎应用部署到多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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