Running a ContentBox Cluster on Jelastic Cloud PaaS

Today we’ll show you how to deploy ContentBox, a professional open source Modular CMS that allows you to easily build websites, blogs, wikis and complex web applications to the Jelastic Cloud. It’s built with a secure and flexible modular core, designed to scale, and provides world-class support.  ContentBox is powered by Railo, an open source CFML engine that can be deployed to any Java Servlet Container. Moreover, you’ll see how to use its embedded Railo CFML cluster cache by the Memcached implementation and how it can help to create a fast and scalable caching layer for ContentBox.

In our case, the clustered cache offers shared session storage for all servers in a cluster. You can then store all the sessions in this cache that are available from all servers in the cluster. In other words, we’ll use Memcached for session replication. So let’s take an easy example.

scheme3

Our cluster has 2 servers and every one of them holds the same application ContentBox and connects to the same MySQL database. We use Memcached here to offer the opportunity to scale out huge amounts of memory to a server farm and store large amounts of data in it.

Create environment

1. Log into your Jelastic account and click on the Create environmentbutton.

2. Pick two TomEE instances, MySQL as the database you want to use and select Memcache node as your cache storage. Then specify the resource consumption for each node and enter the environment name.

ContentBox Environment

In a few minutes you’ll see your environment on the dashboard.

ContentBox on Dashboard

Configure database

1. Click Open in browser for MySQL database.

ContentBox MySQL Database

2.  Jelastic will send you an email with credentials to the database. Use these credentials to create a user and the database with the application.

ContentBox Database

Deploy ContentBox

1. Go to the ContentBox official web site and download the latest version of this CMS as a WAR archive.

ContentBox Download

2. Upload the archive to the Jelastic Deployment Manager.

ContentBox Upload

3. Deploy ContentBox to the Jelastic Cloud.

ContentBox Deploy

Change Railo CFML Default Passwords

We recommend that you change the default administrator passwords for the embedded Railo CFML engine.

1. Navigate to Railo CFML Server Admin using the following URL format http://mydomain.com/railo-context/admin/server.cfm and log in using the following password: contentbox.

2. Click on the Security > Password menu item on the left hand side

security

3. From this next screen you will be able to add a captcha to the login screen, change the administrator password and also set the default password for all web applications deployed to this server.  We recommend changing the administrator password and the default password for all web administrators (Railo offers a server wide administrator and a web context administrator).

security-password

Configure clustering

1. Enable session replication via Memcached as it’s described in this tutorial.

2. Navigate to Railo CFML Server Admin using the following URL format http://mydomain.com/railo-context/admin/server.cfm and log in using the following password you setup in the before steps. If you did not change it then the default password is: contentbox.

Railo Server Admin

3. Navigate to the Applications tab from the left hand menu and install the Railo Memcached driver.

Railo Memcached Driver

4. Navigate to the Cache tab and create a new cache connection from the Railo CFML server to Memcached.

Railo New Cache

5. Enter your Memcached node IP address and port number, which can be viewed by clicking the Info button for Memcached on the Jelastic dashboard. Set the flag Allow to use this cache as client/session storage, specify your connection settings and submit the connection creation.

Cache Connection

6. Now that your cache connection is successfully created, verify it.

Verify Railo Cache

7. Go back to the Jelastic Dashboard and click the Config button forTomEE.

ContentBox Config

8. Navigate to Application.cfc file from the deployed ContentBox application and add the following settings to distribute the sessions via Memcached:

this.sessionCluster = true;
this.sessionStorage="mycache";

ContentBox Enable Clustering

9. Enable ContentBox to use the same cache for monitoring and content/RSS distribution.  You will then be able to not only distribute your sessions across the cluster but also multiple levels of content caching and RSS feeds as well. To do this you will need to open theCacheBox.cfc file (webapps/ROOT/config/CacheBox.cfc) and add a new cache definition under the caches section:

Memcached = { 
  provider = "coldbox.system.cache.providers.RailoProvider", 
  properties = { cachename = "mycache" } 
}

CacheBox Settings

Enable Java Agent (Optional Step)

1. Extract railo-inst.jar (contentbox-x.x.x.war/WEB-INF/railo/lib/railo-inst.jar) file from ContentBox WAR archive, which you downloaded earlier.

2. Upload this jar library to the home directory of TomEE.

Railo Java Agent

3. Go to variables.conf file (server directory) and specify the path to railo-inst.jar according to the environment variables.

Railo Enable Java Agent

4. Save all the changes for both instances and restart your servers in order to apply the new settings.

Restart TomEE

Install ContentBox

1. Click the Open in browser button for your environment.

ContentBox Open in Browser

2. Specify your data source connection using your Railo CFML Administrator password, MySQL user and database, which you created earlier.

ConrentBox Datasource

Note: The default CFML Application password is contentbox if you did not change it in our previous steps.

3. Verify the entered data and confirm the data source creation. ContentBox will then prompt you for your ContentBox administrator user, site information, mail and rewrite settings.

Note: On the rewrites installation screen, choose ContentBox Express from the dropdown as ContentBox includes an embedded rewrite engine when deployed as a WAR.

4. The final step is to tell ContentBox to use Memcached for storing content and RSS feeds. Go to the System > Settings from the top menu in ContentBox and click on the Content Options tab on the left hand side. From here you will have a drop down that says Content Cache Provider, click on it and change it from “TEMPLATE” to “Memcached”.

content-caching

5. You can then click on the RSS Options tab and do the same for generated RSS Feeds.

rss

That’s all you have to do to get a highly available ContentBox cluster! You can distribute your sessions without J2EE management, distribute your managed content objects and your RSS feeds and all of them will be available for your entire cluster. Enjoy!