My favorites | Sign in
Google
             
Search
for
Updated Mar 01 (2 days ago) by nehasi...@google.com
RunningOutsideAppengine  
Explains options for running the code without app engine.

Running Living Stories without App Engine

Obviously, the easiest way to try out Living Stories is just to deploy the code on App Engine. However, you may want to use different infrastructure for a variety of reasons. If so, there are two main ways to do this:

1. Download the standard appengine version of the codebase and run it on AppScale. This lets you run the code with few changes or additional work on your end. However, the infrastructure you deploy on must be supported by AppScale (e.g. Amazon EC2)

2. Customize the code to work with your own servlet container and database servers. See below for an example of how to get things working in Tomcat/MySQL.

Demo Tomcat/MySQL deployment

We have created a simple demo of how one might customize the code to run in a different servlet/datastore environment--in this case, Tomcat/MySQL. Since our data services are built on the Java Data Objects API (JDO), they are meant to be relatively portable and should work with a number of different JDO implementations.

These instructions have been tested in Ubuntu, and the commands shown should work in it and other Debian-based Linux distributions. Installation instructions for other operating systems may differ slightly; refer to the documentation for more detailed information.

Also note that these instructions assume you have the appengine eclipse plugin installed, since that automatically gives you the DataNucleus support and builder configurations. If you don't have it and don't want it, refer to the 'Troubleshooting' section for more information.

  1. Install Tomcat. In Ubuntu, you can use
  2.    apt-get install tomcat6
  3. Install the Tomcat Admin interface. This step is optional, but makes deploying and managing your webapps a bit easier.
  4.    apt-get install tomcat6-admin
  5. Install mysql.
  6.    apt-get mysql-server
  7. Set up and start MySQL and create your living stories database.
  8.    create database lsps;
  9. Download the tomcat demo code. Note that this code differs from the appengine version in several significant ways. See below for details.
  10.    hg clone https://tomcat-demo.living-stories.googlecode.com/hg/ tomcat-demo
  11. Import the living story code into eclipse and build the project (Ensure that gxpc.sh and the datanucleus enhancer run). Also do a GWT compile.
  12. Go into src/META-INF/jdoconfig.xml, and set your username/password/connectionUrl values for your database.
  13. Package the output directory into a .war file.
  14.    cd war/
       jar -cvf lsps.war *
  15. Visit the Tomcat manager interface and upload the .war file (in the 'deploy' section). This step assumes you've installed the admin interface. If not, you'll want to copy your .war into the webapps directory of your tomcat installation. Consult the documentation to determine where it is.

Troubleshooting

  • No App Engine Eclipse plugin: The plugin is primarily used in these steps for the DataNucleus Enhancer builder. If you don't have it, you may want to download the DataNucleus Eclipse plugin instead. Alternatively, you may want to download the enhancer jar separately and write your own Ant build script to enhance your data entities.
  • 'Class not enhanced' exceptions: The DataNucleus enhancer either did not run or encountered an error. Try going to 'Project > Clean' to clear out the generated files and get the enhancer to run again. You may also want to ensure that your enhancer is set up properly--the App Engine Eclipse plugin should do this automatically; if you don't have it, refer to the previous troubleshooting item.
  • Java security exceptions: If you are running Tomcat with a Java security manager, you may need to modify its configuration to give your webapp the appropriate permissions. For our Tomcat installation, this file was under YOUR_TOMCAT_BASE/conf/policy.d/04webapps.policy. For testing purposes, you can give the webapp full permissions, but you may want to whittle this down a bit in production. (TODO: determine what the minimal set of permissions actually is)
  •    grant {
         permission java.security.AllPermission;
       };

Differences between App Engine and Tomcat code

When customizing code for your own infrastructure, you may want to pay attention to the following roadblocks we encountered while porting the code off of App Engine.


Sign in to add a comment
Powered by Google Project Hosting