App Engine Dev Tips #6 : Understand Application Versions

App Engine makes it easy for you to have multiple versions of the same application in the cloud. This is a very handy feature and allows you to create a new version of your application that you can test without your normal users getting affected by it.

But it is important to understand what is going on behind the scenes. Once you get it, you will find yourself using this feature a lot more. First thing to keep in mind is that the following 2 points:

  • Application ID is a unique way to identify your application. For e.g. if your Application ID is gaetips123, then users go to your application by gaetips123.appspot.com
  • Application versioning allows you to have different versions of the same application. In fact all of them are running in the cloud, except that only one version is the default version. So when people visit your application i.e. gaetips123.appspot.com , they are in fact visiting the version that is marked as the default version of your application.

Let us understand this via an example:

  1. I have an application that I have deployed for the first time. It is present at http://gaetips123.appspot.com
  2. To check out the current versions of your application, you should log in to http://appengine.google.com and visit the Versions option in the Main section as shown below:

    Screen Shot 2013-09-29 at 11.17.18 AM

  3. You will notice that there is only one version “1” and it has been marked as default. Now when you visit http://gaetips123.appspot.com, it will lead to this default version. In fact you can also get to any specific version by specifying <versionid>.appid.appspot.com. In this case, since the version is “1”, I can access it via http://1.gaetips123.appspot.com

Now, let me deploy another version of the application. To do that:

  1. I make some local changes to the files.
  2. Then I select Google -> Deploy to App Engine. This brings up the Deploy dialog as shown below. If you simply choose to click on the Deploy button now, it will overwrite the same version i.e. 1 of the application with the latest code.
  3. Let us not overwrite the version “1” of the application. Instead click on the App Engine project settings link and you will be presented Properties dialog. Notice that in the Deployment section, there is the Application ID and the Version. The version is currently at “1” .. but let us make it to 2. In fact, you can even use names like qa or test or dev or private or whatever, that makes more logical sense to you.

    Screen Shot 2013-09-29 at 11.18.00 AM

  4. I will change the version to and then deploy the application.

Once it is deployed, the important thing to note is that by default the new version of your application will NOT be made the default version. This is a common trap that newbies can fall into.

To understand that, let us visit our Admin console again and look at the versions. You will find the following:

  1. You will find that both and versions are deployed but is still the default version. This is the right thing to do because you do not want the new version to suddenly become the default version being served to users. Users might confused and you want to maybe test things out before making the new version as the default version.

    Screen Shot 2013-09-29 at 11.17.35 AM

  2. You can still access both the versions by specifying their version prefixes. So 1.gaetips123.appspot.com and 2.gaetips123.appspot.com will get you to the respective versions.
  3. To make version as the default version, you will need to select the radio button next to that version and click on the Make Default button. 
  4. This will ensure that any visits now to gaetips123.appspot.com will lead to the default version, which is version 2.

Few other key points for Versions:

  1. The Datastore is common to all the versions. It is not specific to each version. So be aware of that. In fact be very careful.
  2. The Logs are available for each version separately. So when you visit the Logs section, you can select the specific version to see its logs.
  3. The Scheduler is only for the default version and not other versions.

Now that you have understood how versions work, do use it smartly to keep multiple versions running. It is ideally suited to a Testing scenario for your new version, where you want to ensure that everything works fine in the real cloud environment before you can make the final version available.

Check out all the App Engine Development Tips.

About these ads

About rominirani

Google Developer Expert Cloud 2014. Harnessing the power of software by learning, teaching and developing simple solutions. I love learning about new technologies and teaching it to others.
This entry was posted in Cloud Computing, Google App Engine, Tips. Bookmark the permalink.

One Response to App Engine Dev Tips #6 : Understand Application Versions

  1. Pingback: App Engine Dev Tips for Newbies #7 : Datastore Tips | iRomin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s