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.
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.propertie s 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). |
To mavenize the build process for Docker and Kubernetes, perform the following steps:
- Procedure
- When 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.
- Provide the maven goal
clean package
initialize docker:build
.
During docker build, tag the images for kubernetes asgcr.io/project-name/image-name
andREGISTRY-SERVICE-IP:5000/project-name/image-name
for Openshift. Also, for Openshift, remove the backward slashes in thebwdocker.host
property in docker properties file, for the IP address to be correctly parsed. - Provide Maven goal
initialize docker:start
. - 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
Using OpenJDK for deploying applications using Maven in a Docker container
- Procedure
- In the user home directory, create the
customJavaPath.properties
file and give the OpenJDK path as a value for thecustomJAVAPath
property. For example,customJavaPath=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
. - Create the bwce base docker image using the docker file:
FROM eclipse-temurin:11-alpine
LABEL maintainer="TIBCO Software Inc."
ADD . /
RUN chmod 755 /scripts/*.sh && apk update && apk add unzip openssh net-tools && apk add --no-cache bash
ENTRYPOINT ["/scripts/start.sh"]Note: To use OpenJDK11 and remove TIBCO JRE from eclipse-temurin:11-jre-alpine based container image, navigate to https://github.com/TIBCOSoftware/bwce-docker/tree/openjdk-alpine and clone the 'eclipse-alpine' repository to your local machine. For more information to create the base Docker image for Linux container, see "Creating the TIBCO BusinessWorks Container Edition Base Docker Image for Linux Containers" in the TIBCO BusinessWorks Container Edition Application Developement. - Create an application image using the above bwce base docker image.
- Deploy the application on Docker.