If you google for ’Continuous Deployment AppEngine you will see that there is not much information about it. Since we needed this for our Continuous Integration process we figured out how to get it going on a windows machine with NAnt.
To deploy to AppEngine from the commandline you will need the Google AppEngine Java/Python SDK. We will use the Java SDK in this article and scripts.
Running the GAE appcfg.cmd tool
One of the biggest problems of the GAE SDK is that it needs to have the password supplied on the commandline instead of parameterized. After some searching around I found a neat little trick to fix this; echo your password to the console and pipe this as input to the GAE appcfg.cmd which is requesting your password. When combining this with the @ (not show result of command to console.out) it als prevents the password from showing up in your logfiles.
@echo mypassword | appcfg.cmd --email@example.com --passin update path-to-your-unpacked-app-wardir
Creating a WAR archive from your play project
When you use the Play framework for your google appengine application you can easily deploy to GAE using the following command:
But this is not easily to automate. To create a Web Application Archive of your AppEngine Appliction you use the following command (play 1.2.4):
play war myplayprojectname -o output-dir-warname --deps
This creates a unpacked war directory which is easy to use with the GAE update command. (red: add –zip to the commandline to create a real .war file).
Merging it all with NAnt
Once you have your WAR directory ready you can use the following build script which we have made available on GitHub to automate your deploy to AppEngine. See readme on GitHub about the additional parameters which you need to supply to the script.