design-group / ignition-docker-legacy

A preloaded Ignition Docker Development Environment
MIT License
16 stars 6 forks source link

[BUG] Unable to add additional JVM arguments #84

Open ia-eknorr opened 1 month ago

ia-eknorr commented 1 month ago

Describe the bug JVM fails due to "Unrecognized option: --" when using additional JVM arguments.

To Reproduce Steps to reproduce the behavior:

  1. docker run -d -p 9088:8088 --name ignition-test bwdesigngroup/ignition-docker:8.1.42 -a localhost -h 9088 -s 8043 -- gateway.resolveHostNames=true gateway.useProxyForwardedHeader=true
  2. docker logs ignition-test
  3. Observe the end of the wrapper logs where JVM does not start up correctly:
    
    ❯ docker logs ignition-test
    Running entrypoint with args -a localhost -h 9088 -s 8043  -- gateway.resolveHostNames=true gateway.useProxyForwardedHeader=true -Dignition.projects.scanFrequency=10 -Dlogback.configurationFile=/workdir/logback.xml
    init     | 2024/08/08 19:18:15 | Parsed httpAddress argument; new value: localhost
    init     | 2024/08/08 19:18:15 | Parsed httpPort argument; new value: 9088
    init     | 2024/08/08 19:18:15 | Parsed httpsPort argument; new value: 8043
    init     | 2024/08/08 19:18:15 | Creating init.properties file
    init     | 2024/08/08 19:18:15 | Creating gateway.xml
    init     | 2024/08/08 19:18:15 | Collected JVM arg:  --
    init     | 2024/08/08 19:18:15 | Collecting gateway arg: gateway.resolveHostNames=true
    init     | 2024/08/08 19:18:15 | Collecting gateway arg: gateway.useProxyForwardedHeader=true
    init     | 2024/08/08 19:18:15 | Collected JVM arg: -Dignition.projects.scanFrequency=10
    init     | 2024/08/08 19:18:15 | Collected JVM arg: -Dlogback.configurationFile=/workdir/logback.xml
    init     | 2024/08/08 19:18:15 | Processing GATEWAY_MODULES_ENABLED=alarm-notification,allen-bradley-drivers,bacnet-driver,opc-ua,perspective,reporting,tag-historian,web-developer

...

init | 2024/08/08 19:18:15 | Starting Ignition gateway wrapper | 2024/08/08 19:18:15 | --> Wrapper Started as Console wrapper | 2024/08/08 19:18:15 | Java Service Wrapper Standard Edition 64-bit 3.5.42 wrapper | 2024/08/08 19:18:15 | Copyright (C) 1999-2020 Tanuki Software, Ltd. All Rights Reserved. wrapper | 2024/08/08 19:18:15 | http://wrapper.tanukisoftware.com wrapper | 2024/08/08 19:18:15 | Licensed to Inductive Automation for Inductive Automation wrapper | 2024/08/08 19:18:15 | wrapper | 2024/08/08 19:18:15 | Launching a JVM... wrapper | 2024/08/08 19:18:15 | JVM exited while loading the application. jvm 1 | 2024/08/08 19:18:15 | Unrecognized option: -- jvm 1 | 2024/08/08 19:18:15 | Error: Could not create the Java Virtual Machine. jvm 1 | 2024/08/08 19:18:15 | Error: A fatal exception has occurred. Program will exit. wrapper | 2024/08/08 19:18:21 | Reloading Wrapper configuration... wrapper | 2024/08/08 19:18:21 | JVM process is gone. wrapper | 2024/08/08 19:18:21 | Launching a JVM... wrapper | 2024/08/08 19:18:21 | JVM exited while loading the application. jvm 2 | 2024/08/08 19:18:21 | Unrecognized option: -- jvm 2 | 2024/08/08 19:18:21 | Error: Could not create the Java Virtual Machine. jvm 2 | 2024/08/08 19:18:21 | Error: A fatal exception has occurred. Program will exit. wrapper | 2024/08/08 19:18:26 | Reloading Wrapper configuration... wrapper | 2024/08/08 19:18:26 | JVM process is gone. wrapper | 2024/08/08 19:18:27 | Launching a JVM... wrapper | 2024/08/08 19:18:27 | JVM exited while loading the application. jvm 3 | 2024/08/08 19:18:27 | Unrecognized option: -- jvm 3 | 2024/08/08 19:18:27 | Error: Could not create the Java Virtual Machine. jvm 3 | 2024/08/08 19:18:27 | Error: A fatal exception has occurred. Program will exit. wrapper | 2024/08/08 19:18:32 | Reloading Wrapper configuration... wrapper | 2024/08/08 19:18:32 | JVM process is gone. wrapper | 2024/08/08 19:18:32 | Launching a JVM... wrapper | 2024/08/08 19:18:32 | JVM exited while loading the application. jvm 4 | 2024/08/08 19:18:32 | Unrecognized option: -- jvm 4 | 2024/08/08 19:18:32 | Error: Could not create the Java Virtual Machine. jvm 4 | 2024/08/08 19:18:32 | Error: A fatal exception has occurred. Program will exit. wrapper | 2024/08/08 19:18:37 | Reloading Wrapper configuration... wrapper | 2024/08/08 19:18:38 | JVM process is gone. wrapper | 2024/08/08 19:18:38 | Launching a JVM... wrapper | 2024/08/08 19:18:38 | JVM exited while loading the application. jvm 5 | 2024/08/08 19:18:38 | Unrecognized option: -- jvm 5 | 2024/08/08 19:18:38 | Error: Could not create the Java Virtual Machine. jvm 5 | 2024/08/08 19:18:38 | Error: A fatal exception has occurred. Program will exit. wrapper | 2024/08/08 19:18:38 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up. wrapper | 2024/08/08 19:18:38 | There may be a configuration problem: please check the logs. wrapper | 2024/08/08 19:18:38 | <-- Wrapper Stopped



**Expected behavior**
Image should be able to handle additional JVM arguments

**Development Environment (please complete the following information):**

    - OS: MacOS Sonoma 14.5
ia-eknorr commented 1 month ago

I was able to fix this locally by updating this line in the entrypoint to remove a duplicate space that is produced before -- if it exists in the docker command.

Update to the following: args=("${args[@]/#-- /-- ${jvm_args[*]} }")