Setting web-context-label

In the documentation on Directory Placeholders is this nugget:

Therefore, in Lucee 3.3, we introduced a new directory placeholder: {web-context-label}. Now you have the opportunity to use a label as a path to the configuration files for each web context. In order to use this label, you need to define it in every lucee-web.xml.cfm in every configuration directory.

This is great, as I’m trying to script a multi-host/context install with Docker Compose. But, I cannot find a single example of what that configuration line(s) is supposed to look like in the context’s lucee-web.xml.cfm. Any pointers?

Following, because I’ve just inherited the same thing…

We’re not using Docker or doing any scripted installs (yet), but we’ve used the {web-context-label} feature in our standard Tomcat installation to centralize all of our web context WEB-INF directories in one place (instead of being scattered under each web root).

All we did was open up tomcat/conf/web.xml in our Lucee installation root and uncomment the <init-param> named lucee-web-directory and change its value to a path indicating where we want the context directories to be, like so:

      <description>Lucee Web Directory (for Website-specific configurations, settings, and libraries)</description>

On the global server admin UI home page there’s a form at the bottom allowing you to set the value of {web-context-label} for each registered context. That label is then used to rename the web context directory (from a default UID).

Probably not much help in terms of scripted installs, but I wonder if @bdw429s knows a way of doing that via his excellent CFConfig tool?

The short answer to the question is don’t use more than one context in Docker. Docker images are meant to wrap up a single site in a single server. It’s just the container mindset. Each container is a single sefl-contained service. The whole multi-context thing is just a carry over from the olden days of giant be-all end-all servers that powered your entire web presence.

Now, on the off chance that you’ve already made up your mind, you basically won’t be able to do this out of the box with either the official Lucee Docker image or the Ortus CommandBox-based docker images as they are set up, in true container style, to have only a single web context.

If you want to hack together your own docker images (which sounds like a heck of a lot more work) then you shouldn’t need to do anything at all for this to work. A standard Lucee installation allows for any number of web contexts. By default the web context will be in the web-inf folder in your web root. If for some reason, you don’t want to have the Lucee web context to be in your web root in a web-inf folder, then you can just enable that setting Julian pointed to and leave the place holder in there. That’s the point of that placeholder, it’s dynamic so it will be different for each web context (it’s a hash, I think?) and you’ll get a separate web context folder without any real effort.

And to answer Julian’s original question to me, no CFConfig doesn’t do anything with your web.xml file. It sort of falls outside of the purview of CFConfig and it’s just for scripting CF config for a specific engine install, and it doesn’t really deal with your servlet container.

1 Like