Magnolia Compatibility


5.5(tick)
5.6(tick)
5.7(tick)
6.1(tick)

The Content Synchronization Module is used to get content from a source instance into a target instance. For example, you can get content from a PRODuction environment sync'ed (i.e. pulled) into a TEST environment.

When having a full DTAP environment in place for a customer and developing nice new things and improving existing functionality, often there is the need for 'actual' content to properly test all kinds of changes. This modules will save time to have all content exported and imported manually.

To start synchronization with the app, make sure all needed workspaces and nodes are configured, enter the credentials of a user that has all needed permissions on both source and target, and then click the button 'START SYNCHRONISATION'.

This module has to be installed on both source and target instance to work. Workspaces as well as nodes can both be synchronised in one go. Configuration is stored in JCR and done in node /modules/content-synchronisation/config/.

Synchronization first removes configured workspaces/nodes on the target instance, then pulls content from source instance. After synchronization, all imported content is published. Synchronization works in a PULL manner, so it imports content to the instance where user starts it. It does NOT push anything.






Installation


This module requires Enterprise Edition of Magnolia. The module can be added as a Maven dependency in the main and webapp POM file:

<dependency>
    <groupId>nl.info.magnolia</groupId>
    <artifactId>content-synchronization</artifactId>
    <version>{moduleVersion}</version>
</dependency>

Additionally a dependency from your main module descriptor is necessary:

