Layer7 API Management

 View Only
  • 1.  Container Gateway Walkthrough Available?

    Posted Feb 21, 2020 07:06 PM
    I have spent the entire day trying to determine how to stand up a Container Gateway v9.4 with Docker (for testing purposes) by going through the documentation but I cannot for the life of me figure out all the pieces and parts to make all the magic happen.

    I have a Linux 7 server that I am working from in order to make this happen.

    I have install Docker-CE although I am not 100% sure that is the correct docker platform that I should be using (i say this because i don't seem to have any type of docker-compose ability).
    I have docker pulled the caapim/gateway image but I do not know what to do with it at this point.

    I know quite a bit about the Gateway OVA Virtual Appliance form factor with an embedded MySQL database and replication but I am very new to containers.

    Is there a step by step process documented by anyone that could be used to help in my setup and evaluation of this Containerized version of the gateway?
    • Install docker on host machine 
      • specific yum or rpm commands would be helpful
    • install MySQL (or some other database) since there is no embedded DB with the container
      • again specific yum or rpm commands would be helpful
    • (as specific as possible) detailed configurations required prior to trying to run the container
      • there was something about a docker-compose.yml file and some high level details but nothing specific on what the values should equate too
    • docker run command or docker container run command to be used
      • I have tried various flavors of both of these commands but I either don't have the right options or the underlying .yml file above is what is getting in my way.

    I am honestly trying to just get a default gateway up and running where I can connect to it via the Policy Manager but it seems near impossible at this point to perform this simple task given the documentation at hand.

    Please avoid pointing me to the documentation as I have poured over it word by word all day and it just isn't making any sense or I haven't found the secret pages spelling out the step by step details.

    Thanks in advance.


  • 2.  RE: Container Gateway Walkthrough Available?
    Best Answer

    Posted Feb 22, 2020 04:44 AM
    Edited by Christopher Hackett Feb 24, 2020 02:44 PM
    Hi Rick
    I will assume that you have CentOS, nevertheless, any YUM-enabled distro would follow the same:

    What you can do is the following:
    1) install Docker:
    normally a 
    yum install docker
    should be enough, if not, here is an article with specific tasks
    https://phoenixnap.com/kb/how-to-install-docker-centos-7

    2) install docker-compose
    • sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    • sudo chmod +x /usr/local/bin/docker-compose
    3) download the attached docker-compose.yml file
    4) copy one of your Gateway license file in the same directory where you have downloaded the docker-compose.yml file and rename the license file to LICENSE.xml
    5) open a ternimal window (ssh there or local xterm) and go to the directory where the docker-compose.yml file is and issue the following command:
    sudo docker-compose up -d ssg1 mysql
    This will kick off both images and you will have a running mysql and a running gateway in no time (a couple of minutes ;) ).

    you can monitor the state of your machines via a
    sudo docker-compose ps
    which will tell you if they are running and what ports it listens to
    then you can use the Policy Manager to connect to localhost with user admin and password 7layer

    I do not suggest you install mysql on CentOS since you will be installing MariaDB instead: CentOS reroutes all requests for mysql to its opensource version: MariaDB, which is just as good but is not a version supported officially by the Gateway, so you might instead just go for a docker version of mysql.
    the version in the docker-compose will listen on 127.0.0.1:3310, not 3306 so that it does not clash with any preinstalled/prerunning mariadb that you might have running.
    ("Why 127.0.0.1 and not localhost?" you might ask, that is because mysql will ignore the port if you use localhost.)

    I hope it is helpful

    Attachment: (to be copy-pasted in a new file called docker-compose.yml)
    version: '2.0'
    services:
      # MySQL
      mysql:
        ports: 
          - "3310:3306"
        image: mysql:5.7
        mem_limit: 512m
        volumes:
           - ./mysqlconf:/etc/mysql/conf.d
           - ./mysqldatadir:/var/lib/mysql
           - ./mysql_data:/home/mysql_data
        environment:
          - MYSQL_ROOT_PASSWORD=7layer
        command:
          - "--character-set-server=utf8"
          - "--innodb_log_buffer_size=32M"
          - "--innodb_log_file_size=80M"
          - "--max_allowed_packet=8M"
    
      # Gateway Cluster (2 nodes)
      ssg1:
        image: caapim/gateway
        ports:
          - "8080:8080"
          - "8443:8443"
          - "9443:9443"
        volumes:
          - /opt/SecureSpan/Gateway/node/default/etc/bootstrap/services/restman
          - ./LICENSE.xml:/opt/SecureSpan/Gateway/node/default/etc/bootstrap/license/license.xml
    
        environment:
          ACCEPT_LICENSE: "true"
          SSG_ADMIN_USERNAME: "admin"
          SSG_ADMIN_PASSWORD: "7layer"
          SSG_DATABASE_JDBC_URL: "jdbc:mysql://mysql:3306/ssg"
          SSG_DATABASE_USER: "root"
          SSG_DATABASE_PASSWORD: "7layer"
          SSG_CLUSTER_HOST: "ssg9.docker.l7tech.com"
          SSG_CLUSTER_PASSWORD: "7layer"
    
    
      ssg2:
        image: caapim/gateway
        environment:
          ACCEPT_LICENSE: "true"
          SSG_DATABASE_JDBC_URL: "jdbc:mysql://mysql:3306/ssg"
          SSG_DATABASE_USER: "root"
          SSG_DATABASE_PASSWORD: "7layer"
          SSG_CLUSTER_HOST: "ssg9.docker.l7tech.com"
          SSG_CLUSTER_PASSWORD: "7layer"

    ------------------------------
    Maurizio Garzelli
    APIIDA
    APIIDA Principal Consultant
    https://apiida.com
    ------------------------------



  • 3.  RE: Container Gateway Walkthrough Available?

    Broadcom Employee
    Posted Feb 23, 2020 05:37 PM
    Assume that it's centos 7, it common reason of the failure on installing container gateway is due to the firewall, you may either open all the ports used by mysql container and  gateway container (your may need to specify the mapping ports in yml files, not using dynamic ports), or just disable the firewalld.

    Regards,
    Mark