This topic is an open discussion that is sort of a corollary to my previous post, http://lang.lucee.org/t/how-do-we-make-configuring-lucee-rock/193
In that post I’m talking about the different levels of configuration for a server/application and the formats/methodologies of storing that config (static XML, programmatic CFML, etc.) I also touched on how developers can interface or manage said config in that post and that’s what I’d like to unpack here.
Note, the driving force behind this question is automated deployment and provisioning of servers for cloud services, or local tools like Vagrant.
The server and web’s browser-based administrator sites are the two most well known methods of configuring Lucee, but both of these preclude any sort of automation.
The <cfadmin>
tag is quite promising but it’s biggest issues is:
- It’s not documented
- It requires the server to be running
- It must be run in the context of the server you want to administer
This doesn’t work for me when I want to write a shell provisioner for Lucee that configures settings on a new installation of Lucee that might not even be started yet for the first time.
Right now what I do is edit the lucee-server.xml
and lucee-web.xml
files directly which has these drawbacks:
- They’re not documented
- They’re not a public API and their format could change at any time
- Copying the entire XML file will break later builds of Lucee that change the format of the XML
- Parsing the XML and manipulating it is a bit better, but still tied to the undocumented format
We have rudimentary support for Java system properties in Lucee 5, but they appear to only affect the Lucee bootstrap and don’t allow actual settings to be configured. Roll those together with some kind of php.ini kind of concept and I think we’re getting close if
- The format is documented
- The config can be dropped in either the code repo or a server provisioner
- It’s picked up at runtime-- need to decide hierarchy order of what settings overwrite what.
What I’d really like, and what spawned this entire discussion for me is a supported CLI for configuring Lucee. Let’s look at Apache webserver for inspiration. When installed, it comes with some handy binaries like
- a2ensite (enable site)
- a2dissite (disable site)
- a2enmod (enable mod)
- a2dismod (disable mod)
With this approach I can either type these commands one-off from my shell prompt to configure my installation or I can make them part of a provisioner script that adds the mods, and sites I need without having to touch config files at all!
$> a2enmod proxy proxy_ajp rewrite
$> a2dissite 000-default.conf
Those configuration bits are agnostic concerning the format of the underlying config files and are a documented public API so I’m safe to call it now and in the future.
This is where I see a huge opportunity. I’d like to see Lucee either modify the cfadmin tag to be able to be pointed to a context outside of where it is running, or possibly open up the Java classes that abstract the manipulation of Lucee’s XML configuration files. I’m thinking of a suite of CLI commands (probably CommandBox commands) that allow for the scripted-configuration of a Lucee server either for the convenience of a CLI-minded admin, or the automation of a Vagrant build.
Change all settings
CommandBox> lucee server inspect-template never
CommandBox> lucee web missing-template-error "error-public.cfm"
CommandBox> lucee server add-mapping virtual="/coldbox" physical="/var/www/libs/coldbox"
Perform administrative tasks against a running server
CommandBox> lucee server update latest stable
CommandBox> lucee server restart
Manage extensions
CommandBox> lucee web install-extension ortus-couchbase-cache
CommandBox> lucee web remove-extension cfbeer
And what about these? (not currently possible)
CommandBox> lucee web outdated-extensions
CommandBox> lucee web update-extensions
Furthermore, if CFML site can now list its dependencies in a box.json and ask CommandBox to “install” them npm-style, why can’t your Lucee server and web extensions be documented in the same manner. Then building out your Lucee server that requires the Ortus Couchbase cache extension, cfspreadsheet, DB2 JDBC driver and CF ORM (these last two will become extensions in Lucee 5!) could be as simple as specifying those as dependencies for your server and then asking the CLI to “install” the server for you.
CommandBox> lucee server install
I can see a whole new world of portability and management coming about for Lucee that will be a must in the world of automated builds and cloud deployment. Thoughts?