views:

169

answers:

1

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. 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. Staging version and Production version share the same Datastore
  2. Staging version and Production version share the same logs

Regarding the first point, I don't know if it could be "fixed" using the new namespaces python API.

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

application: foonamestaging

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.

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?

+3  A: 

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.

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

geofrank
I also went with the 2nd option in the question, but I started before separate namespaces were available as well.
Cuga
@systempuntoout I think it's possible : "The bulk loader supports a --namespace=NAMESPACE flag that allows you to specify the namespace to use. Each namespace is handled separately and, if you want to access all namespaces, you will need to iterate through them." from http://code.google.com/appengine/docs/python/multitenancy/multitenancy.html#Using_Namespaces_with_the_Bulkloader
Franck
@Franck sounds interesting, so option A seems feasible and clean
systempuntoout
Other Uses for the Namespaces API : [Creating Separate Datastore Instances for Testing and Production](http://code.google.com/intl/it-IT/appengine/docs/python/multitenancy/namespaces.html)
systempuntoout