Chapter 5. Deploying APIcast on the Docker containerized environment
This is a step-by-step guide to deploy APIcast inside a Docker container engine that is ready to be used as a Red Hat 3scale API gateway.
When deploying APIcast on the Docker containerized environment, the supported versions of Red Hat Enterprise Linux (RHEL) and Docker are as follows:
- RHEL 7.7
- Docker 1.13.1
To deploy APIcast on the docker containerized environment, perform the steps outlined in the following sections:
5.1. Installing the Docker containerized environment
This guide covers the steps to set up the Docker containerized environment on RHEL 7.x.
The Docker container engine provided by Red Hat is released as part of the Extras channel in RHEL. To enable additional repositories, you can use either the Subscription Manager or the yum-config-manager option. For details, see the RHEL product documentation.
To deploy RHEL 7.x on an Amazon Web Services (AWS), Amazon Elastic Compute Cloud (Amazon EC2) instance, take the following steps:
List all repositories:
sudo yum repolist all.
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras.
Install the Docker containerized environment package:
sudo yum install docker.
For other operating systems, refer to the following Docker documentation:
5.2. Running the Docker containerized environment gateway
To run the docker containerized environment gateway, do the following:
Start the Docker daemon:
sudo systemctl start docker.service
Check if the Docker daemon is running:
sudo systemctl status docker.service
You can download a ready to use Docker container engine image from the Red Hat registry:
sudo docker pull registry.redhat.io/3scale-amp2/apicast-gateway-rhel8:3scale2.9
Run APIcast in a Docker container engine:
sudo docker run --name apicast --rm -p 8080:8080 -e THREESCALE_PORTAL_ENDPOINT=https://<access_token>@<domain>-admin.3scale.net registry.redhat.io/3scale-amp2/apicast-gateway-rhel8:3scale2.9
<access_token>is the Access Token for the 3scale Account Management API. You can use the Provider Key instead of the access token.
<domain>-admin.3scale.netis the URL of your 3scale Admin Portal.
This command runs a Docker container engine called "apicast" on port
8080 and fetches the JSON configuration file from your 3scale Admin Portal. For other configuration options, see Installing APIcast.
5.2.1. The docker command options
You can use the following options with the
docker run command:
--rm: Automatically removes the container when it exits.
--detach: Runs the container in the background and prints the container ID. When it is not specified, the container runs in the foreground mode and you can stop it using
CTRL + c. When started in the detached mode, you can reattach to the container with the
docker attachcommand, for example,
docker attach apicast.
--publish: Publishes a container’s port to the host. The value should have the format
<host port="">:<container port="">, so
-p 80:8080will bind port
8080of the container to port
80of the host machine. For example, the Management API uses port
8090, so you may want to publish this port by adding
-p 8090:8090to the
--env: Sets environment variables.
--volume: Mounts a volume. The value is typically represented as
<host path="">:<container path="">[:<options>].
<options>is an optional attribute; you can set it to
:roto specify that the volume will be read only (by default, it is mounted in read-write mode). Example:
5.2.2. Testing APIcast
The preceding steps ensure that your Docker container engine is running with your own configuration file and the Docker container image from the 3scale registry. You can test calls through APIcast on port
8080 and provide the correct authentication credentials, which you can get from your 3scale account.
Test calls will not only verify that APIcast is running correctly but also that authentication and reporting is being handled successfully.
Ensure that the host you use for the calls is the same as the one configured in the Public Base URL field on the Integration page.
- For more information on available options, see Docker run reference.
5.3. Additional resources
- For more information about tested and supported configuration, see Red Hat 3scale Supported Configurations