Search This Blog

Wednesday, November 14, 2018

Magnolia CMS Hosting on OpenShift

First install Tomcat 7 Application

Get your git url from
$ rhc show-app magnoliacms

Or from your Openshift web console.

git clone your-git-url to copy the repository locally.

Download Magnolia CMS WAR  from SourceForge (choose magnolia-bundled-webapp)

Next, remove the src folder and pom.xml file from the Git repository, as we will be deploying the WAR file.
$ git rm -rf src/ pom.xml
$ git commit -am "deleted template source code"
Copy Magnolia CMS WAR to webapps

$ cd webapps
$ mv magnolia-5.0.4.war ROOT.war

Set unpackWARs to True


According to the Tomcat documentation:

If false, the unpackWARs attribute of the owning Host will be overridden and the WAR file will not be unpacked. If true, the value of the owning Host’s unpackWARs attribute will determine if the WAR is unpacked. If not specified, the default value is true. Note that WAR files located outside of a Host’s appBase are never unpacked.

To override this value, we have to update the .openshift/config/server.xml file. OpenShift gives you the flexibility to override or update Tomcat configuration files. Update server.xml as shown below. Change
<Host name="localhost"  appBase="webapps"
            unpackWARs="false" autoDeploy="true">
to
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

Deploy Magnolia CMS

Next, you can deploy the Magnolia WAR by committing the changes to your local Git repository and then pushing the changes to the OpenShift application gear.
$ git add .
$ git commit -am "set unpackWAR to true and added MagnoliaCMS WAR"
$ git push
This will take a few minutes, depending on your internet connection. Once the Git push is done, you can view the status of the WAR deployment by tailing the log files as shown below.
$ rhc tail magnoliacms
visit your app's http link to Install Magnolia Modules