As of Dec 2016, Magnolia CMS has just released our latest version 5.5.0 using Jackrabbit 2.12.4 which is supporting traditional familiar DBMS including Derby, H2, Oracle, Ingres, MySQL, Postgres and MSSQL. There were requests for feature that support Magnolia CMS using MongoDB as its persistence manager.
Since Magnolia mostly depend on Jackrabbit implementation for its persistence manager, only provided version from this documentation were officially supported. Moreover, MongoDB is a NoSQL solution which is, in some aspects, conflict with our traditional RDBMS above.
In order to integrate MongoDB into existing Magnolia CMS, we need to do some tweak and have an adaptor which could 'mediate between two warring sides'. Luckily Jackrabbit 2.x already supported JNDI originally and also we have a stable release of JDBC for MongoDB called JDBC Driver for MongoDB®. I will walk you through our configuration steps of 'our court of conciliation'.
Sure we need our 'mgnldb' database with 'myUserAdmin' as username and 'abc123' as password:
Configuring JNDI for Magnolia CMS on Tomcat 8
A datasource in Tomcat 8 'context.xml' is needed to be configured:
Then a resource reference in your webapp 'web.xml' file is needed as below:
* Reference to official tomcat 8 JNDI Datasource configuration for more detail and advanced use case.
Configure our repository configuration to use provided JNDI datasource
Sample file in repo-config directory (webapp/WEB-INF/config/repo-conf/jackrabbit-bundle-mongo-search.xml):
The point is instead of using provided 'out of the box' implementation from Jackrabbit for dedicated database system, we changed to use a 'generic' one
org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager and configure it to use our existing container based datasource (JNDI) for example:
* A small note is that I just disabled 'schemaCheckEnabled' flag to work around a minor bug during Jackrabbit initiation stage. TODO: fix this.
Update your 'webapp/WEB-INF/config/default/magnolia.properties' file to use our created repository config and check your result after successfully bring up your Magnolia instance in our 'About' app.
Verify the result
Hope this helps!