http://coldfusion.com logo
#box-products
Title
# box-products
d

danlance

02/21/2022, 2:48 PM
Hi, I’m running into unexpected issue with specifying the version of Lucee to run through commandbox within a docker container. Namely, the version of Lucee which is loading is default
5.3.8+206
rather than specified
5.3.7+47
Pertinent parts of the dockerfile as follows:
Copy code
FROM ortussolutions/commandbox:3.4.4

ARG BOX_SERVER_APP_CFENGINE lucee@5.3.7+47

RUN ${BUILD_DIR}/util/warmup-server.sh
But when I load the container, I get the following within STD-OUT
Copy code
lucee_1       | Set verboseErrors = true
lucee_1       | INFO: Server Home Directory set to: /usr/local/lib/serverHome
lucee_1       | + [[ -n '' ]]
lucee_1       | + [[ -n '' ]]
lucee_1       | INFO: Generating server startup script
lucee_1       |  √ | Starting Server
lucee_1       |    |------------------------------
lucee_1       |    | start server in - /var/www/
lucee_1       |    | server name - www
lucee_1       |    | server config file - /var/www//server.json
lucee_1       |    | WAR/zip archive already installed.
lucee_1       |    | Start script for shell [bash] generated at: /var/www/server-start.sh
lucee_1       |    | Server start command: 
lucee_1       |    |     /opt/java/openjdk/bin/java 
lucee_1       |    |     -XX:+UseContainerSupport 
lucee_1       |    |     -XX:MaxRAMPercentage=90.0 
lucee_1       |    |     -jar /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar 
lucee_1       |    |     --background=false 
lucee_1       |    |     --host 0.0.0.0 
lucee_1       |    |     --stop-port 35473 
lucee_1       |    |     --processname www [lucee 5.3.8+206] 
lucee_1       |    |     --log-dir /usr/local/lib/serverHome//logs 
lucee_1       |    |     --server-name www 
lucee_1       |    |     --tray-enable false 
lucee_1       |    |     --dock-enable true 
lucee_1       |    |     --directoryindex false 
lucee_1       |    |     --timeout 240 
lucee_1       |    |     --proxy-peeraddress true 
lucee_1       |    |     --cookie-secure false 
lucee_1       |    |     --cookie-httponly false 
lucee_1       |    |     --pid-file /usr/local/lib/serverHome//.pid.txt 
lucee_1       |    |     --gzip-enable true 
lucee_1       |    |     --logaccess-enable true 
lucee_1       |    |     --logaccess-basename access 
lucee_1       |    |     --logaccess-dir /usr/local/lib/serverHome//logs 
lucee_1       |    |     --cfengine-name lucee 
lucee_1       |    |     -war /var/www/ 
lucee_1       |    |     --web-xml-path /usr/local/lib/serverHome//WEB-INF/web.xml 
lucee_1       |    |     --http-enable true 
lucee_1       |    |     --ssl-enable false 
lucee_1       |    |     --ajp-enable false 
lucee_1       |    |     --http2-enable true 
lucee_1       |    |     --open-browser false 
lucee_1       |    |     --open-url <http://0.0.0.0:8888> 
lucee_1       |    |     --port 8888 
lucee_1       |    |     --urlrewrite-enable false 
lucee_1       |    |     --predicate-file /usr/local/lib/serverHome//.predicateFile.txt
lucee_1       |    | Dry run specified, exiting without starting server.
lucee_1       |    |------------------------------
lucee_1       |    | √ | Setting Server Profile to [production]
lucee_1       |    |   |-----------------------------------------------------
lucee_1       |    |   | Profile set from secure by default
lucee_1       |    |   | Block CF Admin external
lucee_1       |    |   | Block Sensitive Paths enabled
lucee_1       |    |   | Block Flash Remoting enabled
lucee_1       |    |   | Directory Browsing disabled
lucee_1       |    |   |-----------------------------------------------------
lucee_1       |    | √ | Loading CFConfig into server
lucee_1       |    |   |-------------------------------------------
lucee_1       |    |   | Setting OS environment variable [cfconfig_adminPassword] into luceeser
lucee_1       |    |   | ver
lucee_1       |    |   | [adminPassword] set.
lucee_1       |    |   |-------------------------------------------
lucee_1       | INFO: Starting server using generated script: /usr/local/bin/startup.sh
Specifically the following:
--processname www [lucee 5.3.8+206]
Can anyone advise what’s going on here - shouldn’t
ARG BOX_SERVER_APP_CFENGINE lucee@5.3.7+47
within the dockerfile cause Lucee 5.3.7.47 to be used rather than 5.3.8.206 (which is the latest release version of lucee)?
b

bdw429s

02/21/2022, 6:03 PM
@danlance Your console output above does not show what was happening during the very first server start (warmup) so it's hard to say what's going on;
The most common problem people have is using a pre-warmed image that already has version X in it and then trying to start version Y. I don't think that's the issue since I believe the
:3.4.4
tag isn't prewarmed, but I could be wrong.
In your output above, I see
Copy code
WAR/zip archive already installed.
which tells me the server has already been started at some earlier point in time so If the version isn't right, you'd need to back up and show us the console output of the VERY first start when the image was first warmed up and see if that one was right
d

danlance

02/22/2022, 10:05 AM
Any idea how to get docker to actually output to screen normally for the build? - for me on recent versions, the build process “scrolls” and only leaves a few lines visible on screen - making it very hard to view or capture…
Changing the BOX_SERVER_APP_CFENGINE variable form an ARG (only available during build) to ENV (also available when run) in the dockerfile has resolved the issue for now… although I expected for the version to be locked in during the build process and not requiring (and in fact ignoring) the ENV var in the dockerfile at runtime…
Equivalent output from startup when CFENGINE set as ENV var
Copy code
lucee_1       | Set verboseErrors = true
lucee_1       | INFO: CF Engine defined as lucee@5.3.7+47
lucee_1       | INFO: Server Home Directory set to: /usr/local/lib/serverHome
lucee_1       | + [[ -n '' ]]
lucee_1       | + [[ -n '' ]]
lucee_1       | INFO: Generating server startup script
lucee_1       |  √ | Starting Server
lucee_1       |    |------------------------------
lucee_1       |    | start server in - /var/www/
lucee_1       |    | server name - www
lucee_1       |    | server config file - /var/www//server.json
lucee_1       |    | WAR/zip archive already installed.
lucee_1       |    | Start script for shell [bash] generated at: /var/www/server-start.sh
lucee_1       |    | Server start command: 
lucee_1       |    |     /opt/java/openjdk/bin/java 
lucee_1       |    |     -XX:+UseContainerSupport 
lucee_1       |    |     -XX:MaxRAMPercentage=90.0 
lucee_1       |    |     -jar /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar 
lucee_1       |    |     --background=false 
lucee_1       |    |     --host 0.0.0.0 
lucee_1       |    |     --stop-port 35923 
lucee_1       |    |     --processname www [lucee 5.3.7+47] 
lucee_1       |    |     --log-dir /usr/local/lib/serverHome//logs 
lucee_1       |    |     --server-name www 
lucee_1       |    |     --tray-enable false 
lucee_1       |    |     --dock-enable true 
lucee_1       |    |     --directoryindex false 
lucee_1       |    |     --timeout 240 
lucee_1       |    |     --proxy-peeraddress true 
lucee_1       |    |     --cookie-secure false 
lucee_1       |    |     --cookie-httponly false 
lucee_1       |    |     --pid-file /usr/local/lib/serverHome//.pid.txt 
lucee_1       |    |     --gzip-enable true 
lucee_1       |    |     --logaccess-enable true 
lucee_1       |    |     --logaccess-basename access 
lucee_1       |    |     --logaccess-dir /usr/local/lib/serverHome//logs 
lucee_1       |    |     --cfengine-name lucee 
lucee_1       |    |     -war /var/www/ 
lucee_1       |    |     --web-xml-path /usr/local/lib/serverHome//WEB-INF/web.xml 
lucee_1       |    |     --http-enable true 
lucee_1       |    |     --ssl-enable false 
lucee_1       |    |     --ajp-enable false 
lucee_1       |    |     --http2-enable true 
lucee_1       |    |     --open-browser false 
lucee_1       |    |     --open-url <http://0.0.0.0:8888> 
lucee_1       |    |     --port 8888 
lucee_1       |    |     --urlrewrite-enable false 
lucee_1       |    |     --predicate-file /usr/local/lib/serverHome//.predicateFile.txt
lucee_1       |    | Dry run specified, exiting without starting server.
lucee_1       |    |------------------------------
lucee_1       |    | √ | Setting Server Profile to [production]
lucee_1       |    |   |-----------------------------------------------------
lucee_1       |    |   | Profile set from secure by default
lucee_1       |    |   | Block CF Admin external
lucee_1       |    |   | Block Sensitive Paths enabled
lucee_1       |    |   | Block Flash Remoting enabled
lucee_1       |    |   | Directory Browsing disabled
lucee_1       |    |   |-----------------------------------------------------
lucee_1       |    | √ | Loading CFConfig into server
lucee_1       |    |   |-------------------------------------------
lucee_1       |    |   | Setting OS environment variable [cfconfig_adminPassword] into luceeser
lucee_1       |    |   | ver
lucee_1       |    |   | [adminPassword] set.
lucee_1       |    |   |-------------------------------------------
lucee_1       | INFO: Starting server using generated script: /usr/local/bin/startup.sh
OK - managed to fin how to get docker-compose build process to output to screen rather than scroll:
docker-compose build --progress=plain
So, If I have the following in docker-file:
ARG BOX_SERVER_APP_CFENGINE lucee@5.3.7+47
Then I get this in the output:
Copy code
#10 19.35 Set verboseErrors = true
#10 19.60 INFO: Server Home Directory set to: /usr/local/lib/serverHome
#10 19.60 + [[ -n '' ]]
#10 19.60 + [[ -n '' ]]
#10 26.48  √ | Starting Server
#10 26.48    |------------------------------
#10 26.48    | Looking for server JSON file by convention: /var/www//server.json
#10 26.48    | webroot defaulted to location of server's JSON file: /var/www/
#10 26.48    | start server in - /var/www/
#10 26.48    | server name - www
#10 26.48    | server config file - /var/www//server.json
#10 26.48    | Building a WAR from local jars.
#10 26.48    | Server start command: 
#10 26.48    |     /bin/bash /usr/local/lib/CommandBox/cfml/system/modules_app/server
#10 26.48    | -commands/bin/server_spawner.sh /usr/local/lib/serverHome//nohup.log /
#10 26.48    | opt/java/openjdk/bin/java 
#10 26.48    |     -jar /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar 
#10 26.48    |     --background=true 
#10 26.48    |     --host 0.0.0.0 
#10 26.48    |     --stop-port 35809 
#10 26.48    |     --processname www [lucee 5.3.8+206] 
#10 26.48    |     --log-dir /usr/local/lib/serverHome//logs 
#10 26.48    |     --server-name www 
#10 26.48    |     --tray-enable false 
#10 26.48    |     --dock-enable true 
#10 26.48    |     --directoryindex false 
#10 26.48    |     --timeout 240 
#10 26.48    |     --proxy-peeraddress true 
#10 26.48    |     --cookie-secure false 
#10 26.48    |     --cookie-httponly false 
#10 26.48    |     --pid-file /usr/local/lib/serverHome//.pid.txt 
#10 26.48    |     --gzip-enable true 
#10 26.48    |     --cfengine-name lucee 
#10 26.48    |     -war /var/www/ 
#10 26.48    |     --web-xml-path /usr/local/lib/serverHome//WEB-INF/web.xml 
#10 26.48    |     --http-enable true 
#10 26.48    |     --ssl-enable false 
#10 26.48    |     --ajp-enable false 
#10 26.48    |     --http2-enable true 
#10 26.48    |     --open-browser false 
#10 26.48    |     --open-url <http://0.0.0.0:8888> 
#10 26.48    |     --port 8888 
#10 26.48    |     --urlrewrite-enable false 
#10 26.48    |     --predicate-file /usr/local/lib/serverHome//.predicateFile.txt
#10 26.48    | The server for /var/www/ is starting on <http://0.0.0.0:8888> ...
#10 26.48    |------------------------------
#10 26.48    | √ | Setting Server Profile to [production]
#10 26.48    |   |-----------------------------------------------------
#10 26.48    |   | Profile set from secure by default
#10 26.48    |   | Block CF Admin external
#10 26.48    |   | Block Sensitive Paths enabled
#10 26.48    |   | Block Flash Remoting enabled
#10 26.48    |   | Directory Browsing disabled
#10 26.48    |   |-----------------------------------------------------
#10 26.48    | √ | Loading CFConfig into server
#10 26.48    |   |-------------------------------------------
#10 26.48    |   | Setting OS environment variable [cfconfig_adminPassword] into luceeser
#10 26.48    |   | ver
#10 26.48    |   | [adminPassword] set.
#10 26.48    |   | No Web context admin password found. Setting your admin password to th
#10 26.48    |   | e same as your Server context password.
#10 26.48    |   | [adminPassword] set.
#10 26.48    |   |-------------------------------------------
#10 26.48 
#10 27.48 [INFO ] Runwar: Starting RunWAR 4.5.2
#10 27.48 [INFO ] Runwar: HTTP2 Enabled:true
#10 27.48 [INFO ] Runwar: HTTP sslEnable:false
#10 27.48 [INFO ] Runwar: HTTP ajpEnable:false
#10 27.49 [INFO ] Runwar: HTTP warFile exists:true
#10 27.49 [INFO ] Runwar: HTTP warFile isDirectory:true
#10 27.49 [INFO ] Runwar: Starting background www [lucee 5.3.8+206] from: /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar
But if I change that to:
ENV BOX_SERVER_APP_CFENGINE lucee@5.3.7+47
I get:
Copy code
#10 19.70 Set verboseErrors = true
#10 19.93 INFO: Server Home Directory set to: /usr/local/lib/serverHome
#10 19.94 + [[ -n '' ]]
#10 19.94 + [[ -n '' ]]
#10 52.57  √ | Starting Server
#10 52.57    |------------------------------
#10 52.57    | Looking for server JSON file by convention: /var/www//server.json
#10 52.57    | webroot defaulted to location of server's JSON file: /var/www/
#10 52.57    | start server in - /var/www/
#10 52.57    | server name - www
#10 52.57    | server config file - /var/www//server.json
#10 52.57    | Exploding WAR/zip archive...
#10 52.57    | Server start command: 
#10 52.57    |     /bin/bash /usr/local/lib/CommandBox/cfml/system/modules_app/server
#10 52.57    | -commands/bin/server_spawner.sh /usr/local/lib/serverHome//nohup.log /
#10 52.57    | opt/java/openjdk/bin/java 
#10 52.57    |     -jar /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar 
#10 52.57    |     --background=true 
#10 52.57    |     --host 0.0.0.0 
#10 52.57    |     --stop-port 44525 
#10 52.57    |     --processname www [lucee 5.3.7+47] 
#10 52.57    |     --log-dir /usr/local/lib/serverHome//logs 
#10 52.57    |     --server-name www 
#10 52.57    |     --tray-enable false 
#10 52.57    |     --dock-enable true 
#10 52.57    |     --directoryindex false 
#10 52.57    |     --timeout 240 
#10 52.57    |     --proxy-peeraddress true 
#10 52.57    |     --cookie-secure false 
#10 52.57    |     --cookie-httponly false 
#10 52.57    |     --pid-file /usr/local/lib/serverHome//.pid.txt 
#10 52.57    |     --gzip-enable true 
#10 52.57    |     --cfengine-name lucee 
#10 52.57    |     -war /var/www/ 
#10 52.57    |     --web-xml-path /usr/local/lib/serverHome//WEB-INF/web.xml 
#10 52.57    |     --http-enable true 
#10 52.57    |     --ssl-enable false 
#10 52.57    |     --ajp-enable false 
#10 52.57    |     --http2-enable true 
#10 52.57    |     --open-browser false 
#10 52.57    |     --open-url <http://0.0.0.0:8888> 
#10 52.57    |     --port 8888 
#10 52.57    |     --urlrewrite-enable false 
#10 52.57    |     --predicate-file /usr/local/lib/serverHome//.predicateFile.txt
#10 52.57    | The server for /var/www/ is starting on <http://0.0.0.0:8888> ...
#10 52.57    |------------------------------
#10 52.57    | √ | Setting Server Profile to [production]
#10 52.57    |   |-----------------------------------------------------
#10 52.57    |   | Profile set from secure by default
#10 52.57    |   | Block CF Admin external
#10 52.57    |   | Block Sensitive Paths enabled
#10 52.57    |   | Block Flash Remoting enabled
#10 52.57    |   | Directory Browsing disabled
#10 52.57    |   |-----------------------------------------------------
#10 52.57    | √ | Installing package [forgebox:lucee@5.3.7+47]
#10 52.57    |   | Verifying package 'lucee' in forgebox, please wait...
#10 52.57    |   | Installing version [5.3.7+47].
#10 52.57    |   | Verified entry in forgebox: 'lucee'
#10 52.57    |   | Deferring to [https] endpoint for forgebox entry [lucee]...
#10 52.57    |   | Downloading [<HTTPS://downloads.ortussolutions.com/lucee/lucee/5.3.7.47>
#10 52.57    |   | /cf-engine-5.3.7.47.zip]
#10 52.57    |   | Decompressing...
#10 52.57    |   | Storing download in artifact cache...
#10 52.57    |   | Done.
#10 52.57    |   | Installing to: /usr/local/lib/CommandBox/temp/E6585FDE-6214-464E-93F2D
#10 52.57    |   | 0D10CA03893
#10 52.57    |   | -> 2 File(s) Installed
#10 52.57    |   | -> 0 File(s) ignored
#10 52.57    |   | Eureka, 'lucee@5.3.7+47' has been installed!
#10 52.57    | √ | Loading CFConfig into server
#10 52.57    |   |-------------------------------------------
#10 52.57    |   | Setting OS environment variable [cfconfig_adminPassword] into luceeser
#10 52.57    |   | ver
#10 52.57    |   | [adminPassword] set.
#10 52.57    |   | No Web context admin password found. Setting your admin password to th
#10 52.57    |   | e same as your Server context password.
#10 52.57    |   | [adminPassword] set.
#10 52.57    |   |-------------------------------------------
#10 52.57 
#10 53.57 [INFO ] Runwar: Starting RunWAR 4.5.2
#10 53.57 [INFO ] Runwar: HTTP2 Enabled:true
#10 53.57 [INFO ] Runwar: HTTP sslEnable:false
#10 53.57 [INFO ] Runwar: HTTP ajpEnable:false
#10 53.57 [INFO ] Runwar: HTTP warFile exists:true
#10 53.57 [INFO ] Runwar: HTTP warFile isDirectory:true
#10 53.58 [INFO ] Runwar: Starting background www [lucee 5.3.7+47] from: /usr/local/lib/CommandBox/lib/runwar-4.5.2.jar
…So now I’m confused… My understanding of both documentation and numerous articles, was that ARG would only be available at build time, but ENV would be available at build and runtime… Now reading the documentation somewhat more carefully, I see that ENV always takes precedence over ARG… but even then I’m not seeing that this var is set within the base image… so… still confused… not what I expected at all….
In any case, we have a solution which works - bit if anyone can advise why ENV works but ARG does not during the build process… then please educate me 🙂
b

bdw429s

02/22/2022, 6:11 PM
@danlance I would bet the ENV is set in the base image and therefore always set to an empty string, overrriding your arg
Try defaulting the ENV to the arg in your docker file
What I can tell from your console output above is • when you used the arg, CommandBox shows no signs of having any sort of specific lucee version passed in. The output says
Building a WAR from local jars.
which is what you see when you just run a vanilla
server start
with no params in CommandBox. • When you used the env, it all looks normal. There is an entire section in the job output called
Installing package [forgebox:lucee@5.3.7+47]
which tells us it sees the cfenging
The next version of CommandBox will have even more debugging in place that shows all of the env vars it merges into your
server.json
to help troubleshoot these things.
But the long and short of it now is that the ARG is being completely ignored. You may be able to put in some sort of debugging to confirm what actual env vars are present and confirm if it's getting defaulted somewhere in the base image.
d

danlance

02/24/2022, 11:10 AM
Yeah - I assumed the same, but I believe neither of the above are relevant to our config… Ultimately the reason I had set as arg rather than env was due to issues we had run into with Lucee extensions set as environment vars… At one point (may have now been fixed) Lucee extensions which were defined within environment variables, would be redownloaded even if they had previously been downloaded - therfore we set as arg rather than env in dockerfile so that they would be downloaded and installed in build but not agains at runtime. Due to Commandbox being slightly more intelligent in it’s approach to downloading, it does not matter than the env var for engine version is still defined, as it will not redownload - hence the fact that arg gets ignored and we have to use env is (for us) not really an issue. If anyone does work out where this is being overridden - and if possible resolve - then that’s probably a good thing, but now we know arg does not work, then we are happy to use env instead…
8 Views