Layer7 API Management

  • 1.  Docker container - Lifecycle error: No license loaded

    Posted Nov 19, 2018 10:29 AM

    I have one server configured as my CA Gateway (all working) and I want to setup other server with Docker to balance load. On that server I have license.xml file in this path: 

     

    /home/rsdbuser/mylicence.xml

     

    I read documentation and exported base64 string into my environment variables with this command:

     

    export SSG_LICENSE="$(cat /home/rsdbuser/mylicence.xml | gzip | base64)" 

     

    installed Docker, pulled image and this is my docker-compose.yml file:

     

    version: '2.2'
    services:
    api-gateway:
    image: caapim/gateway
    # cpus: 4
    # mem_limit: 6g
    # memswap_limit: 6g
    # mem_swappiness: 0
    ports:
    - "8080"
    - "8443"
    - "9443"
    # volumes:
    # - /opt/SecureSpan/Gateway/node/default/etc/bootstrap/services/restman
    environment:
    ACCEPT_LICENSE: "false"
    # SSG_ADMIN_USERNAME: "adminUser"
    # SSG_ADMIN_PASSWORD: "somepassword"
    # SSG_DATABASE_JDBC_URL: "jdbc:mysql://mysql-server:3306/ssg"
    # SSG_DATABASE_USER: "ssgdbuser"
    # SSG_DATABASE_PASSWORD: "dbpassword"
    # SSG_CLUSTER_HOST: "mycompany.host.com"
    # SSG_CLUSTER_PASSWORD: "clusterpassword"
    # SSG_JVM_HEAP: "4g"
    # EXTRA_JAVA_ARGS: "-XX:ParallelGCThreads=4 -Dcom.l7tech.bootstrap.autoTrustSslKey=trustAnchor,TrustedFor.SSL,TrustedFor.SAML_ISSUER"
    #
    # mysql-server:
    # image: mysql:5.7
    # mem_limit: 512m
    # environment:
    # - MYSQL_RANDOM_ROOT_PASSWORD=true
    # - MYSQL_USER=ssgdbuser
    # - MYSQL_PASSWORD=dbpassword
    # - MYSQL_DATABASE=ssg
    # command:
    # - "--character-set-server=utf8"
    # - "--innodb_log_buffer_size=32M"
    # - "--innodb_log_file_size=80M"
    # - "--max_allowed_packet=8M"

     

    but when I run docker-compose with: 

     

    docker-compose up:

     

    I get this error:

     

     

    When i display my env. variables I can clearly see that licence is loaded and in base64 format. I used separate licence for first and second node, but I still don't get why I am getting this error. Any help will be appreciated!

     

    Thanks in advance!



  • 2.  Re: Docker container - Lifecycle error: No license loaded
    Best Answer

    Broadcom Employee
    Posted Nov 19, 2018 05:13 PM

    Dear mensur.durakovic ,

    It depends what version of docker gateway you're trying to deploy.

    From the yml file I cannot see what version,  I assume it's docker gateway 9.3, then, if you want to use env license,

    1. ACCEPT_LICENSE is true

    2. need an empty SSG_LICENSE environment

    3. need -Dcom.l7tech.bootstrap.env.license.enable=true in EXTRA_JAVA_ARGS environment

    4. before deploy, need to export the SSG_LICENSE (which you have done)

     

    Here is an example of yml file,

    # cat gw93dockerfile.yml
    ssg:
      image: mark/gateway:mydoc1
      mem_limit: 8192m
      ports:
        - "8080:8080"
        - "8443:8443"
        - "9443:9443"
        - "2124:2124"
      environment:
        ACCEPT_LICENSE: "true"
        SSG_ADMIN_USERNAME: "admin"
        SSG_ADMIN_PASSWORD: "7layer"
        SSG_DATABASE_JDBC_URL: "jdbc:mysql://<my docker host>:3306/ssg"
        SSG_DATABASE_USER: "root"
        SSG_DATABASE_PASSWORD: "7layer"
        SSG_CLUSTER_HOST: "<my docker host>"
        SSG_CLUSTER_PASSWORD: "7layer"
        SSG_JVM_HEAP: "6g"
        SSG_LICENSE:
        EXTRA_JAVA_ARGS: "-XX:ParallelGCThreads=4 -Dcom.l7tech.bootstrap.env.license.enable=true -Dcom.l7tech.bootstrap.autoTrustSslKey=trustAnchor,TrustedFor.SSL,TrustedFor.SAML_ISSUER"

     

    Regards,

    Mark



  • 3.  Re: Docker container - Lifecycle error: No license loaded

    Posted Nov 20, 2018 03:29 AM

    I tried your suggestions but I get this errors, do you know why I am getting this strange error messages because these config options should be ok?

     

    And yes, my gateway version is 9.3



  • 4.  Re: Docker container - Lifecycle error: No license loaded

    Broadcom Employee
    Posted Nov 20, 2018 04:46 PM

    I believe your docker-compose version is too old to support "environment" options, upgrade your docker-compose first.

     

    Also, please ensure the mysql is up and running, and ensure the current user has enough privilege to run docker.



  • 5.  Re: Docker container - Lifecycle error: No license loaded

    Posted Nov 21, 2018 08:06 AM

    Zhijun He, thank you! I added user privileges for "gateway" user on host MySQL, and run yml file through linter, formatted it a bit, and it connected:

    Now I wanna know how can I connect to container via PuTTY ? If I am correct, container IP address is 172.19.0.3 running on port 8777. Also when I run:

     

     docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name

     

    I get same IP address. However I can not connect to my container via PuTTY, what I need to do to connect to it? Is there any special pre-actions needed to execute to enable ssh on container ? I want to ssh into it to configure it so that first server and this docker container work together and balance load. Is there any documentation for this specific use-case ?



  • 6.  Re: Docker container - Lifecycle error: No license loaded

    Broadcom Employee
    Posted Nov 21, 2018 05:38 PM

    Well, in theory, you can install sshd on the container and expose ssh port (another port different with the ssh port on docker host) in yml file, and then you can ssh to <docker host>:<ssh port of gateway container>, but usually we only need to ssh to the docker host, and run command below to access container console,

    docker exec -it <container name/id> /bin/bash

     

    You don't need to ssh to container to configure docker gateway, all configurations are in yml file.  (some advance configurations can be done via dockerfile: Customize the Container Gateway - CA API Gateway - 9.4 - CA Technologies Documentation )

     

    The document of container gateway,

    Getting Started with the Container Gateway - CA API Gateway - 9.4 - CA Technologies Documentation 

    For more details of docker platform, you may refer to the docker docs,

    Docker Documentation | Docker Documentation 



  • 7.  Re: Docker container - Lifecycle error: No license loaded

    Posted Nov 22, 2018 07:58 PM

    The conversation seems to have progressed far beyond the original question asked at this point. As such, I will be marking the first answer as the answer, but if you feel it should be a different response, please go ahead and modify it. The rest of the communication can continue but should ideally be on a new question at this point as it no longer relates to the original one.



  • 8.  Re: Docker container - Lifecycle error: No license loaded

    Posted Nov 23, 2018 05:53 AM

    Thank you very much for your help!