Table of Contents
- Introduction
- Building the docker image
- Deployment
- Configuring the server
- Accessing turbine server on hystrix dashboard
- Monitoring applications in projects/namespaces other than current
- Using Attached Examples
Introduction
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.
Building the docker image
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
Deployment
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)
Configuring the server
-
Environment Variables -
PLATFORM = Openshit/Kubernetes (Default - Kubernetes)
NAMESPACE = k8s namespace to monitor (Default - Current Namespace)
-
Enable Collection
Add following label to BWCE app deployments -
hystrix.enabled=true
Ensure that the label is added at the pod level i.e. specs/template/metadata/label in a deployment yaml file
Accessing turbine server on hystrix dashboard
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 -
http://turbine-server/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.
Monitoring applications in projects/namespaces other than current
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]
Using Attached Examples
Examples are attached to quickly deploy and test the turbine server along with hystrix dashboard and BWCE applications on Kubernetes/Openshift.
- turbine-demo-client
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.
- turbine-demo-server
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.
turbine-demo-client.yaml ?
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.
turbine-demo-server.yaml ?
This will deploy the turbine-demo-server application.
turbine-hystrix-dashboard.yml ?
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 ?
namespace-clusterrolebinding.yaml ?
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
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now