Development/OnlineGlom/Deployment

From Glom
< Development‎ | OnlineGlom
Revision as of 02:48, 20 January 2012 by Murrayc (Talk | contribs)

Jump to: navigation, search

OnlineGlom Deployment

OnlineGlom really isn't ready for deployment, but you can try it locally. Nevertheless, here are some deployment instructions so that it's documented as the development progresses.

Tomcat

We will install OnlineGlom in a Tomcat server. The instructions for installing tomcat are beyond the scope of this document. However, this might help on Ubuntu: https://help.ubuntu.com/11.10/serverguide/C/tomcat.html

Dependencies

On Ubuntu, you will need these packages on the server: tomcat, postgresql, openjdk6-jdk, libjava-libglom-java.

TODO: Use openjdk6-jre instead of openjdk6-jdk when gwt-glom is packaged instead of needing to be built.

Also, the glom-utils package might be useful to deploy the Glom example files. You should not need the glom package.

.glom file and configuration

These instructions assume that you have a PostgreSQL setup on your server with your glom database already loaded.

  • Choose a directory for your .glom files on the server, such as /home/ubuntu/onlineglom_files/
  • Create an onlineglom.properties text file at /var/lib/tomcat7/shared/classes, based on the sample file. This should specify the directory containing the .glom files, and the database connection details..
  • Copy your .glom files to the directory and somehow ensure that the PostgreSQL server contains the database and its data. This is simpler when deploying the Glom examples.

Configuring Tomcat

java.library.path

  • Tomcat needs to be able to "see" the .so from java-libglom. Therefore, unless you are using a java-libglom package, which places the .so file in /usr/lib, you may need to edit /etc/default/tomcat7 and add the absolute path to the directory that has the java-libglom .so. This is apparently necessary even if you installed the libjava-libglom-java Ubuntu package, which puts the .so file in /usr/lib/jni/, or if you installed the .so file to /usr/local/lib.

Look for 'java.library.path' and add '/home/yourusername/gnome/install/lib64' to the first entry of that setting. Here's how that setting might look on an example server:

JAVA_OPTS="${JAVA_OPTS} -XX:+UseConcMarkSweepGC -Djava.library.path=/home/ben/gnome/install/lib64:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib"

Installing the java-libglom jar

Once tomcat is configured, copy the java-libglom jar to the tomcat lib directory. Since java-libglom uses JNI it can only be loaded once and must not be included in the gwt-glom .war file. The proper place for it is $CATALINA_HOME/lib which is defined as /usr/share/tomcat6/lib/ on Ubuntu 10.04. More information about this issue can be found in the [release notes in the "JNI Based Applications" section:

For instance, this command copies the jar in into the correct directory:

sudo cp /usr/share/java/java-libglom-1.21.1.jar /usr/share/tomcat7/lib/

Deploying gwt-glom

TODO: Package gwt-glom for Ubuntu.

You should now build gwt-glom, like so. These instructions assume that you are in the gwt-glom source directory.

mvn clean package

Copy the .war file to your server:

scp target/gwt-glom-1.0-SNAPSHOT.war servername.com:

Deploy the war file:

  • Stop tomcat:
sudo service tomcat7 stop

or, on older distro versions:

sudo /etc/init.d/tomcat6 stop
  • Copy the war file to the deployment directory:
sudo cp ~/gwt-glom-1.0-SNAPSHOT.war /var/lib/tomcat7/webapps/OnlineGlom.war
  • Start tomcat
sudo service tomcat7 start

or, on older distro versions:

sudo /etc/init.d/tomcat6 start

You can test your deployment by viewing http://yourserver.com:8080/OnlineGlom in your browser.

Deploying Example Files

You can use the glom_create_from_example command-line utility to create a database, with data, on the server, and the .glom file that uses it. For instance;

 glom_create_from_example --input=/home/ubuntu/onlineglom/glom/examples/example_music_collection.glom --output-path=/home/ubuntu/onlineglom_files/ --output-name="music_collection.glom" --server-hostname=localhost --server-port=5432 --server-username=onlineglom
 Using the PostgreSQL server with host: localhost
 Please enter the PostgreSQL server's password for the user onlineglom:

Investigating Problems

The web page will report some configuration problems, such as an incorrect filepath for the .glom files's directory, or a problem loading the java-libglom .so file.

You can also check the log file, such as /var/log/tomcat7/onlineglom.log .