lucee / lucee-dockerfiles

Official Lucee Dockerfiles for Docker Hub build images
https://hub.docker.com/u/lucee/
MIT License
85 stars 50 forks source link

Extensions are not consistently installed #68

Closed sbleon closed 1 year ago

sbleon commented 3 years ago

In my Dockerfile, I have, among other things:

FROM lucee/lucee:5.3.7.47-nginx-tomcat9.0-jdk8-openjdk
ENV LUCEE_EXTENSIONS="99A4EF8D-F2FD-40C8-8FB8C2E67A4EEEB6;name=mssql_jdbc;version=7.2.2.jre8,66E312DD-D083-27C0-64189D16753FD6F0;name=pdf;version=1.0.0.94-SNAPSHOT"

When I start my container for the first time, I find that either one or both of the extensions I've requested has been installed. I need to have both be installed every time.

I wonder if maybe prewarm.sh isn't waiting long enough.

PS. I used to use ADD to download .lex files and place them in the deploy directory, but that doesn't seem to work since I upgraded from 5.3.3.67 to 5.3.7.47.

jamiejackson commented 1 year ago

I don't remember when it was introduced, but there was a mechanism added to wait for extensions to be fully installed.

# MSSQL JDBC
ENV LUCEE_EXTENSIONS ${LUCEE_EXTENSIONS},99A4EF8D-F2FD-40C8-8FB8C2E67A4EEEB6;name=mssql_jdbc;version=7.2.2.jre8

# PDF
ENV LUCEE_EXTENSIONS ${LUCEE_EXTENSIONS},66E312DD-D083-27C0-64189D16753FD6F0;name=pdf;version=1.0.0.94-SNAPSHOT

# Install any extensions specified via "LUCEE_EXTENSIONS" environment variable.
#  "LUCEE_ENABLE_WARMUP" instructs lucee to shut down after extensions are
#  installed.
#  https://docs.lucee.org/guides/Various/system-properties.html#lucee_enable_warmupluceeenablewarmup
RUN LUCEE_ENABLE_WARMUP=true /usr/local/tomcat/bin/catalina.sh start

The last line is where the magic happens. The LUCEE_ENABLE_WARMUP=true is key--that causes Lucee to auto-shutdown when extension installation is complete.

Note that the Hibernate extension is an annoying snowflake that needs additional warmup considerations, but most (all?) other extensions work as mentioned above.

Also note that my way of listing extensions allows for more readable Dockerfiles since each extension gets its own line. Add as many additional lines as you need.

sbleon commented 1 year ago

I imagine that @jamiejackson's solution would fix this problem I was having. However, I'm now using the commandbox Docker images exclusively, so I can't easily test this.

zspitzer commented 1 year ago

https://github.com/lucee/lucee-dockerfiles/blob/master/supporting/prewarm.sh#L27C1-L29

jamiejackson commented 1 year ago

Ah, so @zspitzer, so I think you're implying that the canonical way to do it is with /usr/local/tomcat/bin/prewarm.sh instead of the LUCEE_ENABLE_WARMUP=true /usr/local/tomcat/bin/catalina.sh start, since the first command encapsulates the second. Good to know.

jamiejackson commented 1 year ago

TL;DR: Use prewarm.sh to install extensions.

I should have paid closer attention to @zspitzer 's reply.

prewarm.sh isn't just canonical, it's the only method of the two that currently works.

RUN LUCEE_ENABLE_WARMUP=true /usr/local/tomcat/bin/catalina.sh start doesn't work, at least not anymore. Something may have changed last September: https://github.com/lucee/lucee-dockerfiles/commit/518b15940bb56153ae75f220514922291f4ba1c7