OneBusAway / onebusaway-docker

Docker configuration for the OneBusAway Application Modules (https://github.com/OneBusAway/onebusaway-application-modules)
Apache License 2.0
18 stars 32 forks source link

WIP: Parameterized DB credentials #28

Closed aaronbrethorst closed 7 months ago

aaronbrethorst commented 8 months ago

I’m trying to parameterize the configuration of database credentials in the data-sources.xml files by including placeholders in them initial (e.g. #JDBC_URL#) and then using sed to rewrite those at container runtime using environment variables, which are defined in docker-compose.yml.

The substitution seems to be working fine, but the Tomcat app server fails to boot correctly—complaining about JDBC configuration issues—if I do the substitution. When I hardcode values in place of the placeholders, everything works fine. I suspect that I’m doing something silly and just running into the limits of my knowledge of Docker, Java enterprise apps, and sed.

Thoughts about what might be going wrong:

To debug this, start by changing oba_entrypoint.sh's final command to something like tail -f /dev/null. That will keep Docker from stopping, but won't try to start Tomcat. You can enter the Docker environment and start Tomcat manually. Perhaps it will start fine, indicating a timing problem of some kind. If it fails, you can poke around for the root of the problem and try to restart it multiple times. Change permissions, re-type the credentials by hand, etc.