Customize API Portal topology in Docker

This section describes how to create Docker data volumes for persistence, edit your docker-compose.yml file to customize your Docker-based API Portal topology to suit your environment, and deploy API Portal using docker-compose up.

Create Docker data volumes for persistence

You must create Docker data volumes to persist API Portal customization data. Using data volumes can also prevent data loss when the container reboots or crashes, or when you are upgrading or setting up HA for an API Portal Docker deployment.

The data from the database container is automatically stored in a Docker volume when the database container is initialized. The data volume created for the database container by default is "unnamed", which means that the Docker engine assigns a random name for this data volume. To use this volume (for example, to add an additional database container or to upgrade the database container itself) you can inspect the current database container and identify the name and the destination of the data volume.

The data volumes are stored on the Docker host machine and as such consume disk space. You should delete unused data volumes regularly.

The following table describes which API Portal assets should be stored in a Docker volume to preserve the customizations during upgrade or HA setup of an API Portal Docker deployment.

Data type Storage location Example data volume name
System

The certificate from the API Manager

INSTALL_DIR/administrator/components/com_apiportal/assets/cert

apiportal-cert

The certificates used by API Portal

/etc/httpd/conf

apiportal-conf

API Portal's vhost file and other config files

/etc/httpd/conf.d

apiportal-confd

Customization

Joomla! templates

INSTALL_DIR/templates

apiportal-templates

Localization

Installed languages in front end UI

INSTALL_DIR/language

apiportal-language

Installed languages on Joomla! Administrator Interface (JAI)

INSTALL_DIR/administrator/language

apiportal-adm-language

Attachments uploaded to Joomla! content

Images

INSTALL_DIR/images

apiportal-images

Media

INSTALL_DIR/media

apiportal-media

Update docker-compose.yml for your environment

The Docker sample package includes a sample docker-compose.yml file. This file describes:

  • The services and containers to run
  • The properties to run those services and containers with
  • The correct sequence to start those services

The docker-compose.yml file enables you to run API Portal using a single docker-compose up command.

To run API Portal you need to have at least two services:

  • Database
  • API Portal

Database service example:

  db:
    image: mysql:5.6
    environment:
      - MYSQL_ROOT_PASSWORD=XXXXXX
    networks:
       - apiportal

API Portal service example:

  webapp:
    build: .
    depends_on:
      - db
    ports:
      - "443:443"
    networks:
      - apiportal
    environment:
      MYSQL_HOST: db
      MYSQL_ROOT_PASSWORD: XXXXXX
      MYSQL_PORT: 3306
      MYSQL_USERNAME: joomla
      MYSQL_PASSWORD: XXXXXXX
      MYSQL_DBNAME: joomla
      APIMANAGER_HOST: 10.134.56.181
      APIMANAGER_PORT: 8075
    volumes:
      - "apiportal-cert:/opt/axway/apiportal/htdoc/administrator/components/com_apiportal/assets/cert"
      - "apiportal-templates:/opt/axway/apiportal/htdoc/templates"
      - "apiportal-language:/opt/axway/apiportal/htdoc/language"
      - "apiportal-adm-language:/opt/axway/apiportal/htdoc/administrator/language"
      - "apiportal-images:/opt/axway/apiportal/htdoc/images"
      - "apiportal-media:/opt/axway/apiportal/htdoc/media"
      - "apiportal-conf:/etc/httpd/conf"
      - "apiportal-confd:/etc/httpd/conf.d"

Run API Portal using docker-compose up

After you have changed the docker-compose.yml file, perform the following to run API Portal:

  1. Ensure that you are logged in to your Docker host machine as the root user.
  2. Change to the directory where you unzipped the Docker sample package.
  3. Enter the following command to start API Portal in attached mode:
  4. $ docker-compose up

Wait for the following message to be displayed:

"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".

This message indicates that Apache has been started and you can start using API Portal.

API Portal is now running in a Docker container.

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

Related Links