• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Docker and Mango v5.0.2

    Mango Automation Installation
    5
    11
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jdiaz-coJ
      Jdiaz-co
      last edited by

      Hello, we are having issues with the installation of Mango 5 in a Docker container. When starting Mango, it doesn't proceed beyond the step "Loading Jetty web server SSL/TLS certificate from: /opt/mango/certificates/instance.p12." We are doing this using JDK-17.

      This is a Dockerfile:

      FROM openjdk:17-ea-17-jdk

      COPY free-m2m2-core-5.0.2.zip /tmp
      RUN mkdir -p /opt/mango
      && microdnf install unzip openssl
      && unzip /tmp/free-m2m2-core-5.0.2.zip -d /opt/mango
      && cd /opt/mango

      ENV MA_HOME /opt/mango
      ENV MA_CP $MA_HOME/overrides/classes:$MA_HOME/classes:$MA_HOME/overrides/properties:$MA_HOME/overrides/lib/:$MA_HOME/lib/

      EXPOSE 5000
      WORKDIR /opt/mango
      ENTRYPOINT exec java -server -cp $MA_CP -Dma.home=$MA_HOME -Djava.library.path=$MA_HOME/overrides/lib:$MA_HOME/lib:/usr/lib/jni/:$PATH com.serotonin.m2m2.Main

      MattFoxM 1 Reply Last reply Reply Quote 0
      • MattFoxM
        MattFox @Jdiaz-co
        last edited by

        @Jdiaz-co mango starts with ssl on by default for fresh installs. I'd advise generating a mango.properties file with all of your preferred settings and loading that into your image.
        Secondly, ensure you've exposed the ports needed to view mango on 8080 or 8443 if you do go with the SSL route...

        Let me know how you get on

        Fox

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        M T 2 Replies Last reply Reply Quote 0
        • M
          Mark @MattFox
          last edited by

          @MattFox

          I used your dockerfile to install mango but I get the following error message when starting the container:

          Error: Could not find or load main class com.serotonin.m2m2.Main
          Caused by: java.lang.ClassNotFoundException: com.serotonin.m2m2.Main

          Do you know how I can solve this?

          MattFoxM 1 Reply Last reply Reply Quote 0
          • MattFoxM
            MattFox @Mark
            last edited by

            @Mark I'd ensure all path variables are correct first.

            Fox

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            M 1 Reply Last reply Reply Quote 0
            • M
              Mark @MattFox
              last edited by Mark

              @MattFox

              Sorry but my knowledge of Linux is limited.
              I put all the files in the right place and then used the docker file to install mango. Have I forgotten something or done it wrong?

              MattFoxM 1 Reply Last reply Reply Quote 0
              • MattFoxM
                MattFox @Mark
                last edited by

                @Mark
                If my docker knowledge is correct, I'd replace
                ENTRYPOINT exec java -server -cp $MA_CP -Dma.home=$MA_HOME -Djava.library.path=$MA_HOME/overrides/lib:$MA_HOME/lib:/usr/lib/jni/:$PATH com.serotonin.m2m2.Main

                with ENTRYPOINT exec bin/start-mango.sh

                Fox

                Do not follow where the path may lead; go instead where there is no path.
                And leave a trail - Muriel Strode

                M 1 Reply Last reply Reply Quote 0
                • T
                  tungthanh500 @MattFox
                  last edited by

                  @MattFox If I am not wrong, in Mango 5, you must access the web with 8443 (or SSL route) and there is no workaround. I'm using an Mango instance on Windows to try stuff and no way out :"<

                  terrypackerT 1 Reply Last reply Reply Quote 0
                  • terrypackerT
                    terrypacker @tungthanh500
                    last edited by terrypacker

                    @tungthanh500 there are ways around this. In Mango 5 the default is to have HTTPS enabled on first start. This also enables HSTS which redirects from the HTTP port to HTTPS. You can change these settings by injecting mango properties into the container or modifying the mango.properties file you are loading.

                    Take a look at these properties:

                    # Note: Enabling SSL/TLS also turns on HSTS by default, see the ssl.hsts.enabled setting below
                    ssl.on=true
                    ssl.port=8443
                    
                    ...
                    
                    # Configure HSTS (HTTP Strict Transport Security)
                    # Enabled by default when ssl.on=true
                    # Sets the Strict-Transport-Security header, web browsers will always connect using HTTPS when they
                    # see this header and they will cache the result for max-age seconds
                    ssl.hsts.enabled=true
                    ssl.hsts.maxAge=31536000
                    ssl.hsts.includeSubDomains=false
                    

                    And how to inject them into the container as env variables: https://docs-v5.radixiot.com/configure-mango-properties

                    Just note that if you change the HSTS settings you will need to clear your browser cache since it will have cached the entry to always use HTTPS already.

                    1 Reply Last reply Reply Quote 1
                    • M
                      Mark @MattFox
                      last edited by Mark

                      @MattFox

                      I have used the file below and now I get the following message:

                      ++ HOME environment variable is /opt/mango
                      ++ mango_paths_home is /opt/mango
                      +++++ Mango configuration found on
                      ++ mango_script_dir is /opt/mango/bin
                      ++ mango_paths_data is /opt/mango
                      Mango installation/home directory is /opt/mango
                      Mango data path is /opt/mango
                      Starting Mango
                      Mango started (PID 16)

                      The container returns status "exited"

                      FROM openjdk:17-ea-17-jdk

                      COPY free-m2m2-core-5.0.3.zip /tmp
                      RUN mkdir -p /opt/mango
                      && microdnf install -y unzip openssl
                      && unzip /tmp/free-m2m2-core-5.0.3.zip -d /opt/mango
                      && cd /opt/mango

                      ENV HOME /opt/mango
                      ENV MA_HOME /opt/mango
                      ENV MA_CP $MA_HOME/overrides/classes:$MA_HOME/classes:$MA_HOME/overrides/properties:$MA_HOME/overrides/lib/:$MA_HOME/lib/

                      EXPOSE 8443
                      WORKDIR /opt/mango
                      ENTRYPOINT exec bin/start-mango.sh $MA_CP -Dma.home=$MA_HOME -Djava.library.path=$MA_HOME/overrides/lib:$MA_HOME/lib:/usr/lib/jni/:$PATH com.serotonin.m2m2.Main

                      MattFoxM 1 Reply Last reply Reply Quote 0
                      • MattFoxM
                        MattFox @Mark
                        last edited by MattFox

                        @Mark
                        ENTRYPOINT exec bin/start-mango.sh
                        By itself, you shouldn't need those other parameters. Those environment variables are already set above.
                        As for why it exited, you'd need to see the output from mango/logs/ma.log.
                        Alternatively, if it's running then crashing you should be able to view the log in the console by issuing the command
                        docker run --rm -it --entrypoint /bin/bash <image_name>
                        That will help you view any remaining output.

                        Fox

                        Do not follow where the path may lead; go instead where there is no path.
                        And leave a trail - Muriel Strode

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Mark @MattFox
                          last edited by

                          @MattFox

                          When I execute your command, a container is created, but without Mango being installed.
                          Since my knowledge is too limited, I'm going to install mango in a windows environment.
                          Still, thank you for your efforts!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post