September 10, 2010

Spring 3 + maven2 + Google App Engine: Part 4 [Deployment]

Now you should have an easy application that is working and you'd like to deploy to Google's servers. Let's take a look at the appengine-web.xml file located in the project's /WEB-INF folder. This file contains all of the settings related to the appengine web application.

Here is an example appengine-web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>my-unique-app-name</application>
    <!--  This variable is defined in your POM file -->
    <version>${gae.application.version}</version>
    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties"/>
    </system-properties>
    <sessions-enabled>true</sessions-enabled>
    <!--
    <static-files>
        <include path="/site/**" expiration="1d 12h" />
    </static-files>
    -->
</appengine-web-app>

Notice that the application node is filled out with your unique Google App Engine application name which was created during the creation of the application.

If you take a look at part 2 of this series which goes more in depth on the POM file, you will notice at the bottom of the file there are several properties/variables set. One of these is the application version, which correspond to the different versions you can deploy to Google's servers. Notice that in the POM file, there are several version setup using different profiles. When you deploy your application, you can setup different version numbers for testing, integration builds, staging or other required environments. The deployed version will follow the following URL format:

For a version of "0":
http://0.latest.your-unique-appengine-name.appspot.com/

For a version of "2":
http://2.latest.your-unique-appengine-name.appspot.com/

I recommend using the "0" version for testing, "1" for staging and "2" for production. This allows you to release to test and stage versions of your application, which will still use the same database, without releasing to production.

Now, onto how to deploy. If you have been following this series, you will be using the GAE plugin for Maven, which comes with many handy goals. Using the "gae:deploy" will deploy your application to the Google servers according to the appengine-web.xml file.

NOTE: I recommend creating batch files to deploy your application. Here is a very basic example of a bash script file:

#!/bin/bash
mvn gae:deploy -Dmaven.test.skip=true -Prelease-build

I have set the profile to "release-build" and decided to skip my test when doing my releases. Typically you will need to provide your email and password on the Google App Engine account to deploy.

Lastly, once your have a successful deployment, follow these directions.

  1. Check your application by using the URL format given above
  2. Once you have verified the version has been uploaded, goto http://www.appspot.com, login and goto your application's main page
  3. Look for "Application Versions" and goto those settings
  4. Select the "2" to be your version to be the "default"

Congratulations, you have the necessary skills to create an application using Google App Engine and Spring 3.0!

Later post will give more insights and tricks that I have learned while developing a full application exclusively hosted on Google App Engine.

7 comments:

Eduardo Costa said...

You said: "If you take a look at part 2 of this series" - Could be easier with a direct link... :)

Unknown said...

Good idea! It's now done :-)

divi said...

thanks for your details it's very nice and useful web design company in velachery

Anbarasan14 said...

Thanks for your blog; I really prefer this blog for my future reference.
English Speaking Classes in Mulund
IELTS Classes in Mulund
German Classes in Mulund
French Classes in Mulund
Spoken English Classes in Chennai
IELTS Coaching in Chennai
English Speaking Classes in Mumbai
IELTS Classes in Mumbai
Spoken English Class in Anna Nagar
IELTS Coaching in Tambaram

kaushik said...

Awesome article! You are providing us very valid information. This is worth reading. Keep sharing more such articles.
Automation Anywhere Training in Chennai
Automation courses in Chennai
Machine Learning Training in Chennai
Blue Prism Training in Chennai
UiPath Training in Chennai
Automation Anywhere Training in OMR
Automation Anywhere Training in Porur
Automation Anywhere Training in T Nagar
Automation Anywhere Training in Velachery

Adhuntt said...

Great blog thanks for sharing Searching for a SEO company in Chennai that can bring your brand to the top results page on Google? Look no further - Adhuntt Media, with their team of SEO experts, can make it happen that too for the best value.
digital marketing company in chennai

Bernot said...

Good information. Hiring the best digital marketing company leads to develop your business in a short period.
digital marketing company in chennai, SEO company in chennai, digital Marketing Agency