OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.15k stars 592 forks source link

User's server.xml not used if timestamp older than one in underlying container #21929

Open jwalcorn opened 2 years ago

jwalcorn commented 2 years ago

Describe the bug
If a customer is developing a microservice based on Open Liberty, and they have a src/main/liberty/config/server.xml that hasn't been touched in a while, and they move up to a new release of OL, a weird situation can occur where it ignores the server.xml that your Dockerfile copies into the image, and instead just uses the server.xml that comes built-in to the OL Docker image. This means your app generally won't work, as it won't have the stanzas telling it to load your war file, etc.

Steps to Reproduce
If I docker run my container and see my app didn't start (I don't have it in dropins, but instead have it in apps), I generally know that I need to go make a dummy edit to my /src/main/liberty/config/server.xml, to get it to be used rather than the "newer" server.xml built-in to the Docker image. Generally if the server only has a dozen or so lines of output, rather than multiple pages of output, it means this has happened. Note this used to occur years ago, and Arthur or one of his guys fixed this for me, I think in the implementation of the configure.sh (back when I was an IBMer and reported stuff internally, rather than via public GitHub), so this seems to be a regression.

Note you won't see if this if you just did a git clone of your repo, since that will make all the file timestamps equal to the time of the clone, rather than the true last edit date of the file. So you only notice this if you cloned it a while ago, have been making source code edits, but haven't needed to make a server.xml update in a while, and have recently done a docker pull of the latest OL image from DockerHub (or wherever), and then do a docker build.

Expected behavior
It should use the user's server.xml that they copy into the container, not the one baked in. It only does if the timestamp on the user's version is newer than the one baked in to the image.

Diagnostic information:

Additional context
Here's an example of the output when the wrong server.xml gets used, where you can see my war file doesn't get loaded, nor does it use any of my custom configuration of the server:

jalcorn@Johns-MBP-8 trader % docker run -p 9080:9080 -p 9443:9443 -e JWT_AUDIENCE=blah -e JWT_ISSUER=blah trader

Launching defaultServer (Open Liberty 22.0.0.6/wlp-1.0.65.cl220620220523-1607) on Eclipse OpenJ9 VM, version 17.0.3+7 (en_US) [AUDIT ] CWWKE0001I: The server defaultServer has been launched. [AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/keystore.xml [AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/open-default-port.xml [AUDIT ] CWWKG0028A: Processing included configuration resource: /opt/ol/wlp/usr/servers/defaultServer/includes/basic.xml [WARNING ] CWWKS3103W: There are no users defined for the BasicRegistry configuration of ID com.ibm.ws.security.registry.basic.config[basic]. [AUDIT ] CWWKZ0058I: Monitoring dropins for applications. [AUDIT ] CWPKI0820A: The default keystore has been created using the 'keystore_password' environment variable. [AUDIT ] CWWKI0001I: The CORBA name server is now available at corbaloc:iiop:localhost:2809/NameService. [AUDIT ] CWWKF0012I: The server installed the following features: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jndi-1.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, jsp-2.3, managedBeans-1.0, mdb-3.2, servlet-4.0, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1]. [AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 2.731 seconds. ^C[AUDIT ] CWWKE0085I: The server defaultServer is stopping because the JVM is exiting. [AUDIT ] CWWKE1100I: Waiting for up to 30 seconds for the server to quiesce. [AUDIT ] CWWKI0002I: The CORBA name server is no longer available at corbaloc:iiop:localhost:2809/NameService. [AUDIT ] CWWKE0036I: The server defaultServer stopped after 16.764 seconds. jalcorn@Johns-MBP-8 trader %

and I'm attaching one from when it did in fact use my server.xml: messages.log

scottkurz commented 2 years ago

Without reading through in detail this seems to overlap the issue with the Docker tooling: https://github.com/OpenLiberty/ci.docker/issues/244

jwalcorn commented 2 years ago

Yes, that was the old issue I was trying to find. It got fixed, but has come back lately.

jwalcorn commented 2 years ago

I had removed my hacks for working around this, but now need them back again: https://github.com/IBMStockTrader/trader/commit/0774aeede49c2bc703010d511f841715db8d59bd

tjwatson commented 3 months ago

I think this is fixed in #25442