Building applications for TIBCO BusinessWorks Container Edition in Docker and Kubernetes or Openshift

Starting from version 2.0.0 of the TIBCO ActiveMatrix BusinessWorks Plug-in for Maven, the Fabric8 Maven Plug-in used for the maven build process for Docker and Kubernetes or Openhsift is upgraded from version 2.2.102 to version 3.5.41. The Docker Maven Plug-in used with Fabric8 is upgraded from version 0.14.2 to version 0.26.1. The upgraded versions of these plug-ins allow you to write partial Kubernetes or Openshift yaml files so deployments or services or HPA are predefined.

Before you begin If the Docker platform is selected as deployment option while generating the POM file, the following window is displayed.

If the Kubernetes platform is selected as deployment option while generating the POM file, the following window is displayed:

 

Configure the options as required for your project.

For Docker: The docker-dev.properties and docker-prod.properties file and the variable name as docker.property.file
For Kubernetes: The k8s-dev.properties and k8s-prod.properties file and the variable name as k8s.property.file
For more environments, you can manually create copies of one of these properties file and rename it to your environment. For example, docker-qa.properties, k8s-qa.properties, and so on. By default, both dev and prod properties are same, and contains values which are specified from TIBCO Business Studio for BusinessWorks pop-up, so you can manually edit these values in properties file for your environment (prod or dev).

 

Follow the steps below to mavenize the build process for Docker and Kubernetes:

    Procedure
  1. While generating the POM file, provide the deployment or service or HPA YAML files, select the Provide the YML Resources checkbox and provide the location of the stored files of your local machine.
  2. Provide the maven goal clean package initialize docker:build.
    During docker build, tag the images for kubernetes as gcr.io/project-name/image-name and REGISTRY-SERVICE-IP:5000/project-name/image-name for Openshift. Also, for Openshift, remove the backward slashes in the bwdocker.host property in docker properties file, for the IP address to be correctly parsed.
  3. Provide maven goal initialize docker:start
  4. Provide maven goal initialize docker:push

For Openshift, execute the docker push REGISTRY-SERVICE-IP:5000/project-name/image-name command from command line at the location of the maven application project.

Before push, ensure you generate token and authorize your docker host for GCP repo for Kubernetes or a corresponding repository for your Openshift environment.

Follow the steps described below for DOCKER AUTHORIZATION BEFORE TRYING DOCKER:PUSH for authorization and docker login.

com.tibco.plugins:bw6-maven-plugin:bwfabric8json
initialize fabric8:resource
initialize fabric8:apply

The commands above can be chained together to execute all the goals in a single step, in the following manner :
clean package initialize docker:build docker:push com.tibco.plugins:bw6-maven-plugin:bwfabric8json fabric8:resource fabric8:apply

 

DOCKER AUTHORIZATION BEFORE TRYING DOCKER:PUSH

For Kubernetes

--- Windows --- gcloud auth print-access-token docker login -u _token -p "your token" https://gcr.io

--- Linux/OSX ---- docker login -u _token -p "$(gcloud auth print-access-token)" https://gcr.io

For Openshift

--- Windows --- docker login -u (oc whoami -t) REGISTRY-SERVICE-IP:5000

--- Linux/OSX ---- docker login -u oc whoami -p oc whoami -t REGISTRY-SERVICE-IP:5000