Table of Contents
- Building the docker image
- Configuring the server
- Accessing turbine server on hystrix dashboard
- Monitoring applications in projects/namespaces other than current
- Using Attached Examples
Hystrix dashboard is used to monitor the circuit status when the circuit breaker is enabled in TIBCO BusinessWorks? Container Edition. To monitor multiple applications on the same Hystrix dashboard, a stream aggregator is required. The turbine server is a stream aggregator that collects the required data from all pods which has circuit-breaker enabled.
The server can be configured to run on both Kubernetes and Openshift platforms.
The project uses Netflix turbine-core 1.0.0 library. Custom code is written to fetch the pod details on K8S/Openshift platform and populate the endpoints in the turbine initializer.
The application runs as a container, periodically updating the pod endpoints. It listens at 8090/hystrix.stream endpoint of the pods. This endpoint is specific to TIBCO BusinessWorks Container Edition applications.
Extract the attached project and execute the following maven goal -
mvn clean package docker:build
This will create a docker image - tibco/turbine-server:1.0.0-SNAPSHOT
Deploy this turbine server to Kubernetes/Openshift platform.
Expose turbine-server deployment as a service -
Deploy Hystrix Dashboard [docker image - fabric8/hystrix-dashboard] to the same namespace.
Expose the dashboard service to be accessible externally (Type: NodePort or LoadBalancer)
Environment Variables -
PLATFORM = Openshit/Kubernetes (Default - Kubernetes)
NAMESPACE = k8s namespace to monitor (Default - Current Namespace)
Add following label to BWCE app deployments -
Ensure that the label is added at the pod level i.e. specs/template/metadata/label in a deployment yaml file
Open the Hystrix dashboard in the browser using the service url configured above.
On the dashboard, configure the following url to listen to the turbine stream -
[replace turbine-server with the appropriate service name]
On clicking the Monitor Stream button, the circuit breaker status for all the deployed TIBCO BusinessWorks Container Edition applications should be visible.
Permissions need to be provided to view services from other projects/namespaces.
Kubernetes (Tested on minikube) -Add clusterrolebinding
kubectl create clusterrolebinding [hystrix-namespace] --clusterrole cluster-admin --serviceaccount=[hystrix-namespace]:[user] Openshift - oc policy add-role-to-user view system:serviceaccount:[hystrix-namespace]:[user]
Examples are attached to quickly deploy and test the turbine server along with hystrix dashboard and BWCE applications on Kubernetes/Openshift.
Import the zip into the studio to check the code. This client code invokes turbine-demo-server and has circuit-breaker enabled in httpClientResource. It exposes GET /checkservice API which returns the client hostname and the server hostname. In case the server is not reachable, it returns an appropriate error message given by the circuit breaker.
Import the zip into the studio to check the code. The server code simply returns the hostname of the container at GET /server API. In order to open the circuit in the client, scale the pod count of the server to 0.
Build the docker images for both turbine-demo-client and turbine-demo-server using maven goal ? clean package initialize docker:build at the project's parent location.
Use the attached platform-specific yaml files to deploy the application.
This will deploy 2 applications ? client-app-1 and client-app-2. Ensure that the image field in yaml file is updated to reflect the above-created docker image for the client.
Expose the service externally using either NodePort/LoadBalancer/Ingress/Route as applicable.
This will deploy the turbine-demo-server application.
Deploys the turbine server and hystrix-dashboard along with the services. Expose hystrix-dashboard service to be accessible externally. Update the turbine-server docker image name in yaml file. (Use the image created in Building the docker image section)
# For Kubernetes ?
Creates turbine namespace and cluster role binding to add admin role to default user. This enables the turbine server to list the applications.
# For Openshift ?
Execute following commands ?
oc new-project turbine oc policy add-role-to-user view system:serviceaccount:turbine:default