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 #4796

Closed
psapozh opened this issue Oct 15, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@psapozh
Copy link

psapozh commented Oct 15, 2021

Describe the bug
When passing Mysql jdbc url with SSL and multiple properties as environment variable into kubernetes pod, 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.

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.

@psapozh psapozh added the bug Something isn't working label Oct 15, 2021
@psapozh
Copy link
Author

psapozh commented Oct 16, 2021

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.

@pacmano1
Copy link
Collaborator

pacmano1 commented Oct 16, 2021

This really a bug if you need to properly escape a var?

https://superuser.com/questions/775173/how-to-escape-and-in-dockers-environment-varibles notes the need to escape for downstream scripts.

@psapozh
Copy link
Author

psapozh commented Oct 18, 2021

I have created: nextgenhealthcare/connect-docker#13

@psapozh psapozh closed this as completed Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants