Nuxeo applications integrate a configuration templates system to ease configuration and maintenance of configuration files. Nuxeo comes with default templates which mainly provide database configurations, but the templates can be used for any configuration purpose.
Properly using that template system ensures your customization of Nuxeo exclusively resides in your nuxeo.conf, custom templates and plug-in modules. For instance, users can create templates for development, pre-production, and production environments; each template will include a different set of xml contributions (users, ldap integration, database used, ...).
Templates are located in the "templates" directory ($NUXEO_HOME/templates
). To enable a configuration, such as database configuration, you just need to indicate which template to use in the Admin > Setup tab or in the nuxeo.conf configuration file.
Here are the templates provided by default:
- common: common template used by other templates;
- common-binding: (JBoss only), template used by other templates;
- common-deploydir: (JBoss only), template used by other templates;
- default: default Nuxeo configuration template for test purpose;
- https: (Tomcat only), not recommended template for making the server listen to port 443 (HTTPS);
- monitor: (JBoss only), activate the JBoss LogginMonitor service to log miscellaneous MBean informations;
- postgresql: PostgreSQL configuration template;
- postgresql-quartz-cluster
- mssql: MS SQL Server configuration template;
- mssql-quartz-cluster
- mysql: MySQL configuration template;
- oracle: Oracle configuration template;
- oracle-quartz-cluster
- custom: sample custom templates. Of course, this template is empty by default. One should copy it outside
$NUXEO_HOME
and adapt to his needs.
For production environment, it is recommended to define your own custom template outside `$NUXEO_HOME`, as for `nuxeo.conf`. It must then be referenced in `nuxeo.conf` with its absolute path.
Technical Overview
A server is considered as already configured when it has a "config" directory. When the "config" directory doesn't exist, templates will be used to generate all configuration files (config and datasources).
The template files contain defined parameters such as ${sample.parameter}.
Values for parameters replacement are calculated this way:
- If nuxeo.conf does not define
nuxeo.templates
, thennuxeo.templates
equals "default" (the deprecated parameternuxeo.template
is still read for backward compatibility). - The ${nuxeo.templates} value is used for determining the chosen template(s).
- For each value "nuxeo.template" of ${nuxeo.templates} (comma separated values, relative to "templates/" directory or absolute path), the corresponding file templates/${nuxeo.template}/nuxeo.defaults is read for defining new default values and maybe including other templates which are recursively parsed.
- The file templates/nuxeo.defaults is read for default values not already defined.
- The file nuxeo.conf is read for custom values (overwriting default values).
Configuration files are then generated by this way:
- For each comma separated value of nuxeo.templates and nuxeo.template.includes (let say sample.template), files in templates ${sample.template} are copied using the previously calculated values for replacing parameters.
- Every included template will potentially overwrite its precedents.