Adding default extension to lucee-server.xml

I want to add the cfspreadsheet extension to my lucee-server.xml by default (config management via source control).

I imagine it should be something such as

<rhextension categories="Datasource" file-name="1suzt0qwllure.lex" id="7E673D15-D87C-41A6-8B5F1956528C605F" jdbc="[{'label':'MySQL','id':'mysql','class':'com.mysql.cj.jdbc.Driver','bundleName':'com.mysql.cj','bundleVersion':'8.0.15'}]" lucee-core-version="5.0.0.019" name="MySQL" release-type="all" start-bundles="false" trial="false" version="8.0.15"/>

Currently, I have the lex file in the server config’s deploy folder, but I’d rather have it available immediately on startup rather than waiting for the deploy thread to activate (~1min). What would the syntax be to add a lex file already on disk so that it is immediately loaded?

I don’t know anything about auto installing extensions via lucee-server.xml but I know it can be done by specifying them with an environment variable. This would be the name/value for cfspreadsheet:

LUCEE_EXTENSIONS "037A27FF-0B80-4CBA-B954BEBD790B460E;name=cfspreadsheet"

Lucee will pick this up on startup and install the extension from ForgeBox. You can also do it via a JVM system property, but I’ve found the EV approach easier.

There really isn’t a way to maually install in the XML file. Lucee does a lot of things when it installs an extension including copying files around, adding bundles, JDBC definitions. The three methods you have to auto-install extensions all involve waiting for Lucee to actually start and are:

  • Place lex file in deploy folder. As you said this waits up to 60 seconds but note:Micha just completed a ticket for me that changes that! It will be in Lucee 5.3.7 https://luceeserver.atlassian.net/browse/LDEV-2651
  • Use the LUCEE-EXTENSION env var. What most people don’t realize is this list of extension IDs will look not only in all the registered extension providers, but also in the extensions/available folder. This means until the ticket above is complete, you can place the lex in the available folder and put the ID in the env var to get it loaded right away
  • The third way is to custom compile or hack apart the core “lco” file that is bundled in the Lucee jar and extracted on startup into the patches folder. Inside the META-INF/MANIFEST.MF file at the bottom is a list of requried extensions where you can also put a list of lex IDs that will be processed on startup using the same lookup rules as the second bullet. This option is annoying, but I just recently did it in the CommandBox light builds since I needed instant installation AND I didn’t want to overwrite any env vars the user may also be trying to set.

And on the topic of the second bullet, here is a screencast that shows some of the new tooling in CommandBox to help you track your Lucee extensions as dependencies in your box.json and auto install them into the deploy folder as part of your box install process. It doesn’t change how Lucee works, but it helps you automated it a bit better.

2 Likes

Use the LUCEE-EXTENSION env var. What most people don’t realize is this list of extension IDs will look not only in all the registered extension providers, but also in the extensions/available folder. This means until the ticket above is complete, you can place the lex in the available folder and put the ID in the env var to get it loaded right away

I think this is the solution I’m most interested in - especially if there is a correlated system property that can be defined (-Dlucee.extension I would assume?).

Thanks for the tip on box. We’re actually using Maven to package/build our applications, using these plugins - GitHub - dajester2013/lucee-maven-plugin: A maven plugin to simplify Lucee project development.