Setup server-wide datasource from command line

Sometimes it can be very useful to use the web GUI to update all the permanent settings you want for your Lucee installation. This automatically updates the underlying XML config files and all you need is to capture those changes and push them in at build time.

We store our project configuration in a subfolder structure beneath the location of the Dockerfile:

./config
├── lucee
    ├── lucee-server.xml
    └── lucee-web.xml.cfm

These can be committed to version control and copied via the Dockerfile at build time:

./Dockerfile

# Lucee server configs
COPY config/lucee/lucee-web.xml.cfm /opt/lucee/web/lucee-web.xml.cfm
COPY config/lucee/lucee-server.xml /opt/lucee/server/lucee-server/context/lucee-server.xml

You can map these configuration files into your container using VOLUMES during development so you can easily capture any changes you might make to the admin; for example, a docker-compose.yml file might include:

./docker-compose.yml

  volumes:
    - /workbench/my-app/config/lucee/lucee-server.xml:/opt/lucee/server/lucee-server/context/lucee-server.xml
    - /workbench/my-app/config/lucee/lucee-web.xml.cfm:/opt/lucee/web/lucee-web.xml.cfm

Note, it’s not ideal if you need these values to change at container runtime :scream: You need to use ENV variables for this. Fortunately, Lucee allows you to set many configuration flags directly or programmatically via the Application.cfc.

https://lucee.daemonite.io/t/lucee-configuration-options/321

2 Likes