-----
About
-----

The templates in this directory are used to generate configuration and datasource
files at server startup when it is not already configured.

1) Usage

1.1) General instructions

Edit nuxeo.conf and set the name of the template(s) to use (default template is "default").

Set the properties you want to customize, see nuxeo.defaults files for available parameters.
For example, recommended changes are:
  nuxeo.templates=default
  nuxeo.bind.address=0.0.0.0
And, for example, if you use a database template:
  nuxeo.db.host=localhost
  nuxeo.db.name=nuxeo
  nuxeo.db.user=user
  nuxeo.db.password=password

Default values are used for undefined properties in nuxeo.conf
Take care that the following sample is defining an empty property:
  nuxeo.sample.value=

*DO NOT EDIT* nuxeo.defaults files except, if needed, the one in custom template.

1.2) 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 parameters defined such as ${sample.parameter}
Values for parameters replacement are calculated by this way:
  * If nuxeo.conf does not define nuxeo.templates, then nuxeo.templates equals "default"
    (deprecated parameter nuxeo.template is still read for backward compliance).
  * 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
    ${nuxeo.template}/nuxeo.defaults is read for defining new default values
    and eventually 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.

1.3) Customization

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

  * Add your own template files in "templates/custom" directory.
    You can use either existing or new parameters in these new template files.
  * Edit nuxeo.conf, 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).
  * 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.
    Note since NXP-5139, nuxeo.defaults files from included templates are read.

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

2) Available templates

2.1) default

Default Nuxeo configuration.
Designed for development or test purpose.
Repository backend: H2
Services backend: Derby

2.2) postgresql

Recommended configuration for production, based on PostgreSQL.
See http://doc.nuxeo.com/x/fwQz

Repository backend: PostgreSQL XA
Services backend: PostgreSQL XA

Copy JDBC3 driver http://jdbc.postgresql.org/download.html#current
into $TOMCAT/lib/

2.3) oracle

See http://doc.nuxeo.com/x/ywE7

Repository backend: Oracle XA
Services backend: Oracle

Copy JDBC driver http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
into $TOMCAT/lib/

2.4) mssql

See http://doc.nuxeo.com/x/EgI7

Repository backend: Ms SQL Server XA
Services backend: Ms SQL Server XA

Copy JDBC driver http://repo2.maven.org/maven2/net/sourceforge/jtds/jtds/1.2.2/jtds-1.2.2.jar
into $TOMCAT/lib/

2.5) custom

Sample custom template. It's quite empty, feel free to play with it in order to
create your own template.

2.6) https

Not recommended: Nuxeo recommends to use a HTTP server in front of Tomcat instead of
configuring Tomcat to directly listen to port 443.

That template is configuring the server to listen to port 443 (HTTPS) on its public
address(es) but still use port 80 (HTTP) for its local calls (loopback url).
