nextgenhealthcare / connect-docker

Official Dockerfiles for Connect https://hub.docker.com/r/nextgenhealthcare/connect
Mozilla Public License 2.0
77 stars 51 forks source link

Entrypoint.sh not respecting JAVA_TOOL_OPTIONS #19

Open daya opened 2 years ago

daya commented 2 years ago

Hi I m trying to start Mirth with JAVA_TOOL_OPTIONS='-XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=90.0' but if I do so then I am getting these errors

No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

My guess is JAVA_TOOL_OPTIONS and VMOPTIONS are mutually exclusive, but I am not a Java expert. For sure I don't want to be limited by Xmx setting limitations in multiples of 1024 hence trying -XX:MaxRAMPercentage

cturczynskyj commented 2 years ago

How are you setting these JAVA_TOOL_OPTIONS? Are you adding them to the VMOPTIONS environment variable?

daya commented 2 years ago

Are you adding them to the VMOPTIONS environment variable?

No I am not. All my environment variables are defined in .env file which is read by Docker

But if set it up without single quotes i.e. JAVA_TOOL_OPTIONS=-XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=90.0

then Mirth starts properly, perhaps it's ignoring JAVA_TOOL_OPTIONS settings :open_mouth: :no_good:

pladesma commented 2 years ago

I've tested this using a Docker Compose file and a .env file, and it seems to be picking up the JAVA_TOOL_OPTIONS settings. This appears in the logs as Mirth Connect starts up:

mc_1  | Picked up JAVA_TOOL_OPTIONS: -XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=90.0
mc_1  | INFO  2022-06-15 23:17:11,086 [Main Server Thread] com.mirth.connect.server.Mirth: Mirth Connect 4.0.1 (Built on April 18, 2022) server successfully started.
mc_1  | INFO  2022-06-15 23:17:11,089 [Main Server Thread] com.mirth.connect.server.Mirth: This product was developed by NextGen Healthcare (https://www.nextgen.com) and its contributors (c)2005-2022.
mc_1  | INFO  2022-06-15 23:17:11,090 [Main Server Thread] com.mirth.connect.server.Mirth: Running OpenJDK 64-Bit Server VM 11.0.14.1 on Linux (5.10.104-linuxkit, amd64), postgres, with charset UTF-8.
mc_1  | INFO  2022-06-15 23:17:11,091 [Main Server Thread] com.mirth.connect.server.Mirth: Web server running at http://172.31.0.3:8080/ and https://172.31.0.3:8443/

These are the contents of the .yaml file and .env files: connect.yaml

version: "3.1"
services:
  mc:
    image: nextgenhealthcare/connect
    env_file:
      - connect.env
    ports:
      - 8080:8080/tcp
      - 8443:8443/tcp
    depends_on:
      - db
  db:
    image: postgres
    environment:
      - POSTGRES_USER=mirthdb
      - POSTGRES_PASSWORD=mirthdb
      - POSTGRES_DB=mirthdb
    expose:
      - 5432

connect.env

JAVA_TOOL_OPTIONS="-XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=90.0"
DATABASE=postgres
DATABASE_URL=jdbc:postgresql://db:5432/mirthdb
DATABASE_MAX_CONNECTIONS=20
DATABASE_USERNAME=mirthdb
DATABASE_PASSWORD=mirthdb
DATABASE_MAX_RETRY=2
DATABASE_RETRY_WAIT=10000
KEYSTORE_STOREPASS=docker_storepass
KEYSTORE_KEYPASS=docker_keypass
VMOPTIONS=-Xmx512m

Then I used docker-compose -f connect.yaml up to start the containers.

daya commented 2 years ago

@pladesma I hope it's not the single quote problem since it works for you with double quotes. I will try with double quotes and see, but the error does seem weird when using single quotes