Deploying KillBill / Kaui on OpenShift

by | Feb 20, 2020 | Payments, System Integration

Deploying KillBill / Kaui on OKD (OpenShift)

Introduction

OKD is the community distribution of Red Hat’s OpenShift, which allows for continuous application development and multi-tenant deployments.  It is embedded with Kubernetes container cluster management and Docker container packaging.

In this tutorial, we will guide you step-by-step on how to deploy 3 separate pods (the Kubernetes equivalence of a container) for KillBill, Kaui, and MariaDB on an OpenShift cluster.

Step 1: Install Docker

The recommended way of installing Docker and Docker Compose is via Docker’s repositories, for ease of installation and upgrade tasks.

Select the appropriate instructions for your preferred operating system.

Step 2: Install OpenShift Origin Client Tools

Select the appropriate release for your operating system: https://github.com/openshift/origin/releases.

Note, at the time of this post, we will be using the latest release (v3.11 — v4 is still in beta).

In a terminal, run the following:

$ wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
$ tar -xzvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
$ cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit
$ sudo cp oc /usr/local/bin

Configure the Docker daemon by adding the following to the /etc/docker/daemon.json file (create the file if it is not already there):

{
   "insecure-registries": [
     "172.30.0.0/16"
   ]
}

Afterwards, run:

$ sudo systemctl restart docker

Step 3: Start the OpenShift Cluster

Run the following to start the OpenShift Cluster:

$ sudo oc cluster up

The process takes several minutes.  When it is finished, you should see the following:

Navigate to the address listed to login to the OpenShift Console.  Once you log in, you’ll see the following.  Select the newly created project, My Project in the right-hand panel.

Step 4: Deploy KillBill, Kaui, and MariaDB on OpenShift

By default, OpenShift does not allow containers to run as root.  We can bypass this by issuing the following commands:

$ sudo oc login -u system:admin -n default
$ sudo oc adm policy add-scc-to-group anyuid system:authenticated

For more information, see: https://docs.openshift.com/container-platform/3.9/admin_guide/manage_scc.html#enable-images-to-run-with-user-in-the-dockerfile

Since KillBill offers official images hosted on DockerHub, deploying it to OpenShift is relatively simple.  After selecting My Project, click on the Deploy Image button.

Select the option for Image name, enter: killbill/mariadb:0.22 and select the magnifying glass.  For name, enter db.  Define the following environment variables.

Click Deploy.

At the top of the console, navigate to Add to Project > Deploy Image and repeat the steps for deploying an image for the killbill/killbill:0.22.2 container with the following environment variables::

Finally, repeat the steps for deploying an image for the killbill/kaui:2.0.1 with the following environment variables:

Step 5: Create a Route to Kaui

In order to expose the Kaui service, we can add a route.  Simply go to Applications > Routes and in the upper right-hand corner, click Create Route.  Give the route a name, and for the Service, select kaui and click create at the bottom of the screen.

If you naviate back to Applications > Routes, you should see the newly created route for Kaui created.  Select the generated Hostname, and you should now be able to access the Kaui UI!

Conclusion

By now, you have seen a brief showcase of a KillBill deployment on OpenShift.  Check out the next guide on integrating Kill Bill with Stripe for a monthly subscription model.

 

Related Articles