Difference between revisions of "Development/OnlineGlom/Deployment"

From Glom
Jump to: navigation, search
(Configuring Tomcat)
(Remove mentions of libglom and jhbuild now that gwt-glom is all Java.)
 
(17 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
OnlineGlom really isn't ready for deployment, but you can [[Development/OnlineGlom|try it locally]]. Nevertheless, here are some deployment instructions so that it's documented as the development progresses.
 
OnlineGlom really isn't ready for deployment, but you can [[Development/OnlineGlom|try it locally]]. Nevertheless, here are some deployment instructions so that it's documented as the development progresses.
 +
 +
And here is an [[OnlineGlom Installation log]] of the latest installation that Murray did on an Ubuntu Precise AWS instance.
  
 
== Tomcat ==
 
== Tomcat ==
Line 10: Line 12:
 
== Dependencies ==
 
== Dependencies ==
  
On Ubuntu, you will need these packages on the server: tomcat, postgresql, openjdk6-jdk, libglom-1.20.
+
On Ubuntu, you will need these packages on the server: tomcat, postgresql, openjdk6-jdk
  
 
TODO: Use openjdk6-jre instead of openjdk6-jdk when gwt-glom is packaged instead of needing to be built.
 
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 Glom example files. You should not need the glom package.
+
Also, the glom-utils package might be useful to [[Development/OnlineGlom/Deployment#Deploying_Example_Files|deploy the Glom example files]]. You should not need the glom package. The latest versions of these are in a separate PPA for now, so you will need to add the PPA:
 +
 
 +
<pre>sudo apt-add-repository ppa:openismus-team/openismus-glom-unstable</pre>
  
 
== .glom file and configuration ==
 
== .glom file and configuration ==
Line 20: Line 24:
 
These instructions assume that you have a PostgreSQL setup on your server with your glom database already loaded.
 
These instructions assume that you have a PostgreSQL setup on your server with your glom database already loaded.
  
* The first thing you need to do is scp your .glom file to your server.  
+
* 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 [http://gitorious.org/online-glom/gwt-glom/blobs/master/src/main/resources/onlineglom.properties.sample onlineglom.properties 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 [[Development/OnlineGlom/Deployment#Deploying_Example_Files|deploying the Glom examples]].
  
* Now set your PostgreSQL username, password and the location of the glom file in the OnlineGlom configuration properties file:
+
== Configuring Tomcat ==
: http://gitorious.org/online-glom/gwt-glom/blobs/master/src/main/resources/onlineglom.properties
+
  
== Deploying java-libglom ==
+
== Deploying gwt-glom ==
 
+
For Ubuntu Oneiric, we have a libjava-libglom-java package but we have not yet confirmed that this works for deployment. For now, you should build from source.
+
 
+
NOTE: This assumes that the server has the same architecture and installed dependencies as your local machine.
+
+
You must [[Development/OnlineGlom#Dependencies|build java-libglom]] in your home directory on your server. However, you don't need to install the jar into a local maven repository so you don't need to install maven2 with apt-get and you do not need to specify --enable-maven-install to configure.
+
 
+
TODO: See if it works with the new libjava-libglom-java Ubuntu package from our PPA.
+
  
=== Using jhbuild ===
+
TODO: Package gwt-glom for Ubuntu.
  
With jhbuild, you could do this:
+
You should now build gwt-glom, like so. These instructions assume that you are in the gwt-glom source directory.
  
* Copy java-libglom.modules to your home directory and edit it to remove this string:
 
<code>
 
autogenargs="--enable-maven-install"
 
</code>
 
* Edit ~/.jhbuildrc and change the moduleset option to the location of the java-libglom.modules file you just copied into your home directory. Change this line:
 
<code>
 
moduleset = 'http://gitorious.org/online-glom/java-libglom/blobs/raw/master/tools/build/java-libglom.modules'
 
</code>
 
::to this:
 
<code>
 
moduleset = 'file://' + os.path.expanduser('~/java-libglom.modules')
 
</code>
 
* If you've already setup java-libglom and you just want to use the latest version from git master, run this set of commands:
 
 
<pre>
 
<pre>
jhbuild cleanone java-libglom && jhbuild buildone java-libglom
+
mvn clean package
 
</pre>
 
</pre>
  
=== Configuring Tomcat ===
+
Copy the .war file to your server:
 
+
* 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:
+
 
<pre>
 
<pre>
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"
+
scp target/gwt-glom*.war servername.com:
 
</pre>
 
</pre>
  
You only need to configure tomcat like this once. NOTE: This is a big hack that will go away when java-libglom packages show up for various Linux distros.
 
  
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 war. 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 Tomcat 6 release notes in the "JNI Based Applications" section:
+
ssh to the server and deploy the war file:
: http://tomcat.apache.org/tomcat-6.0-doc/RELEASE-NOTES.txt
+
* Stop tomcat:
: This is the command to run to copy the jar in into the correct directory:
+
<pre>
+
sudo cp ~/gnome/install/share/java/java-libglom-0.1.jar /usr/share/tomcat6/lib/
+
</pre>
+
 
+
== Deploying gwt-glom ==
+
 
+
* Alright stop. It's compile time! These instructions assume your in the gwt-glom directory.
+
:* Clean-out the target directory:
+
<pre>
+
rm -rf target/* target/.*
+
</pre>
+
: This isn't always necessary but I do it every time because I've encountered too many problems with mismatched GWT versions.
+
:* Now compile the Java code, run the GWT to Javascript compilation and package up the war:
+
<pre>
+
mvn clean package
+
</pre>
+
:* And scp the war to your server:
+
<pre>
+
scp target/gwt-glom-1.0-SNAPSHOT.war servername.com:
+
</pre>
+
 
+
* Finally we can deploy the war.
+
:* Stop tomcat:
+
 
<pre>
 
<pre>
 
sudo service tomcat7 stop
 
sudo service tomcat7 stop
Line 100: Line 55:
 
sudo /etc/init.d/tomcat6 stop
 
sudo /etc/init.d/tomcat6 stop
 
</pre>
 
</pre>
:* Copy the war to the deployment directory:
+
* Copy the war file to the deployment directory:
 
<pre>
 
<pre>
sudo cp ~/gwt-glom-1.0-SNAPSHOT.war /var/lib/tomcat7/webapps/OnlineGlom.war
+
sudo cp ~/gwt-glom-1.21.8.1.war /var/lib/tomcat7/webapps/OnlineGlom.war
 
</pre>
 
</pre>
:* Start tomcat
+
* Start tomcat:
 
<pre>
 
<pre>
 
sudo service tomcat7 start
 
sudo service tomcat7 start
Line 112: Line 67:
 
sudo /etc/init.d/tomcat6 start
 
sudo /etc/init.d/tomcat6 start
 
</pre>
 
</pre>
:* You can test your deployment by loading http://yourserver.com:8080/OnlineGlom into your browser.
+
 
 +
You can test your deployment by viewing http://yourserver.com:8080/OnlineGlom in your browser.
  
 
== Deploying Example Files ==
 
== Deploying Example Files ==
Line 124: Line 80:
 
== Investigating Problems ==
 
== 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.
+
The web page will report some common configuration problems, such as an incorrect filepath for the .glom files's directory,
  
 
You can also check the log file, such as /var/log/tomcat7/onlineglom.log .
 
You can also check the log file, such as /var/log/tomcat7/onlineglom.log .

Latest revision as of 00:21, 16 May 2012

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.

And here is an OnlineGlom Installation log of the latest installation that Murray did on an Ubuntu Precise AWS instance.

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

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. The latest versions of these are in a separate PPA for now, so you will need to add the PPA:

sudo apt-add-repository ppa:openismus-team/openismus-glom-unstable

.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 onlineglom.properties 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

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*.war servername.com:


ssh to the server and 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.21.8.1.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 common configuration problems, such as an incorrect filepath for the .glom files's directory,

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