Chapter 4. APIcast on the Docker containerized environment
This is a step-by-step guide to deploy APIcast inside a Docker-formatted container that is ready to be used as a 3scale API gateway.
You must configure APIcast in your 3scale Admin Portal as per the the Installing APIcast guide.
4.2. Installing the Docker containerized environment
This guide covers the steps to set up the Docker containerized environment on Red Hat Enterprise Linux (RHEL) 7.
Docker-formatted containers provided by Red Hat are 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. For details, see the RHEL product documentation.
To deploy RHEL 7 on an AWS 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:
4.3. Running the Docker containerized environment gateway
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-formatted container image from the Red Hat registry:
sudo docker pull registry.redhat.io/3scale-amp2/apicast-gateway-rhel7:3scale2.8
Run APIcast in a Docker-formatted container:
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-rhel7:3scale2.8
<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-formatted container called "apicast" on port
8080 and fetches the JSON configuration file from your 3scale portal. For other configuration options, see the Installing APIcast guide.
4.3.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:
For more information on available options, see Docker run reference.
4.4. Testing APIcast
The preceding steps ensure that your Docker-formatted container is running with your own configuration file and the Docker-formatted 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.