What is the proper way to install changes to .nxftl configuration templates?

I want to enable soft-deletes as described at Deleting Documents. I have been able to manually perform the edit to default-repository-config.xml.nxftl and have confirmed that it works, but now I wish to store this configuration change in our configuration management system to ensure that our servers are automatically deployed with it.

As I see it there are at least two options:

  1. Overwrite the common-base/nxserver/config/default-repository-config.xml.nxftl file with an edited version of my file when the server configuration is deployed.
  2. Configure the repository in our site-specific custom templates.

The second option seems more correct to me, but is there a way to add that one configuration option to the repository configuration that already exists in common-base from my own configuration template, or must I still copy the contents of that default-repository-config.xml.nxftl file no matter where I load the repository configuration from?

Thanks for any insight.

0 votes

3 answers

5182 views

ANSWER



I ended up doing a variation of Julien Carsique's first suggestion, basically embedding

sed '/<indexing>/i <softDelete enabled=\"true\" />' \
/var/lib/nuxeo/server/templates/common-base/nxserver/config/default-repository-config.xml.nxftl \
> /nuxeo/templates/local/conf/default-repository-config.xml.nxftl

in our deployment script.

As they say, crude but effective.

0 votes



FYI for this one I opened NXP-14961 to make this easier.
08/14/2014


Hi,

As said Damien, the first option should be banned. Based on the second option (no change on the original files, use of a custom configuration template), you can:

  • Duplicate and customize default-repository-config.xml.nxftl. You will use the configuration templates system to overwrite the default contribution provided by Nuxeo. The server will only read your file. Keeping it in sync can be done by applying a diff patch to the copy of the original file for every release.
  • Write your own contribution, not necessarily duplicating the whole original one: depending on your needed changes to default-repository-config.xml.nxftl, you may be able to write a custom component in a custom-repository-config.xml.nxftl using the SQLRepositoryService's capabilities of merge and update.

About the soft-delete case, I didn't check if it was possible to contribute that option in a standalone XML component, in addition to the default configuration… that would be easier. Else, when a full overwrite of the default contribution is required, only for a few fields, it's worth to suggest an improvement to Nuxeo with a parameterized option easing a service customization.

0 votes



Hello,

The second option is by far the best. Il you need to add things to the default-reposiroty-config.xml.nxftl file, the you have to override it. If you just need to change some configuration values, then you can do it in you nuxeo.conf file or in the nuxeo.default file of your site-specific custom template.

0 votes



So in order to override the default, do I use the same component name/extension target/repository name in my own template, copying over the same attributes from the original and adding my own changes? Or is there a way to only apply my changes, in case default-repository-config.xml.nxftl changes in a later Nuxeo release in ways that are not relevant to me?
07/18/2014

Yes, use the same component. You can copy/paste the file in your own template, it will then override the common-base one.
07/18/2014