Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Issue with docker image taking complete jdbc url with two or more extra properties from environment variable #13

Open
psapozh opened this issue Oct 18, 2021 · 1 comment

Comments

@psapozh
Copy link

psapozh commented Oct 18, 2021

Describe the bug
When passing Mysql jdbc url with SSL and multiple properties as environment variable into kubernetes pod/docker container, the server has trouble taking that url value into db connection. When using this inside mirth.properties file it works correctly.

To Reproduce
To reproduce one would simply add jdbc url like this jdbc:mysql://<some_ip_name>:3306/mirth?useSSL=true&enabledTLSProtocols=TLSv1.2&serverTimezone=UTC into the DATABASE_URL environment variable when starting a docker container/pod

Expected behavior
Expected behavior is to have mirth use full jdbc url correctly and be able to connect to DB like it does using mirth.properties

Actual behavior
I get different exceptions depending on how many of these extra properties are there. For example if url is like mentioned above then exception is like this:

Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        at java.base/sun.security.ssl.HandshakeContext.<init>(Unknown Source)

if url is like this: jdbc:mysql://<some_ip>:3306/mirth?enabledTLSProtocols=TLSv1.2

the exception will be this:

ERROR 2021-10-15 21:11:17,176 [Main Server Thread] com.mirth.connect.server.Mirth: Error establishing connection to database, retrying startup in 10000 milliseconds
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The server time zone value 'Coordinated Universal Time' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:512)

This is expected because yes it really needs that time zone property but when they're both or more set in url nothing takes in effect

Screenshots
N/A

Environment (please complete the following information):

  • Connect Version [e.g. 3.12.0]
  • Azure Kubernetes Service

Workaround(s)
We are evaluating if it would be possible for the time being to hard code mirth.properties file into mirth docker image. This is less than ideal by far.

One other work around that I noticed is we can put \\ in front of the & and that seems to do the trick. So for example:

jdbc:mysql://<some_ip>:3306/mirth?enabledTLSProtocols=TLSv1.2\\&serverTimezone=UTC

I can confirm this works but this should be fixed ideally.

Additional context
The problem seems to be happening only when passing url as environment variable to docker and only when there are multiple extra properties to set.

@cturczynskyj
Copy link
Collaborator

Looks like a problem with the sed command and &. Good that you found a workaround, but it would be good to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants