Hi devs,

Current Situation
=============

In the past we discussed this and even reached some conclusions but it wasn’t 
implemented. The relevant thread:
* Original idea: http://markmail.org/message/yl77mvdtznii263l
* Updated idea: http://markmail.org/message/6cvm5hocvtbqtgp6

This thread supersedes these old threads.

In the meantime Thomas has also implemented 
https://jira.xwiki.org/browse/XWIKI-13867 (BTW I added several comments but 
didn’t get any answer from them ;)).

So here’s an updated proposal:

Use Cases:
=========

- UC1: Easy install: no need to explode the WAR to install XWiki.
- UC2: Easy upgrade: no need to take care about backupping specifically the 
configuration in WEB-INF so that it's not overwritten by an upgrade of the WAR
- UC3: Should be possible to have multiple installs on the same machine and 
running at the same time
- UC4: Should be possible to control the location of the configuration files 
for our automated functional tests (so that we control the configuration used)
- UC5: (Future) Make XWiki work without configuration files
- UC6: Allow our users of the Docker image to configure XWiki outside of the 
container (see https://jira.xwiki.org/browse/XDOCKER-20).

Implementation Proposal:
====================

* Configuration files = xwiki.cfg, xwiki.poperties and hibernate.cfg.xml
* Allow configuring the permanent directory with the XWIKI_DATA_DIR environment 
variable (in addition to the existing xwiki.data.dir system property, i.e. 
-Dxwiki.data.dir=…). In Java this is done by using System.getenv()
* Load the configuration files in a specific order, each level overwriting the 
previous level, except for hibernate.cfg.xml since it’s harder to merge XML. 
The idea is that users will only need to define configuration properties that 
they want to override.
* The order is the following:
** Load from WEB-INF/
** Load from the location defined by the JNDI property
** Load from [permanent directory]/config/
* For xwiki.properties and xwiki.cfg, if the property is not found, then 
default to a value provided by the code.
* Add some comments at the top of xwiki.cfg, xwiki.properties and 
hibernate.cfg.xml to explain to the user how they should customize them.

Option 1:
* Right now if the permanent dir is not defined, we default to using the 
servlet temporary directory (i.e. “javax.servlet.context.tempdir” system 
property). One option is check the OS and:
** If on unix, default to /etc/xwiki/
** If on windows, default to the user home profile (using 
System.getProperty("user.home”) or System.getenv("USERPROFILE”))

Option 1bis:
* Right now if the permanent dir is not defined, we default to using the 
servlet temporary directory (i.e. “javax.servlet.context.tempdir” system 
property). One option is to default to the user ome directory instead (using 
System.getProperty("user.home”)).

Note that for UC5 my POV is that in the future:
* We should move the database configuration to a step in an Installation Wizard 
that execues on XWiki’s first run. This would internally generate the Hibernate 
configuration.
* Provide defaults for all xwiki.cfg properties (it’s already the case for 
xwiki.properties normally).

Note: I don’t know where https://jira.xwiki.org/browse/XWIKI-13867 fits; it 
could maybe fit with Option 1 (which is why I wrote option 1 and 1bis actually).

WDYT?

Thanks
-Vincent


Reply via email to