如何将GAE的dispatch.yaml用于多种开发环境? [英] How to use GAE's dispatch.yaml with multiple development environments?
问题描述
我试图了解Google App Engine的 dispatch.yaml
文件。
我们有一个前端和后端的香草网络应用程序。我们也有开发和生产环境。两个环境在GAE上都有两个服务 - 前端
和默认
,这是后端。
我们有一个带前端和后端的香草网络应用程序。我们也有开发和生产环境。我们在GAE上有两项服务 - 前端和默认,这是后端。我们有两个GAE项目 - staging
,这是我们的开发环境,而 production
,这是我们的生产环境。暂存环境是从我们的开发分支在我们的前端和后端构建的。生产环境由我们的主人在我们的前端和后端构建。
我们希望为分段和生产环境使用自定义路由。
我尝试使用 dispatch_staging.yaml
和 dispatch_prod.yaml
来区分文件但GAE不会识别这些文件名称。我想我们可以重命名前端服务,但看起来像没有办法避开 default
。
您使用 dispatch.yaml
来指定正在构建的环境吗?
我遇到这个问题的方式是通过对应用程序代码使用不同的回购分支。
-
master
分支版本部署到my_app-dev
- 开发环境应用程序
生产分支版本部署到 my_app
- 生产环境应用程序
这样文件总是被命名为
dispatch.yaml
。服务名称在环境之间不会改变,但是与它们相关联的自定义域名也会这样做 - 这反映在2个分支中的 dispatch.yaml
文件的内容中: $ git diff生产master - dispatch.yaml
diff --git a / dispatch.yaml b / dispatch .yaml
index 0768a6a..c1326cf 100644
--- a / dispatch.yaml
+++ b / dispatch.yaml
@@ -1,14 +1,14 @@
-application:my_app
+ application:my_app-dev
dispatch:
- - url:service1.my_app.com/*
+ - url :service1-dev.my_app.com/*
模块:service1
- - url:service1-dot-my_app.appspot.com/*
+ - url:service1 -dot-my_app-dev.appspot.com/*
模块:service1
- url:* / service1 / *
模块:service1
- - url: service2.my_app.com/*
+ - url:service2-dev.my_app.com/*
module:service2
- - url:service2-dot-my_app.appspot .com / *
+ - url:service2-dot-my_app-d ev.appspot.com/*
module:service2
注意:我在应用程序级别实现了不同的环境(与服务级别相反,请参阅 I am trying to understand the We have a vanilla web app with a frontend and a backend. We also have a development and a production environment. Both environments have two services on GAE - We have a vanilla web app with a frontend and a backend. We also have a development and a production environment. We have two services on GAE - frontend and default, which is the backend. We have two projects on GAE - We want to use custom routes for both the staging and production environments. I have tried using How do you use The way I approached this problem is by using different repo branches for the application code. This way the file is always named Note: I'm implementing the different environments at the app level (as opposed to the service level, see Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?). A service-level implementation cannot use this approach. 这篇关于如何将GAE的dispatch.yaml用于多种开发环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!dispatch.yaml
file for Google App Engine. frontend
and default
, which is the backend.staging
, which is our dev environment, and production
, which is our production environment. The staging environment is built from our dev branch in both our frontend and backend. The production environment is built from our master in both our frontend and backend.dispatch_staging.yaml
and dispatch_prod.yaml
to differentiate the files but GAE won't recognize those file names. I guess we could rename the frontend service but it looks like there is no way getting around default
.dispatch.yaml
to specify the environment being built?
master
branch version is deployed to my_app-dev
- the development environment appproduction
branch version is deployed to my_app
- the production environment appdispatch.yaml
. The service names don't change between environments, but the custom domain names associated to them do - and that's reflected in the content of the dispatch.yaml
file in the 2 branches:$ git diff production master -- dispatch.yaml
diff --git a/dispatch.yaml b/dispatch.yaml
index 0768a6a..c1326cf 100644
--- a/dispatch.yaml
+++ b/dispatch.yaml
@@ -1,14 +1,14 @@
-application: my_app
+application: my_app-dev
dispatch:
- - url: "service1.my_app.com/*"
+ - url: "service1-dev.my_app.com/*"
module: service1
- - url: "service1-dot-my_app.appspot.com/*"
+ - url: "service1-dot-my_app-dev.appspot.com/*"
module: service1
- url: "*/service1/*"
module: service1
- - url: "service2.my_app.com/*"
+ - url: "service2-dev.my_app.com/*"
module: service2
- - url: "service2-dot-my_app.appspot.com/*"
+ - url: "service2-dot-my_app-dev.appspot.com/*"
module: service2