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.

9 comments:

Eduardo Costa said...

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

Mike! said...

Good idea! It's now done :-)

ajay ak said...

Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
Software testing course in chennai

Sadhana Rathore said...

Learned a lot from your post and it is really good. Share more tech updates regularly.
ui ux design course in Chennai
ui design course in chennai
ui developer course in chennai
Ethical Hacking course in Chennai
Web Designing Course in chennai
Web development training in chennai
PHP Training in Chennai
ui ux design course in Anna Nagar
ui ux design course in Vadapalani
ui ux design course in Thiruvanmiyur

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

The India said...

Delhi Mathura Vrindavan Tour by Bus
Agra Mathura Tour Package by Bus
Delhi to Agra tour by Volvo bus
Online Bus Ticket Booking for Agra
Same Day Agra Tour
Same Day Agra Tour by Bus

impressbss said...

Nice blog! Full of informative ideas. Thank you, keep sharing.
web design company in chennai