Developing on the Google Cloud Platform is ideal. We’re able to use loads of tools and take advantage of these features at a low cost to both ourselves and our clients. Time is also saved because of how quickly we can develop these apps.
Through our experience, we’ve started to take advantage a variety of App Engine’s advanced features. Today, I’m going to talk about one specifically: application versioning. It’s important to note that this feature comes out of the box, at no extra cost, with no system configuration, and no set-up needed.
When we develop, we often have many branches in our application. Whether it’s our production branch, staging, or testing branch, there comes a time when we can no longer test the application on our local machine. This is where versioning really helps us out.
Every application on that runs on App Engine has a small configuration file. Depending on the language you are using, it is either a yaml file or a xml file. Below is an example of a python yaml file.
On line 2, we specify the version (dev). This can be version 1, staging, new, dev, whatever (as long as it contains letters, digits, or hyphens). Then, when this application is deployed, I can access that version by prefixing the version to the url. For example, let’s say I want to test out my branch (dev). I change the version to dev and then deploy. Instead of navigating to myapp.appspot.com, I navigate to dev.myapp.appspot.com. The application I just deployed is served at this URL and my other visitors going to myapp.appspot.com will not experience any disuption.
Futhermore, it’s really easy to change which version is the ‘served’ by visiting the normal url. Here’s a list of all the versions that I have deployed for 'myapp'. If I want version 10 to become the new version, all I do is check the box, make it the default version, and the application will now serve version 10 to the normal domain. This is extremely powerful if you need to push out new features or roll them back.
In the picture below, version 11 is being served by the normal url (myapp.appspot.com), but I can test out the new features I’m making in dev.myapp.appspot.com.
It’s important to note that a full set of logs is present for each version. Below is a picture of the logging screen in App Engine. You can see that I can toggle which version I’m debugging so I can hop between branches easily.
If you would like to conduct A/B testing, you can split traffic based on IP addresses and point them to different versions.
Versioning is a pretty cool, out-of-the-box feature that has proved to be invaluable for us when developing on App Engine. If you would like to talk in more detail about any of the information above, or anything in regards to the Google Cloud Platform, please don’t hesitate to reach out to our experts.Originally published on March 30, 2015