Managing Your Configuration Files
In opentaps 1.4, We have added additional configuration and deployment scripts to help you manage your opentaps configuration settings. You can now put your configuration files in a separate directory and then have opentaps copy them over for you. You can even put complete customizations of the core code base into these directories.
Usage: ant deploy-config -Dfrom=<directory> [-Ddeployconf.substitution.file=<tokens.properties>] where:
- <directory> contains a directory structure similar to the ofbiz structure
- <tokens.properties> is an optional properties file
How does it work
When deployed, all the files from <directory> are copied over in the main directory, overwriting the existing files of the same path. Note that no backup of the overwritten files are made, so if the configuration has to be reset or switched, make sure to either revert he changes first or to include the same files in all the sets.
As an example the mycompany component contains:
- hot-deploy/mycompany/config-repo/custom/ : a set of commonly changed configuration files, uses token substitution
- hot-deploy/mycompany/config-repo/custom.properties : the substitution settings, equivalent to the default configuration, can serve as a template
- hot-deploy/mycompany/config-repo/custom-alt.properties : alternate substitution settings, with alternate port configuration which can be used to run a second instance in parallel
- hot-deploy/mycompany/config-repo/default/ : the default configuration files that can be used to revert the previous sets
So for example:
- ant deploy-config -Dfrom=hot-deploy/mycompany/config-repo/custom loads the custom set and applies custom.properties
- ant deploy-config -Dfrom=hot-deploy/mycompany/config-repo/custom -Ddeployconf.substitution.file=hot-deploy/mycompany/config-repo/custom-alt.properties loads the custom set and applies custom-alt.properties
- ant deploy-config -Dfrom=hot-deploy/mycompany/config-repo/default restores the default configuration
Normally it is highly recommended to isolate any configuration to opentaps in a dedicated hot-deploy module (eg: hot-deploy/foo) and to use mycompany as a template.
Using either a simple configuration set or one with substitution is a matter of test, both methods will work equally well.
It is possible to store the configuration sets in a completely different directory, outside of the opentaps tree.
It is also possible to use the configuration sets to store any kind of files: not only configuration but java code / libraries / images / etc .. if it makes sense to customize those between different type of instances. For example you may want to set your testing instance with a different logo or a different implementation of one particular class or service.