Google App Engin中生产和测试环境的最佳做法 [英] Best practice for production and test environments in Google App Engin

查看:70
本文介绍了Google App Engin中生产和测试环境的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google App Engine中用于生产和测试(登台)环境的最佳做法是什么?设置单独的项目是个好主意吗?

What are the best practices for production and test (staging) environments in Google App Engine? Is it a good idea to setup separate projects?

我们还使用Google Cloud Storage和Cloud SQL.我想防止意外发生,因为当某人打算在测试中工作时会错误地在生产中工作.

We also use Google Cloud Storage and Cloud SQL. I'd like to prevent accidents where someone is mistakenly working in production when they intend to work in test.

我们将在GCS中存储很多内容.据我了解,GCS环境在项目之间是分开的.这对我们来说可能是理想的.但是,如果我们要复制产品进行测试,是否可以将GCS从一个应用程序复制到另一个应用程序?

We'll be storing a lot of stuff in GCS. From my understanding GCS environments are separate between projects. This can be desirable for us. But, if we want to copy product to test, is it possible to duplicate GCS from one app to another?

期待听到其他人如何做到这一点.

Looking forward to hearing how others do this.

推荐答案

在技术上,布鲁耶尔的答案是正确的,您可以对应用程序进行版本控制,也可以使用单独的项目.

Bruyere's answer is technically right, you can either version your app or use separate projects.

在实践中,我已经完成了这两项工作,而您总是出于许多充分的理由而最终需要将项目分开:

In practice, I've done both and you always end up needing to separate the projects for a ton of good reasons :

  • 您可能不希望同一个人有权更新暂存环境(例如所有开发人员都具有此功能)和生产环境(通常仅限于技术负责人或质量检查小组,或者您持续集成服务器)
  • 隔离两个App Engine版本并不是那么容易,尤其是在处理cron作业,电子邮件或XMPP接收时
  • 您可能不希望同一个人能够读取/写入登台数据和产品数据
  • 您要确保App Engine产品应用未写入暂存Cloud Storage存储桶.如果它们属于同一项目,则默认情况下是可能的

我的建议是将与环境相关的数据(云存储桶,Cloud SQL url等)存储在应用程序加载的配置文件中.如果您使用Java,则我个人会使用Maven根据两个配置文件(dev和prod,dev是默认配置文件)填充的属性文件.

My recommendation is to store the environment related data (cloud storage bucket, Cloud SQL url etc) in a configuration file that is loaded by the application. If you use Java, I personnally use a properties file that is populated by Maven based on two profiles (dev and prod, dev being the default one).

另一个重要的方面是从一开始就将环境分开.一旦开始假定两种环境都可以在同一个应用程序中运行,则将基于该假设来开发许多代码,并且将很难移回两个不同的项目.

Another important point is to separate environments from the start. Once you've started assuming that both environments will live in the same application, a lot of your code will be developed based on that assumption and it will be harder to move back to two different projects.

这篇关于Google App Engin中生产和测试环境的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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