Server

Configuration Templates

Updated: March 18, 2024

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
  • default: default Nuxeo configuration template for test purpose
  • https: (not recommended) Template to make the server listen to port 443 (HTTPS)
  • postgresql: PostgreSQL configuration template
  • postgresql-quartz-cluster
  • mssql: MS SQL Server configuration template
  • mssql-quartz-cluster
  • mysql: MySQL configuration template
  • mysql-quartz-cluster
  • mariadb: MariaDB configuration template (since Nuxeo FT 9.1; for older versions of Nuxeo the mysql template should be used)
  • mariadb-quartz-cluster
  • mongodb: MongoDB 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 their needs. See related section below.

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, then nuxeo.templates equals "default" (the deprecated parameter nuxeo.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, the files in the referenced templates are copied using the previously calculated values for replacing parameters.
  • Every included template will potentially overwrite its precedents.

You may want the variable to be resolved at runtime instead. In that case you can escape the variable in the configuration file this way: $${variable} instead of ${variable}.

Use a Custom Configuration Template to Store Your Customized Configuration Files

The "custom" template folder allows you to add customization such as using multiple databases, configuring services, etc.

  1. Add your own template files in templates/custom directory. You can use either existing or new parameters in these new template files.
  2. From the Admin tab or by manually editing the nuxeo.conf file, set your parameters' values and set nuxeo.templates=custom. You can refer to custom templates directory with a relative path or to your own custom templates directory with an absolute path.
  3. Edit custom/nuxeo.defaults and set nuxeo.template.includes parameter to define the list of existing templates to include (comma separated values); your custom template will be used at last. nuxeo.defaults files from included templates are also read.

In case you need multiple customizations, create multiple directories and reference them in a dedicated nuxeo.conf for each server.

The following properties cannot be configured from a configuration template (in nuxeo.defaults) and must be defined in nuxeo.conf:

  • nuxeo.data.dir
  • nuxeo.log.dir
  • nuxeo.pid.dir
  • nuxeo.tmp.dir
  • nuxeo.mp.dir

Move Your Configuration out of the Server Directory Structure

The "custom" template folder is a sample configuration template that you can use as is but it is recommended to create your own configuration template named as you want and located outside of the Nuxeo server structure, along with your customized nuxeo.conf.

For instance, under Linux, you could setup:

  • Configuration files (custom templates and nuxeo.conf) under /etc/

    /etc/nuxeo/
    ├── nuxeo.conf
    └── some-custom-template
  • Data under /var/lib/. It is common to also place the server itself under /var/lib/. Other common locations for the server are /opt/nuxeo/, ~nuxeo/nuxeo-cap-x.y-tomcat/...

    /var/lib/nuxeo/
    ├── data
    └── server (NUXEO_HOME)
        ├── conf
        ├── lib
        ├── nxserver
        ├── packages
        ├── templates
        ├── webapps
        └── work
  • Log files under /var/log/

  • PID files under /var/run/
  • Temporary files under /tmp/