Dashboard > Community Wiki > ... > Deployment > How to install on Resin
How to install on Resin Log In View a printable version of the current page.

Added by GrĂ©gory Joseph , last edited by Boris Kraft on Jun 23, 2008  (view change)
Labels: 

Installation of the Magnolia Content Management System on Resin

The short answer is that you cannot completely run Magnolia 2.0 on Resin. Specifically, you will not be able to push content from the author instance to the public instance because an incorrect Authorization header is sent by Magnolia 2.0. Tomcat doesn't care about this, but Resin is a little more strict. Using Netcat, I have confirmed this to be the case.

The good news is that this issue is corrected in Magnolia 2.02. You will, however, have to manually build it from the subversion repository. This is not as difficult as it first appears. I have successfully compiled Magnolia 2.02 under Linux using Maven and Subversion.

System Requirements

This setup has been tested under the following system. It will most likely work under other Linux installations, but I do not have the time to test this. I have not, and probably will not, test it under Windows, as I do not have access to such a box.

Getting Magnolia 2.0 from Sourceforge

You don't actually use How to install on Resin^Magnolia 2.0. But, the Magnolia 2.02 build system does not create any JCR repositories. Thus, we will steal them from the Magnolia 2.0 binary build. Grab and install magnolia_2_0_linux_041110.bin. On Fedora Core 3, the installation works out of the box.

Getting Magnolia 2.02 from Subversion

First, download and install Subversion. You don't actually have to know how to use it, just be able to install it and configure it correctly. Under Fedora Core, I simply perform a yum install subversion, and it's set. Then, to pull from the Magnolia 2.02 repository, execute the following command:

svn export http://svn.magnolia.info/svn/magnolia/branches/magnolia2.02

The magnolia2.02 directory should now be present. If successful, Subversion will print a message similar to the following:

Exported revision 458.

Using Maven to Build Magnolia

Maven is the build system used by Magnolia. Installing Maven is not particularly difficult; just read the provided documentation and you'll be fine. Please do remember to add MAVEN_HOME to your .bash_profile. Now, enter the magnolia2.02 directory and type maven. The build proces should begin, and all pre-requisite dependencies will be downloaded automatically. You will not be able to download Javamail. This is okay, so ignore the following error:

Attempting to download javamail-1.3.1.jar.d
Error retrieving artifact from 
   [http://www.day.com/maven/javamail/jars/javamail-1.3.1.jar]: 
   java.io.IOException: Forbidden.

Paradoxically, you'll see the following message when Maven has completed:

BUILD FAILED
File...... /home/barik/.maven/cache/maven-xdoc-plugin-1.8/plugin.jelly
Element... attainGoal
Line...... 687
Column.... 48
No goal [taglib:register]
Total time: 5 minutes 40 seconds
Finished at: Mon Mar 28 11:24:58 EST 2005

Ignore it, for Magnolia has successfully built. You will now find a target directory directly your magnolia2.02 directory. We are interested solely in the magnolia.war file.

Downloading Resin

I used How to install on Resin^Resin 3.0.12. Other versions of Resin may work, but I make no guarantees. You will need to extract the tarball twice, once for the author instance, and once again for the public instance. I call the directories public, and author. The actual names do not matter, so you can call it whatever you like to fit your directory hierarchy. Thus, my directory structure mimicks that of Tomcat:

/magnolia
   author/
     bin/httpd.sh (resin author instance)
     ...
   public/
     bin/httpd.sh (resin public instance)
     ...

Common Magnolia Configuration

The following steps must be performed on both the public and author instances of Resin. The simplest way to
do this is to perform the operations on the author instance, and then copy your magnolia directory over to the public instance.

For both author and public, place magnolia.war from your source target directory into the webapps directory. This will extract the war file. Once extracted, immediately shutdown Resin, as the default configuration for Magnolia won't work anyway. From here on out, I will call the webapps/magnolia directory $AUTHOR_HOME and $PUBLIC_HOME when referring to a specific instance, and $MAGNOLIA_HOME when the changes are applicable to both the author and public site.

As a guide, your directory structure will look the following after extraction:

/magnolia
   author/
     bin/httpd.sh (resin author instance)
     webapps/
       magnolia/ ($AUTHOR_HOME)
         admindocroot/
         ...
         WEB-INF/
           config/
   public/
     bin/httpd.sh (resin public instance)
     webapps/
       magnolia/ ($PUBLIC_HOME)
         admindocroot/
         ...
         WEB-INF/
           config/

As it extracts, you'll get an error on your Resin console:

[11:48:02.330] com.caucho.config.LineConfigException: WEB-INF/web.xml:7: <description> 
is an unexpected tag (parent <web-app> starts at 5). 
Check for duplicate and out-of-order tags.

We will fix this shortly.

Relative Paths

But first, Resin does not like relative paths, and we must change several of the configuration files. These are basic search and replace operations. Under $MAGNOLIA_HOME/WEB-INF/config/, replace all occurrences of '..' (two periods) with '.' (a single period) in the following files:

  • In config.xml, 12 occurrences.
  • In log4j.properties, 5 occurrences.
  • In web.xml, 7 occurrences.

All path information will now be correct.

Common web.xml Changes

There are several other changes that must also be made to web.xml; let's perform them now. I don't have time to investigate why, but Resin does not like the <web-app> opening XML element. Change:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
version="2.4">

to simply:

<web-app>

Also, in web.xml, add:

<servlet servlet-name="file" 
servlet-class="com.caucho.servlets.FileServlet" />

and then add respective mappings to allow static content, such as images, to load, before the magnolia servlet-mapping:

<servlet-mapping> 
<servlet-name>file</servlet-name> 
<url-pattern>/admindocroot/*</url-pattern> 
</servlet-mapping> 

<servlet-mapping> 
<servlet-name>file</servlet-name> 
<url-pattern>/docroot/*</url-pattern> 
</servlet-mapping> 

... (already exists in web.xml) 
<servlet-mapping> 
<servlet-name>magnolia</servlet-name> 
<url-pattern>/</url-pattern> 
</servlet-mapping>

The reason for this change is not entirely straight-forward. Basically, static files in the Tomcat Magnolia installation take precedence over any url-patterns. In Resin, url-patterns always take precedence. Since the default magnolia url-pattern / matches everything, all static content gets passed to the magnolia CMS engine. To override this behavior, we manually load a FileServlet and force static content bypass the magnolia servlet.

Common Resin Configuration

These changes need to be made in the Resin installation on both author and public sites. The file to edit is $RESIN_HOME/conf/resin.conf. Fortunately, the two changes are very simple. Change:

<web-app id='/' document-directory="webapps/ROOT"/>

to

<web-app id='/' document-directory="webapps/magnolia"/>

Also, if both your author and public instances will run on the same box, uncomment the load balancer:

<!-- 
<cluster> 
<srun server-id="" host="127.0.0.1" port="6802" index="1"/> 
</cluster> 
-->

Author Resin Configuration

This section applies to the public Magnolia instance. Edit the corresponding resin.conf file, and change the HTTP port from 8080 to 8081. From the binary Magnolia 2.0 author instance, copy the repositories directory to $AUTHOR_HOME. Start resin.

Public Resin Configuration

This section applies to the author Magnolia instance. Edit the corresponding resin.conf file, and change the HTTP port from 8080 to 8082. From the binary Magnolia 2.0 public instance, copy the repositories directory to $PUBLIC_HOME. Start resin.

Your Magnolia installation is now complete.

Author: Titus Barik

Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators