<@U06V253M4> and <@U071QGDLH> - Hey, guys. I’m hav...
# box-products
@bdw429s and @jclausen - Hey, guys. I’m having a weird issue with a project that I’m trying to convert from the “official” Lucee Docker images to the commandbox docker image. I’ve defined
in my
to be
, and I’ve mounted the app code appropriately. Early in the startup process for the container, I see:
Copy code
Start script for shell [bash] generated at: /app/server-start.sh
(This is coming from commandbox’s
) Then later I see:
Copy code
har-lucee-1   | INFO: Starting server using generated script: /usr/local/bin/startup.sh
har-lucee-1   | + [[ ! -n '' ]]
har-lucee-1   | + [[ ! -n '' ]]
har-lucee-1   | + echo 'INFO: Starting server using generated script: /usr/local/bin/startup.sh'
har-lucee-1   | + mv /app/htdocs_www/server-start.sh /usr/local/bin/startup.sh
har-lucee-1   | mv: cannot stat '/app/htdocs_www/server-start.sh': No such file or directory
har-lucee-1 exited with code 1
(This is coming from docker-commandbox’s
) So there’s some disagreement about where
is supposed to be. It seems like docker-commandbox is respecting APP_ENV, but commandbox is not. Any ideas about where to start troubleshooting this?
(Another project that sets APP_ENV to a sub-directory of /app works just fine, and I can't figure out what the difference is between the two.)
@Leon Miller-Out I think there's two things you have to set
I'm not a fan of how brittle this is either
A lot of people hit this issue
When you said
, did you actually mean to say
Yes, you are correct, sir.
I have
I had a sneaking suspicion that there might be another place to set something, but I haven't been able to find it in my other app that's working correctly.
Are you also setting the webroot in your server.json or env vars?
Looking at another docker project I have going where I set
Copy code
ENV APP_DIR=/var/www
that's the only setting I have-- nothing else is in place that affects the web root, and it's working fine
I think perhaps I got the error you're getting when I had other settings in place
I have APP_DIR in my docker-compose.yml:
Copy code
      APP_DIR: /app/htdocs_www
Seems like that should be equivalent of having an
in the Dockerfile.
Umm, maybe
I needs to be there before your image warms up though if you're doing a warmup
There;s a lot of code paths this can go down depending on how you build your image
I have mine set at the top of my docker file
And I warm up my image in my docker file
I don't use the compose to set that
I tried moving the env var to the Dockerfile. That didn't change anything.
commandbox is writing server-start.sh to /app and docker-commandbox is looking for it at /app/htdocs_www
I can work around the problem by specifying
ENTRYPOINT /app/server-start.sh
in my Dockerfile.
@jclausen Will need to chime in then. This bit of logic is specific to the docker images.
Ah-ha! I found the missing piece (based on my working app). I have to do this in my Dockerfile:
Copy code
RUN box config set server.singleServerMode=false
No, you really shouldn't, lol
That's just a symptom of something else
if you have two servers trying to start in your container, that's just a sign of another problem
You aren't using a pre-warmed base image, are you?
I don't have two servers trying to start.
Then don't turn off single server mode 🙂
Copy code
FROM ortussolutions/commandbox:lucee5-3.4.5
But it makes my app work!
Yeah, that's your problem
You can't use a pre-warmed image!
They've already locked in their web root
you can't change it
set in stone
There's no reason to use a prewarmed image if you are making your own image, really
You're not saving yourself anything
And you're starting with an image that's already locked in a number of settings such as web root
Use the vanilla image and then you can do whatever you want
Copy code
FROM ortussolutions/commandbox
and then set the CFengine you want
Copy code
@Leon Miller-Out
I'll give it a shot!
It works!!! Woohoo!
Thanks so much, Brad. I owe you a lot of beers (or cups of coffee or whatever)!
You should come to Into The Box
It will be in Houston in September
Though, a firm handshake will suffice for payment 😉
early bird tix are already on sale https://www.intothebox.org/
It would be awesome to meet y'all in person!
👍 1