This project demonstrates the deployment of a Java based microservices application using MicroProfile and Microservice Builder on IBM Bluemix Container Service Kubernetes Cluster.
MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes. Microservice Builder builds on top of MicroProfile.io, and provides extension for containerized apps created using the tool to be deployed to Kubernetes.
The Microservice Builder sample application is a web application for managing a conference and is based on a number of discrete microservices. The front end is written in Angular; the backing microservices are in Java. All run on WebSphere Liberty, in Docker containers managed by Kubernetes.
With IBM Bluemix Container Service, you can deploy and manage your own Kubernetes cluster in the cloud that lets you automate the deployment, operation, scaling, and monitoring of containerized apps over a cluster of independent compute hosts called worker nodes.
- Bluemix Container Service
- Kubernetes Cluster
- MicroProfile
- Microservice Builder
- Bluemix DevOps Toolchain Service
-
Create a Kubernetes cluster with IBM Bluemix Container Service. If you have not setup the Kubernetes cluster, please follow the Creating a Kubernetes cluster tutorial.
-
Install a Git client to obtain the sample code.
-
Install Maven and a Java 8 JDK.
-
Install a Docker engine.
If you want to deploy the wordpress directly to Bluemix, click on 'Deploy to Bluemix' button below to create a Bluemix DevOps service toolchain and pipeline for deploying the Java microservices using MicroProfile sample, else jump to Steps
Please follow the Toolchain instructions to complete your toolchain and pipeline.
- Install Docker CLI and Bluemix Container registry Plugin
- Get and build the application code
- Build application containers
- Create Services and Deployments
First, install Docker CLI.
Then, install the Bluemix container registry plugin.
bx plugin install container-registry -r bluemixOnce the plugin is installed you can log into the Bluemix Container Registry.
bx cr loginIf this is the first time using the Bluemix Container Registry you must set a namespace which identifies your private Bluemix images registry. It can be between 4 and 30 characters.
bx cr namespace-add <namespace>Verify that it works.
bx cr images- Install the Microservice Builder fabric - these are various services that run on top of Kubernetes.
Note: For the following steps, you can get the code and build the package by running the get_code.sh script present in scripts directory.
-
git clonethe following projects:git clone https://github.com/WASdev/sample.microservicebuilder.web-app.git
git clone https://github.com/WASdev/sample.microservicebuilder.schedule.git
git clone https://github.com/WASdev/sample.microservicebuilder.speaker.git
git clone https://github.com/WASdev/sample.microservicebuilder.session.git
git clone https://github.com/WASdev/sample.microservicebuilder.vote.git cd sample.microservicebuilder.vote/ git checkout 4bd11a9bcdc7f445d7596141a034104938e08b22 -
mvn clean packagein each ../sample.microservicebuilder.* projects
Use the following commands to build the microservers containers.
Build the web-app microservice container
cd sample.microservicebuilder.web-app docker build -t registry.ng.bluemix.net/<namespace>/microservice-webapp . docker push registry.ng.bluemix.net/<namespace>/microservice-webappBuild the vote microservice container
cd sample.microservicebuilder.vote docker build -t registry.ng.bluemix.net/<namespace>/microservice-vote . docker push registry.ng.bluemix.net/<namespace>/microservice-voteBuild the schedule microservice container
cd sample.microservicebuilder.schedule docker build -t registry.ng.bluemix.net/<namespace>/microservice-schedule . docker push registry.ng.bluemix.net/<namespace>/microservice-scheduleBuild the speaker microservice container
cd sample.microservicebuilder.speaker docker build -t registry.ng.bluemix.net/<namespace>/microservice-speaker . docker push registry.ng.bluemix.net/<namespace>/microservice-speakerBuild the session microservice container
cd sample.microservicebuilder.session docker build -t registry.ng.bluemix.net/<namespace>/microservice-session . docker push registry.ng.bluemix.net/<namespace>/microservice-sessionBuild the nginx controller
cd nginx docker build -t registry.ng.bluemix.net/<namespace>/nginx-server . docker push registry.ng.bluemix.net/<namespace>/nginx-serverChange the image name given in the respective deployment YAML files for all the projects in the manifests directory with the newly build image names.
Get the public ip of the node
$ kubectl get nodes NAME STATUS AGE 169.47.241.106 Ready 23hSet the value of SOURCE_IP env variable present in deploy-nginx.yaml file present in manifests folder with the public ip of the node.
Deploy the microservice from the manifests directory with the command kubectl create -f <filename>.
After you have created all the services and deployments, wait for 10 to 15 minutes. You can check the status of your deployment on Kubernetes UI. Run 'kubectl proxy' and go to URL 'http://127.0.0.1:8001/ui' to check when the application containers are ready.
After few minutes the following commands to get your public IP and NodePort number.
$ kubectl get nodes NAME STATUS AGE 169.47.241.106 Ready 23h $ kubectl get svc nginx-svc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-svc 10.10.10.167 <nodes> 80:30056/TCP 11sNow you can use the link http://[IP]:30056 to access your application on browser.
Web application home page
When you click on speaker name
When you click on schedules link
When you click on vote link






