Changing version of server

Brad - I can’t seem to get this to work. I issue a command like this:
server set app.cfengine=lucee@5.3.12+1

and the server.json file gets updated. But when I restart the related service, the engine still shows the one I had been running. What am I missing? Or is there a better way in 2023?

Hi @technomaz I moved this question to a new topic since that was an old thread.

Start your server as

start --verbose

and please post the full console output here (remove anything sensitive).
There’s a number of things that could be happening, but the most likely is you have a custom server home configured.

Here you go! So, something I’ve never seen–it’s telling me to run “server forget”. According to the docs for that command, “If you don’t want to lose your settings, back them up first with the CFConfig tool.” How do I successfully do this upgrade?

start mytestapp --verbose
 √ | Starting Server
   |------------------------------
   | Looking for server JSON file by convention: /home/someuser//server-mytestapp.json
   | webroot defaulted to location of server's JSON file: /home/someuser/
   | Switching to the last-used server JSON file for this server: /home/someuser/domains/www.example.com/public_html/server.json
   | Recalculating web root based on new server JSON file.
   | webroot defaulted to location of server's JSON file: /home/someuser/domains/www.example.com/public_html/
   | start server in - /home/someuser/domains/www.example.com/public_html/
   | server name - mytestapp
   | server config file - /home/someuser/domains/www.example.com/public_html/server.json
   | You've asked for the engine [lucee@5.3.12+1] to be started,
   | but this server home already has [lucee@5.3.10+97] deployed to it!
   | In order to get the new version, you need to run 'server forget' on this server and start it again.
   | WAR/zip archive already installed.
   | Server start command: 
   |     /bin/bash /opt/CommandBox/.CommandBox/cfml/system/modules_app/server-commands/bin/server_spawner.sh /opt/CommandBox/web-contexts/wwwroot-mytestapp//nohup.log /usr/lib/jvm/java-11-openjdk-amd64/bin/java 
   |     -cp /opt/CommandBox/.CommandBox/lib/runwar-4.8.5.jar runwar.Start 
   |     --background=true 
   |     --host 127.0.0.1 
   |     --stop-port 36455 
   |     --processname mytestapp [lucee 5.3.10+97] 
   |     --log-dir /opt/CommandBox/web-contexts/wwwroot-mytestapp//logs 
   |     --server-name mytestapp 
   |     --tray-enable false 
   |     --dock-enable true 
   |     --directoryindex true 
   |     --timeout 240 
   |     --proxy-peeraddress false 
   |     --cookie-secure false 
   |     --cookie-httponly false 
   |     --pid-file /opt/CommandBox/web-contexts/wwwroot-mytestapp//.pid.txt 
   |     --tray-icon /opt/CommandBox/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png 
   |     --undertow-options=MAX_HEADER_SIZE=102400 
   |     --gzip-enable true 
   |     --cfengine-name lucee 
   |     -war /home/someuser/domains/www.example.com/public_html/ 
   |     --web-xml-path /opt/CommandBox/web-contexts/wwwroot-mytestapp//WEB-INF/web.xml 
   |     --http-enable true 
   |     --ssl-enable false 
   |     --ajp-enable true 
   |     --http2-enable true 
   |     --open-browser false 
   |     --open-url http://127.0.0.1:8080 
   |     --port 8080 
   |     --ajp-port 8009 
   |     --urlrewrite-enable false 
   |     --client-cert-trust-headers false 
   |     --predicate-file /opt/CommandBox/web-contexts/wwwroot-mytestapp//.predicateFile.txt
   | The server for /home/someuser/domains/www.example.com/public_html/ is starting on http://127.0.0.1:8080 ...
   |------------------------------
   | √ | Setting Server Profile to [development]
   |   |------------------------------------------------------
   |   | Profile set from server bound to localhost
   |   | Block CF Admin disabled
   |   | Block Sensitive Paths enabled
   |   | Block Flash Remoting enabled
   |   | Directory Browsing enabled
   |   | File Caching disabled
   |   |------------------------------------------------------
   | √ | Loading CFConfig into server
   |   |-------------------------------------------

NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.cs=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.annotation=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.module=ALL-UNNAMED --add-opens=java.base/java.lang.ref=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.net.spi=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.channels=ALL-UNNAMED --add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.nio.charset.spi=ALL-UNNAMED --add-opens=java.base/java.nio.file=ALL-UNNAMED --add-opens=java.base/java.nio.file.attribute=ALL-UNNAMED --add-opens=java.base/java.nio.file.spi=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.security.interfaces=ALL-UNNAMED --add-opens=java.base/java.security.spec=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.text.spi=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.time.chrono=ALL-UNNAMED --add-opens=java.base/java.time.format=ALL-UNNAMED --add-opens=java.base/java.time.temporal=ALL-UNNAMED --add-opens=java.base/java.time.zone=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED --add-opens=java.base/java.util.function=ALL-UNNAMED --add-opens=java.base/java.util.jar=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util.spi=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.base/javax.crypto=ALL-UNNAMED --add-opens=java.base/javax.crypto.interfaces=ALL-UNNAMED --add-opens=java.base/javax.crypto.spec=ALL-UNNAMED --add-opens=java.base/javax.net=ALL-UNNAMED --add-opens=java.base/javax.net.ssl=ALL-UNNAMED --add-opens=java.base/javax.security.auth=ALL-UNNAMED --add-opens=java.base/javax.security.auth.callback=ALL-UNNAMED --add-opens=java.base/javax.security.auth.login=ALL-UNNAMED --add-opens=java.base/javax.security.auth.spi=ALL-UNNAMED --add-opens=java.base/javax.security.auth.x500=ALL-UNNAMED --add-opens=java.base/javax.security.cert=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.nimbus=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.nimbus=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/sun.security.rsa=ALL-UNNAMED --add-opens=java.base/sun.security.pkcs=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.util.cldr=ALL-UNNAMED --add-opens=java.base/sun.util=ALL-UNNAMED --add-opens=java.base/sun.util.locale.provider=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED  --add-exports=java.desktop/sun.java2d=ALL-UNNAMED --add-exports=java.base/sun.util=ALL-UNNAMED
WARNING: package com.sun.java.swing.plaf.nimbus not in java.desktop
WARNING: package com.sun.java.swing.plaf.windows not in java.desktop
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.8.5
[INFO ] Runwar: Binding HTTP on 127.0.0.1:8080
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Binding AJP on 127.0.0.1:8009
[INFO ] Starting in background - 

