Deploy API Portal to a Docker container

This topic describes how to generate the MySQL and API Portal Docker images using the Docker files in the samples package, and run the Docker containers.

Prerequisites

The following components are required on your system before deploying API Portal to Docker containers:

  • Docker version 1.13.x
  • APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<build number>.zip package
  • API Gateway and API Manager either installed on-premise or deployed in containers, see the API Gateway Installation Guide for more details.

The following are the recommended hardware disk space and memory for a single node sample architecture:

  • 100 GB or more disk space
  • 8 GB or more RAM

Upload the Docker package

  1. Download APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<build number>.zip from Axway Support at https://support.axway.com.
  2. Upload the package to your Docker host machine.
  3. Unzip the package.

You get the following files:

  • APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<n>/apiportal/apiportal_install.sh: This is the entry point file for the API Portal container.
  • APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<n>/apiportal/Dockerfile: This file is used to build the API Portal image.
  • APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<n>/apiportal/apiportal-rhel7-install-package-7.5.3-BN<n>.tgz: This package contains the source API Portal RPMs.
  • APIPortal_7.5.4_SamplesPackageDocker_linux-x86-64_BN<n>/mysql/Dockerfile: This file is used to build the MySQL image.

Build the MySQL image and container

To generate a MySQL Docker image, do the following:

  1. Ensure you are logged in as the root user to your Docker host machine.
  2. Change to the mysql directory within the unzipped sample package, and enter the following command to build the MySQL image:
  3. $ docker build -t <imagename>:<version> .

    For example:

    $ docker build -t mysql:1 .
  4. Enter the following command to run the MySQL Docker container:
  5. $ docker run -d --name <container name> -e MYSQL_ROOT_PASSWORD=<your root password> -p <host machine port>:<MySQL port> <imagename>:<version>

    For example:

    $ docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=Admin123 -p 3306:3306 mysql:1
  6. Enter the following command to check that your MySQL container was created successfully:
  7. $ docker ps -a | grep <your MySQL container name>

Build the API Portal image and container

  1. Change to the apiportal directory within the unzipped sample package, and enter the following command to build the API Portal image:
  2. $ docker build -t <imagename>:<version> .

    For example:

    $ docker build -t apiportal:1 .
  3. Enter the following to check the IP of the MySQL container you built earlier:
  4. $ docker inspect <your MySQL container name>
  5. Enter the following command to run the API Portal Docker container:
  6. $ docker run -it --name <container name> -e container=docker -e answer=y -e mysqlSSLModeAnswer=n -e mysqlHost=<IP of your MySQL container> -e mysqlPort=<MySQL port> -e mysqlUsername=root -e mysqlPassword=<root password> -e mysqlDbName=<MySQL database name> -p <host machineport>:<API Portal port> <imagename>:<version>

    This installs the API Portal and any dependencies. Replace the placeholder for container name with the name to use for your API Portal container. For example:

    $ docker run -it --name apiportal -e container=docker -e answer=y -e mysqlSSLModeAnswer=n -e mysqlHost=127.0.0.1 -e mysqlPort=3306 -e mysqlUsername=root -e mysqlPassword=Admin123 -e mysqlDbName=joomla -p 443:443 apiportal:1

You can ignore the following message:

"AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using <IP address>. Set the 'ServerName' directive globally to suppress this message"

API Portal is now running in Docker container. To go to the landing page, enter the host address and the host port to your browser.

Note   You must access API Portal with the HOST_MACHINE_ADDRESS and the HOST_MACHINE_EXPOSED_PORT (not the container address and port). For example, https://<HOST_MACHINE_ADDRESS>:<HOST_MACHINE_EXPOSED_PORT>.

Before you can use API Portal, you must link it to your API Manager. For more details, see Link API Portal to API Manager.

In addition, you might want to configure some additional settings. See Configure API Portal.

Related Links