How to create a copy of your Magnolia public instance
Imagine you have one author and three public instances running and one of your public instances is broken. Depending on the amount of content and the state of your instances you have a various options to repair the broken public instance:
- create a new, empty public instance and activate all content to it
- if you have at least one public instance working, you can activate all content from the working public instance into the new one to ensure they are in sync
- if all your public instances are corrupted you have to activate from the author to new public instance
- export all content, create new public instance and bootstrap all the exported content into it
- if you have at least one public instance working, you can export content from there
- if all your public instances are corrupted you have to export from author
- simply copy the database and the webapp folder, then edit the database connection information,
- you need at least one working public instance
- the connection information is located in the jackrabbit configuration file located at
/webapps/magnoliaPublic/WEB-INF/config/repo-confand in all the workspace.xml files in the
/webapps/magnoliaPublic/repositories/magnolia/workspaces/*directories. Please note that connection info is added twice for each file!
Each mentioned approach has some advantages and disadvantages:
ad 1. This is probably the slowest approach, but gives you most control over the transfer of content from one instance to another.
ad 2. If you have a lot of content and many big files on your instance, you might choose this approach as it will be faster and you don't have to send all the content over http.
ad 3. This approach is perhaps the fastest one, but you need to have at least one working public instance to be able to use it. It also carries a risk of corrupting your surviving public instance should you forget to update the connection information in one of the configuration files of the copied web-app. For this reason, make sure that you have a backup of the database as well as backup of the web-app before replicating your public instance in this way.
There is a way how to export only f.e. activated content from author instance. You can:
A) parse exported xml and remove all nodes that do not have a subnode MetaData with mgnl:activated == true
B) modify the SAXFilter used for export to the content. It requires to write in Java your own export command similar to one provided by Magnolia and can introduce the filter that will exclude all non activated content. Have a look at info.magnolia.importexport.DataTransporter.executeExport() for example. You would have to extend VersionFilter used there to exclude also non activated content.