Layer7 API Management

  • 1.  Passing Gateway License as an environment variable to the Docker Gateway

    Posted May 04, 2018 04:21 AM

    Greetings Community,

     

    So I am in the process of setting up my first instance of a docker gateway, I have everything installed and ready including the docker-compose.yml file. 

     

    I am changing to the directory containing the compose file and running: 

     

    docker-compose up 

     

    The problem I am having is passing in the license to the gateway. I get the following error: 

     

    INFO: Installing license from SSG_LICENSE environment variable

    api-gateway_1   | May 04, 2018 8:00:44 AM com.l7tech.server.boot.GatewayMain main

    api-gateway_1   | WARNING: Error starting server : Lifecycle error: Fail to install license: Not in GZIP format

    api-gateway_1   | com.l7tech.server.LifecycleException: Lifecycle error: Fail to install license: Not in GZIP format

    api-gateway_1   | at com.l7tech.server.BootProcess.start(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.f(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.start(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.runUntilShutdown(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayMain.main(Unknown Source)

    api-gateway_1   | Caused by: java.lang.IllegalStateException: Fail to install license: Not in GZIP format

    api-gateway_1   | at com.l7tech.server.licensing.BootstrapLicenseService.a(Unknown Source)

    api-gateway_1   | at com.l7tech.server.licensing.BootstrapLicenseService.onApplicationEvent(Unknown Source)

    api-gateway_1   | at com.l7tech.server.util.r.onApplicationEvent(Unknown Source)

    api-gateway_1   | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

    api-gateway_1   | at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)

    api-gateway_1   | at com.l7tech.server.BootProcess.a(Unknown Source)

    api-gateway_1   | ... 5 more

    api-gateway_1   | Caused by: java.util.zip.ZipException: Not in GZIP format

    api-gateway_1   | at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165)

    api-gateway_1   | at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)

    api-gateway_1   | at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)

    api-gateway_1   | ... 11 more

    api-gateway_1   |

    api-gateway_1   | com.l7tech.server.LifecycleException: Lifecycle error: Fail to install license: Not in GZIP format

    api-gateway_1   | at com.l7tech.server.BootProcess.start(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.f(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.start(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayBoot.runUntilShutdown(Unknown Source)

    api-gateway_1   | at com.l7tech.server.boot.GatewayMain.main(Unknown Source)

    api-gateway_1   | Caused by: java.lang.IllegalStateException: Fail to install license: Not in GZIP format

    api-gateway_1   | at com.l7tech.server.licensing.BootstrapLicenseService.a(Unknown Source)

    api-gateway_1   | at com.l7tech.server.licensing.BootstrapLicenseService.onApplicationEvent(Unknown Source)

    api-gateway_1   | at com.l7tech.server.util.r.onApplicationEvent(Unknown Source)

    api-gateway_1   | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

    api-gateway_1   | at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)

    api-gateway_1   | at com.l7tech.server.BootProcess.a(Unknown Source)

    api-gateway_1   | ... 5 more

    api-gateway_1   | Caused by: java.util.zip.ZipException: Not in GZIP format

    api-gateway_1   | at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165)

    api-gateway_1   | at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)

    api-gateway_1   | at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)

    api-gateway_1   | ... 11 more

    api-gateway_1   |

    api-gateway_1   |

    api-gateway_1   |

    api-gateway_1   | **** Unable to start the server: Error starting server : Lifecycle error: Fail to install license: Not in GZIP format

     

    So the steps I have tried to fix this issue are: 

    • Specify the absolute path to the xml.gz license in the docker-compose.yml as SSG_LICENSE under the environment branch. 
    • Specify a base64 encoded string representation of the xml file as SSG_LICENSE under the environment branch. 
    • Used
      export SSG_LICENSE=/absolute/path/to/license
      in the bash terminal. 

     

    Here is my docker-compose.yml file: 

     

    version: '2'
    services:
       api-gateway:
          image: caapim/gateway
          #cpus: 0.5
          mem_limit: 2g
          memswap_limit: 2g
          mem_swappiness: 0
          ports:
             - "8080"
             - "8443"
             - "9443"
          volumes:

             - /opt/SecureSpan/Gateway/node/default/etc/bootstrap/services/restman
          environment:
             ACCEPT_LICENSE: "true"
             SSG_ADMIN_USERNAME: "admin"
             SSG_ADMIN_PASSWORD: "7LayerS"
             SSG_DATABASE_JDBC_URL: "jdbc:mysql://mysql-server:3306/ssg"
             SSG_DATABASE_USER: "admin"
             SSG_DATABASE_PASSWORD: "7LayerS"
             SSG_CLUSTER_HOST: "130.119.133.107"
             SSG_CLUSTER_PASSWORD: "7LayerS"
             SSG_JVM_HEAP: "4g"
             EXTRA_JAVA_ARGS: "-XX:ParallelGCThreads=4 -                Dcom.l7tech.bootstrap.autoTrustSslKey=trustAnchor,TrustedFor.SSL,TrustedFor.SAML_ISSUER                          Dcom.l7tech.bootstrap.env.license.enable=true"
             SSG_LICENSE:    /path/to/file/license_file.xml.gz

     mysql-server:
        image: mysql:5.7
        mem_limit: 512m
        environment:
           - MYSQL_RANDOM_ROOT_PASSWORD=true
           - MYSQL_USER=admin
           - MYSQL_PASSWORD=7LayerS
           - MYSQL_DATABASE=ssg
        command:
           - "--character-set-server=utf8"
           - "--innodb_log_buffer_size=32M"
           - "--innodb_log_file_size=80M"
           - "--max_allowed_packet=8M"

     

    In the docs it specifies that it must be a base64 encoded gzip file, does that mean I have to convert the file to base64 from the gzipped file? 

     

    Any help would be appreciated. 



  • 2.  Re: Passing Gateway License as an environment variable to the Docker Gateway
    Best Answer

    Posted May 04, 2018 04:41 AM

    UPDATE

     

    So I managed to fix it by using the following in the terminal: 

     

    export SSG_LICENSE="$(cat /path/to/license.xml | gzip | base64)" 



  • 3.  Re: Passing Gateway License as an environment variable to the Docker Gateway

    Posted Jun 12, 2018 08:03 AM

    Hi,

    I have the exact same problem. However, your solution did not work for me. Could you please elaborate on the steps you took to fix this?

     

    Thanks.