When you have issues with a sever, the first thing you do, should be a verbose/debug start and read the output. You’ll be amazed what useful stuff is in there :slight_smile:

Correct, the answer to your question was right there in the logs the entire time.

You've asked for the engine [lucee@5.3.12+1] to be started, but this server home already has [lucee@5.3.10+97] deployed to it! 
In order to get the new version, you need to run 'server forget' on this server and start it again.

This is because you have specified a custom server home, and when you take away CommandBox’s ability to manage the server home, CommandBox can’t create new homes for each version. And since CommandBox doesn’t do anything destructive with your servers (such as blow away the old home in order to start a new version), it can’t update an existing server for you in this case. When you’ve taken over where the server home lives and you want a new version of the engine, you’ll need to forget the old one first, as the message says.

Related ticket: [COMMANDBOX-1298] - Welcome

Yes, that’s correct. Did you have a specific question about that statement?

CFConfig Docs: https://cfconfig.ortusbooks.com/

You forget the server. Are you asking how to forget a server?
Docs: Manage Servers - CommandBox : CLI, Package Manager, REPL & More

On an unrelated note, you have something REALLY funky going on here

   | Looking for server JSON file by convention: /home/someuser//server-mytestapp.json
   | webroot defaulted to location of server's JSON file: /home/someuser/
   | Switching to the last-used server JSON file for this server: /home/someuser/domains/www.example.com/public_html/server.json
   | Recalculating web root based on new server JSON file.
   | webroot defaulted to location of server's JSON file: /home/someuser/domains/www.example.com/public_html/

I’m not really sure if you are wanting this to be setup like that, but it seems confusing and is probably causing other issues. I would recommend forgetting all your servers and starting fresh with the single server.json you want and starting the server in that folder. You can see all servers defined with

server list

to make sure you’ve cleaned everything up.

Thanks Brad. Though technically inclined, I’m definitely a newbie in the CommandBox world. So while you know exactly what you mean when the instructions say to “back [your settings] up first with the CFConfig tool” and you point to the CFConfig book. But searching for “backup” in that book produced one result–the Overview page. The reference is to “Export config from a server as a backup”, which then led me to search for “export” in the book, which then led me to the Export settings page which in turn seems pretty self-explanatory. But not quite. I realized after a couple tries that a “server forget” removes the webcontext folder which has all the Lucee settings, extensions, etc. in it and that the “cfconfig export” needs to be run for both the lucee server and the lucee web app. And likewise both need to be imported after starting up the new server. This was terribly not clear in any the docs, especially given the simple “backup up your settings” statement that started it all.

For posterity, here is the step-by-step process I took to get the upgrade finalized:

  1. Create an archive zip (or tar gz) of the folder under “web-contexts” as a backup “just in case.”
  2. Launch box and change to the server you are working on
  3. Backup the both the Lucee server and web configs using CFConfig
    a. cfconfig export /path/to/backup.json
    b. cfconfig export fromFormat=luceeWeb to=/path/to/backup-web.json
  4. Make sure the server json is ready to use the new cfengine by updating the config like this:
    a. server set app.cfengine=lucee@5.3.12+1
  5. Stop the server: server stop servername
  6. Wipe out the settings: server forget servername
  7. Start the server (I used my .service command file in the file system outside of box)
  8. Import your configs back
    a. cfconfig import to=myappname from=/path/to/backup.json
    b. cfconfig import toFormat=luceeWeb from=/path/to/backup-web.json
  9. Execute a server restart to make sure all the settings take
    a. server restart

As far as the JSON file “funkiness”, I’m guessing it’s because I was logged in as a different user (“someuser”) than what the server normally runs under so it was hunting around. I used the instructions on this Lucee page for setting up command box. Step 6 talks about running under a limited user, which I’m doing.

1 Like

I’m happy to help, but it’s easier to help if I can get more specific questions :slight_smile: There are also several webinars, user group/conference preso, and slide decks out there that cover all this.
http://www.ccfug.org/sites/ccfug/assets/File/presentations/CF%20apps%20to%20dev%20to%20production%20with%20CommandBox%20CFConfig%20Docker.pdf

For what it’s worth, there’s really no reason to use the Lucee web context in a CommandBox server as there’s only ever one context making them sort of moot (with the exception of ModCFML and Multi-site features). As a general rule, I put all my settings in the server context by default, with the exception of scheduled tasks, which can only be placed in a web context. This simplifies the CFConfig usage.

If you backup the files to the web root using the file names .cfconfig.json and .cfconfig-web.json then they will just automatically be imported to the correct location every time you start the server.

If you haven’t already, I highly recommend “pinning” the CommandBox home to the same folder for all users. Otherwise, you’ll have two CommandBox installations, each with different settings, different modules, etc and it can really confuse things.