Skip to content

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

Sonali Dasgupta edited this page Jul 2, 2019 · 9 revisions

Starting from version 2.0.0 of the BW6 Maven Plugin , the Fabric8 Maven Plugin used for the maven build process for Docker and Kubernetes/Openhsift has been upgraded from version 2.2.102 to version 3.5.41. Docker Maven Plugin used with Fabric8 has been upgraded from version 0.14.2 to version 0.26.1. The upgraded versions of these plugins allows users to write partial Kubernetes or Openshift YAML files so deployments/services/HPA could be predefined.

POM GENERATION

The following screen will appear if Docker is selected as deployment option during POM Generation.

Docker Deployment

On selecting the further option for Kubernetes platform, the following screen appears :

Kubernetes Deployment

Configure the options as required for your project.

PROPERTIES FILES

  • Docker - docker-dev.properties and docker-prod.properties and variable name as docker.property.file

  • K8S - k8s-dev.properties and k8s-prod.properties and 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 (eg. docker-qa.properties, k8s-qa.properties etc.). By default, both dev and prod properties are same, and contains values which you have specified from studio pop-up, so you can manually edit these values in properties file for your environment (prod / dev).

STEPS FOR THE MAVEN BUILD PROCESS FOR DOCKER AND KUBERNETES

For versions 1.x.x of BW6 maven plugin

  • clean package initialize docker:build (During docker build, tag the images in the form gcr.io/project-name/image-name for Kubernetes).

  • initialize docker:start

  • initialize docker:push

Before push make sure you generate token and authorize your docker host for GCP repo. Follow the steps described below for authorization and docker login.

  • initialize fabric8:json

  • initialize fabric8:apply

For versions 2.x.x (2.0.0 and later)

During the POM Generation phase: Provide the deployment/service/HPA YAML files, select checkbox 'Provide the YML Resources', and provide the location in your machine where the files are stored.

  • clean package initialize docker:build (During docker build, tag the images in the form gcr.io/project-name/image-name for Kubernetes 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).

  • initialize docker:start

  • initialize docker:push

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

Before push make sure 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 in the section 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 above commands 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) -p $(oc whoami -t) REGISTRY-SERVICE-IP:5000

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

REFERENCES FOR FABRIC8 AND DOCKER MAVEN PLUGIN

Clone this wiki locally