Update Lucee Applications available at command line

When I start a Lucee server with commandbox, I can log into the administrator and update the installed applications. Like MYSQL driver and S3 resource etc…

When I run a command from the command line like “box test.cfm” I assume it runs the file in the context of a Lucee engine.

How can I upgrade the applications that are installed in the Lucee engine that commandbox uses to run my command line scripts?

Thanks,

Adam

Hi Adam, this is a good question without a good answer and for the record, I blame Lucee here for being limited in its approach that assumes it will always be used inside of a web server situation. There is in fact a Lucee engine that runs to power the CLI and its home directories are inside of the .CommandBox folder that CommandBox installs to.

~.CommandBox\engine\cfml\server\lucee-server\context

If you’re on the CommandBox 4.0 snapshot which runs lucee 5, you can upgrade or install extensions somewhat easily by just copying the lex files into the deploy folder that’s part of the core Lucee engine and they will get picked up within 60 seconds so long as the CLI is running. Otherwise, you’d probably need to use the JVM args when starting the shell that allow you to tell the Lucee engine to make sure a specific version of a given extension is available. I don’t actually know exactly what version of Lucee started doing this though.

http://docs.lucee.org/guides/running-lucee/configuring-lucee/system-properties.html

That doc above kind of sucks and doesn’t show you how to do specific versions though. Here’s an example in the actual Lucee build of the JVM arg in action:

https://github.com/lucee/Lucee/blob/a90aec788b8f6f876b650e8fb656ff31b9cd6f6b/ant/build-core.xml#L804

The properties are defined here-- just the GUID if the extension:

https://github.com/lucee/Lucee/blob/a90aec788b8f6f876b650e8fb656ff31b9cd6f6b/ant/build-core.xml#L19-L21

I THINK this syntax here will also specify the version of the extension, but I’ve honestly tried it. This file is used when the Lucee build runs to decide what extensions are present by default:

https://github.com/lucee/Lucee/blob/master/core/src/main/java/META-INF/MANIFEST.MF#L385

Honestly, I think most of those options above sort of suck, but I’ve not made much headway getting it changed. I’ve heard some rumors of a new Lucee version having a CFML function you can run to require an extension of a specific version but I’m not sure when it will come out or how it will work. I’ve been asking for that for a long time and I think it’s the best solution to this really.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Oh, I forgot to tell you how to add JVM args to the actual CLI binary, lol. This depends a bit on your OS, but I added a feature recently that works on all OS’s.

https://ortussolutions.atlassian.net/browse/COMMANDBOX-680

So basically, set the following env vars on your OS and the Box binary will pick them up and turn them into Java system properties:

BOX_JAVA_PROPS="foo=bar;brad=wood"

That would create a java prop called foo and brad. It’s the equiv of these JVM args if you were to direct invoke a Java process:

-Dfoo=bar -Dbrad=wood

So you’d want to do something along the lines of:

BOX_JAVA_PROPS="lucee-extensions=FAD1E8CB-4F45-4184-86359145767C29DE;version=3.5.5.68"

I’ve never tried that, but it’s where I’d start. You can also start the box binary with a --debug flag (note I renamed that to -clidebug in CommandBox 4.0) and you’ll see the raw output of the Lucee engine starting up which might give you some feedback.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad,

I’m not using CommandBox 4.0, but I just started the project and I will give it a try.
Thanks for the detailed answer. Very helpful.

Adam