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

@bdw429s Any update to this concept now that we’re a little further down the road? ( Five years! :slight_smile: )

The most common approach nowadays is for people to use the LUCEE_EXTENSIONS env var, which can be set in your server.json if you wish.

{
    "name" : "My server",
    "env":{
        "LUCEE":{
            "EXTENSIONS":"guid,guid,guid"
        }
    }
}

If you want to install extensions from ForgeBox, you can also specify the guid in the box.json as a dependency and box install will place the lex in the lucee server context deploy folder if the Lucee server has been started already.

This seems to work, mostly as expected, thank you. (I say “mostly” because I don’t think it’s 100% on getting the most recent version.)

{
    "app":{
        "cfengine":"lucee@5.4.4.38"
    },
    "name":"DWO",
    "env":{
        "LUCEE":{
            "EXTENSIONS":"87FE44E5-179C-43A3-A87B3D38BEF4652E,FAD1E8CB-4F45-4184-86359145767C29DE,99A4EF8D-F2FD-40C8-8FB8C2E67A4EEEB6,5C558CC6-1E67-4776-96A60F9726D580F1,D062D72F-F8A2-46F0-8CBC91325B2F067B"
        }
    }
}