Code Monkey home page Code Monkey logo

ibm / java-microprofile-on-kubernetes Goto Github PK

View Code? Open in Web Editor NEW
78.0 17.0 85.0 8.2 MB

This application demonstrates the deployment of a Java based microservices application using Microprofile on Kubernetes Cluster. MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes

Home Page: https://developer.ibm.com/code/patterns/deploy-microprofile-java-microservices-on-kubernetes

License: Apache License 2.0

Shell 100.00%
kubernetes-cluster java microservices microprofile containers ibm-developer-technology-cloud microservice-builder ibmcode kubernetes

java-microprofile-on-kubernetes's Introduction

Build Status

Deploy MicroProfile based Java microservices on Kubernetes.

This code demonstrates the deployment of a Java based microservices application using MicroProfile on Kubernetes.

MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes.

The sample application used 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 Open Liberty, in Docker containers managed by Kubernetes. It's based on a demo application from the MicroProfile platform team.

Flow

Included Components

Getting Started

Kubernetes

In order to follow this guide you'll need a Kubernetes cluster. If you do not have access to an existing Kubernetes cluster then follow the instructions (in the link) for one of the following:

Note: These instructions are tested on Kubernetes 1.10.5. Your mileage may vary if you use a version much lower or higher than this.

After installing (or setting up your access to) Kubernetes ensure that you can access it by running the following and confirming you get version responses for both the Client and the Server:

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T20:17:28Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5+IKS", GitCommit:"7593549b33fb8ab65a9a112387f2e0f464a1ae87", GitTreeState:"clean", BuildDate:"2018-07-19T06:26:20Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Steps

1. Clone Repository

First, clone our repository.

git clone https://github.com/IBM/Java-MicroProfile-on-Kubernetes
cd Java-MicroProfile-on-Kubernetes

2. Optional Step - Build Application

If you want to build the application yourself now would be a good time to do that. Please follow the rebuild steps if you'd like to re-create images with the latest available Open Liberty version. However for the sake of demonstration you can use the images that we've already built and uploaded to the journeycode docker repository.

3. Deploy Microservices

Now, deploy the microservices with the commands:

If using Minikube / ICP run:

$ cd scripts
$ ./set-ingress-minikube.sh
$ ./cloudant-secret.sh

If using IBM Cloud Kubernetes Service, run:

$ cd scripts
$ ./set-ingress-host [cluster name]
$ ./cloudant-secret.sh

Finally, deploy all microservices:

$ kubectl create -f manifests
persistentvolume "cloudant-pv" created
persistentvolumeclaim "cloudant-pv-claim" created
service "cloudant-service" created
deployment "cloudant-db" created
...
...

Note: this will deploy all of the kubernetes manifests in the manifests/ directory. Take some time to explore their contents to get an idea of the resources being used to deploy and expose the app.

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. If using Minikube, run 'kubectl proxy' and go to URL 'http://127.0.0.1:8001/ui' to check when the application containers are ready.

Kubernetes Status Page

After a few minutes you should be able to access the application. Part of our deployment is a Kubernetes Ingress resource. If your Kubernetes cluster already has an ingress service such as IBM Cloud Private then you should be able to access the application with no further changes.

However if you are using minikube, or a Kubernetes cluster that does not have an ingress service you have one more step before you can access your cluster. On minikube you can do the following:

$ minikube addons enable ingress
ingress was successfully enabled
$ minikube ip
192.168.99.100

With an Ingress controller enabled you can access the app via the IP provided by minikube above.

If running on IBM Cloud Kubernetes Service, you will use the hostname to access the application, which you can retrieve with the following:

$ kubectl get ing
NAME                   HOSTS                                          ADDRESS          PORTS     AGE
microprofile-ingress   microkube.us-east.containers.appdomain.cloud   ***.***.***.***   80, 443   1m

Now you can use the link http://[Public URL] to access your application in a browser.

Web application home page

Web-app Home Page

When you click on speaker name

Speaker Info

When you click on schedules link

Schedule Info

When you click on vote link

Vote Info

Troubleshooting

  • If your microservice instance is not running properly, you may check the logs using
    • kubectl logs <your-pod-name>
  • To delete a microservice
    • kubectl delete -f manifests/<microservice-yaml-file>
  • To delete all microservices
    • kubectl delete -f manifests

References

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

java-microprofile-on-kubernetes's People

Contributors

animeshsingh avatar anthonyamanse avatar dolph avatar hisunah avatar imgbotapp avatar ishangulhane avatar jzaccone avatar ljbennett62 avatar loafyloaf avatar paulczar avatar sanjeevghimire avatar tomcli avatar wwalisa avatar ykoyfman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-microprofile-on-kubernetes's Issues

Web app has these errors

Hello, Is it the right version of the web app deployed. I see these errors regarding missing files on the web app container
[WARNING ] SRVE0190E: File not found: /assets/css/node_modules/primeng/resources/themes/afternoon/theme.css
[WARNING ] SRVE0190E: File not found: /speaker
[WARNING ] SRVE0190E: File not found: /speaker
[WARNING ] SRVE0190E: File not found: /sessions
[WARNING ] SRVE0190E: File not found: /vote/rate
[WARNING ] SRVE0190E: File not found: /sessions
[WARNING ] SRVE0190E: File not found: /schedule/all

Dockerfile not found at: Dockerfile

Preparing to start the job...
Pipeline image: latest
Preparing the build artifacts...
Pulling pipeline base image latest ...
DOCKER_ROOT=.
DOCKER_FILE=Dockerfile
build.properties:
GIT_URL=https://github.com/dineshtng/IBMJAVAAPP-AUG.git
GIT_BRANCH=master
GIT_COMMIT=a14547691542cfa5fffdc250e8e38db9cef9aa63
SOURCE_BUILD_NUMBER=1

Checking for Dockerfile at the repository root
Dockerfile not found at: Dockerfile

Finished: FAILED

Create scripts or labels for easy deletion.

When deleting all the services and deployment, it's a little painful to do kubectl delete -f for every files. So it could be better to create labels so user can delete it with kubectl delete svc,deployments,rc -l app=labels

sample.microservicebuilder.helm.elk/charts

Hi, I am working on the java microservices on kubernetes using Minikube. I am following the blow link
https://github.com/IBM/Java-MicroProfile-on-Kubernetes
I am able to install the fabric and it's successfully getting deployed. But for Sample-elk this link is not active
helm repo add mb-sample https://wasdev.github.io/sample.microservicebuilder.helm.elk/charts
when I am giving below command
helm install --name sample-elk mb-sample/sample-elk

I am not able to deploy the addon. Its always throwing that mb keystore doesn't found.
Please help me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.