本文介绍了如何在Google App Engine上设置分段环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正确配置开发服务器和生产服务器,我想在Google App Engine上设置一个 Staging 环境,测试新的开发版本,然后再部署到生产中。

Having properly configured a Development server and a Production server, I would like to set up a Staging environment on Google App Engine useful to test new developed versions live before deploying them to production.

我知道两种不同的方法:

I know two different approaches:

A。第一个选项是修改 版本参数。

A. The first option is by modifying the app.yaml version parameter.

version: app-staging

我不喜欢这种方法是生产数据被我的分期测试污染,因为(如果我错了,更正我) :

What I don't like of this approach is that Production data is polluted with my staging tests because (correct me if I'm wrong):


  1. 分段版本和生产版本共享相同的数据存储


  1. Staging version and Production version share the same Datastore

B。第二个选项是修改 应用参数

B. The second option is by modifying the app.yaml application parameter

application: foonamestaging

使用这种方法,我将完全创建一个第二个应用程序独立于生产版本。

我看到的唯一缺点是我被迫配置第二个应用程序(管理员设置)。

使用backup\restore工具,如这个解决方案也很好。

with this approach, I would create a second application totally independent from the Production version.
The only drawback I see is that I'm forced to configure a second application (administrators set up).
With a backup\restore tool like Gaebar this solution works well too.

什么样的方法是用来为您的Web应用程序设置一个分段环境?

此外,您有任何自动化脚本可以更改在部署之前,您可以使用yaml?

What kind of approach are you using to set up a staging environment for your web application?
Also, do you have any automated script to change the yaml before deploying?

推荐答案

我在设置中选择了第二个选项,因为它是最快的解决方案,我没有做任何脚本来更改部署的应用程序参数。

I chose the second option in my set-up, because it was the quickest solution, and I didn't make any script to change the application-parameter on deployment yet.

但是,我现在看到的方式是选项A是一个更清洁的解决方案。您可以使用几个代码行根据版本切换数据存储区命名空间,您可以从环境变量CURRENT_VERSION_ID动态获取文档,如下所述:

But the way I see it now, option A is a cleaner solution. You can with a couple of code lines switch the datastore namespace based on the version, which you can get dynamically from the environmental variable CURRENT_VERSION_ID as documented here: http://code.google.com/appengine/docs/python/runtime.html#The_Environment

这篇关于如何在Google App Engine上设置分段环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 03:49