<dependency>
    <name>content-synchronization</name>
    <version>{2/* | 3/*}</version>
</dependency>

Versions and compatibility table

Compatibility

Module VersionMagnolia Version
3.1.x6.1.x
3.0.x5.7.x
2.0.x*5.6.x
1.0.x*5.5.x

*Version no longer supported

History

  • Version 3.1.1: first public release for Magnolia 6.1.x, upgraded do JDK 11, fixed bug with endless recursion


  • Version 3.0.2: fixed bug with endless recursion
  • Version 3.0.0: first public release for Magnolia 5.7.x


  • Version 2.0.22: bugfix - removal of parent pom
  • Version 2.0.21: first public release for Magnolia 5.6.x


  • Version 1.0.18: bugfix - removal of parent pom
  • Version 1.0.17: first public release for Magnolia 5.5.x



Configuration


This module has to be installed on both source and target instance to work. Workspaces as well as nodes can both be synchronised in one go. Configuration is stored in JCR and done in node /modules/content-synchronisation/config/. Please remember that rest role (or any other that is going to be used) should be configured correctly and should be allowed for GET/POST in the endpoint /.rest/content-synchronization/v1*



Logger configuration


To write all module logs to separate log file, please add Log4j config to your project:

<appender name="sync-log-content-synchronization" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="${magnolia.logs.dir}/magnolia-content-synchronization.log"/>
    <param name="MaxFileSize" value="1MB"/>
    <param name="MaxBackupIndex" value="5"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%-5p  %d{dd.MM.yyyy HH:mm:ss} %m%n"/>
    </layout>
</appender>
<appender name="log-content-synchronization" class="org.apache.log4j.AsyncAppender">
    <appender-ref ref="sync-log-content-synchronization"/>
</appender>
<category name="nl.info.magnolia.sync" additivity="false">
    <appender-ref ref="log-content-synchronization"/>
    <priority value="INFO"/>
</category> 

User credentials

The user that you use needs to have the next permissions:

  1. read/write permissions on selected workspaces/nodes of target instance
  2. read permission on selected workspaces/nodes of source instance
  3. and permission to access REST endpoint on source instance



Licensing

Content Synchronization module for Magnolia CMS Copyright (C) 2018 info.nl

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.



Contributions, questions or findings

Please share your ideas or questions in the comments area on this page.

If you run into a problem, you can report it here: https://jira.magnolia-cms.com/projects/CONTSYNC



11 Comments

  1. Cool module! Can't seem to find the GIT repo on magnolia forge, and don't have access to the info.nl Bitbucket server. I'd like to fork the module if it is allowed to do so to solve the following issues:

    • Bug when synchronizing resources workspace
    • Can't synchronize DAM workspace due to size of content

    Please let me know if I can access the source code repository...

    1. Hi Richard, thxz for your enthusiasm!

      We were looking last week into sharing the code with you. Since you would be the first external in our GIT repo, we have to plan putting time into configuring that properly and make sure all other projects are still hidden.

      Are you OK in raising a JIRA issue/finding https://jira.magnolia-cms.com/projects/CONTSYNC for the bug you've found? Fixing the bug in our version will help others as well.

      About the assets sync. Indeed the size is a problem that we would like to fix.

  2. is this module still alive? Can't find it on Magnolia Forge?
    https://jira.magnolia-cms.com/secure/BrowseProjects.jspa?selectedCategory=10110&selectedProjectType=all

    There is a severe bug in version 2.0.23

    Recursion calls it self with the same argument. Which causes Stack Overflow of course.
    Should be return getParentForNotExistingNode(newPath, session); I guess

    Can't find a Git Repo for this module, would like to fix it my self and make a pull request


    private String getParentForNotExistingNode(String nodePath, Session session) throws RepositoryException {
    String newPath = nodePath.substring(0, nodePath.lastIndexOf("/"));
    if (session.nodeExists(newPath)) {
    return newPath;
    } else {
    return getParentForNotExistingNode(nodePath, session);
    }
    }


    1. Hi Julius, we do not host repository on Magnolia Forge,
      We do not maintain 2.x version anymore, 

      We keep module working for Magnolia 5.7.x - module version is 3.0.1
      and for Magnolia 6.1.x - module version 3.1.0

      I suggest upgrade to lastest version.

  3. Hi Mariuz,

    thanks for quick reply! For Version 3.0.1 the above code is unchanged.

    In 3.1.0 code is refactored but it seems to me there is still an endless recursion in the else path.
    Thanks for fixing!

    private String getParentForNotExistingNode(String nodePath, Session session) throws RepositoryException {
    String newPath = nodePath.substring(0, nodePath.lastIndexOf("/"));
    return session.nodeExists(newPath) ? newPath : this.getParentForNotExistingNode(nodePath, session);
    }


  4. Hi Julius, content sync module 3.0.2 is just released with fix you proposed.


    Let me know if all works fine now.

  5. Hello,


    Is the latest module version compatible with Magnolia 6.2.x?


    1. Unfortunately i think there are some dependency conflicts. 

      I tried to use the module with Magnolia 6.2.12 under Java 11 and ran into

      Caused by: java.lang.InstantiationError: org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder

      Seems like RestEasyClientBuilderImpl would be the correct class nowadays. 

      Content Sync is relying on 

      [INFO] \- nl.info.magnolia:content-synchronization:jar:3.1.1:compile
      [INFO]    \- info.magnolia.restclient:magnolia-resteasy-client:jar:1.7:compile
      [INFO]       +- org.jboss.resteasy:resteasy-jaxrs:jar:3.5.1.Final:compile
      [INFO]       \- org.jboss.resteasy:resteasy-jackson-provider:jar:3.5.1.Final:compile

      Whereas 

      [INFO]    \- info.magnolia.pages:magnolia-pages-app-compatibility:jar:6.2.11:compile
      [INFO]       \- info.magnolia.pages:magnolia-spa-rendering:jar:6.2.11:compile
      [INFO]          \- info.magnolia.rest:magnolia-rest-integration:jar:2.2.9:compile
      [INFO]             +- org.jboss.resteasy:resteasy-core-spi:jar:4.6.1.Final:compile
      [INFO]             +- org.jboss.resteasy:resteasy-core:jar:4.6.1.Final:compile
      [INFO]             +- org.jboss.resteasy:resteasy-jackson2-provider:jar:4.6.1.Final:compile
      [INFO]             \- org.jboss.resteasy:resteasy-jaxb-provider:jar:4.6.1.Final:compile

      and 

      [INFO] +- info.magnolia.cache:magnolia-cache-browser-app:jar:5.9.4:compile
      [INFO] |  \- info.magnolia.restclient:magnolia-rest-client:jar:2.0.1:compile
      [INFO] |     +- org.jboss.resteasy:resteasy-client:jar:4.6.1.Final:compile
      [INFO] |     \- org.jboss.resteasy:resteasy-client-api:jar:4.6.1.Final:compile

      result in a newer version of resteasy where obiously RestEasyClientBuilder is no longer a class that can be instantiated, as it is abstract. 

  6. I tried to contact info.nl but didn't recieve an answer yet.

    But i found out that there seems to be an undocumented version 3.2.0 in the nexus repository which should solve the problem. I will give it a try soon. 

  7. Hi Jorg, unfortunatelly we no longer support Magnolia modules.

    1. Sad to hear, but thanks for your reply.