Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploying MicroProfile-Based Apps to IBM Cloud Private

DZone's Guide to

Deploying MicroProfile-Based Apps to IBM Cloud Private

Enterprise Java microservices, meet the cloud. See step by step how to deploy MicroProfile-based apps to IBM Cloud private.

· Cloud Zone
Free Resource

Are you joining the containers revolution? Start leveraging container management using Platform9's ultimate guide to Kubernetes deployment.

Eclipse MicroProfile is an open source project for optimizing Enterprise Java for microservices architectures. MicroProfile-based applications can be deployed to Kubernetes. This article describes how to deploy a sample application to IBM Cloud private.

IBM Cloud private is a Kubernetes-based platform to run cloud-native applications on-premises. It also comes with a Docker image registry. For developers, there is a community edition available to run everything in one virtual machine.

The example I’m using is a simple conference application originally provided by the MicroProfile developers and slightly changed by the IBM team to showcase IBM technologies like WebSphere Liberty which has been open sourced this week. My colleagues Animesh Singh and Ishan Gulhane have documented how to deploy this sample to Kubernetes on Bluemix public.

There are different approaches to deploy applications to IBM Cloud private. I’d like to blog later about the approach to using delivery pipelines. Below, I describe how to deploy from a development machine via command line.

Most of the steps to deploy the sample to Bluemix public or IBM Cloud private are identical. So I only document the differences below.

The Microservice Builder Fabric can be installed via helm commands as documented or from the IBM Cloud private admin interface.

cloud-private-sample1

Before building the images, some configuration needs to be done. The hosts file of the development machine needs to be changed to define the IP of the cluster. Additionally, Docker needs to be configured to be able to access the Docker host on the virtual machine. This process is a little tricky, especially on Mac. In one terminal, invoke these commands:

ssh cluster@192.168.178.36
cd /etc/docker/certs.d/mycluster\:8500/
cp ca.crt /tmp/


In a second terminal, run these commands:

sudo screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
mkdir /etc/docker/certs.d/
mkdir /etc/docker/certs.d/mycluster:8500/
cd /etc/docker/certs.d/mycluster:8500/
scp cluster@192.168.178.36:/tmp/ca.crt .


After this, you should be able to access the Docker registry on IBM Cloud private (user: admin, pw: admin):

docker login mycluster:8500
docker build -t mycluster:8500/admin/microservice-vote-cloudant sample.microservicebuilder.vote
docker push mycluster:8500/admin/microservice-vote-cloudant


There is also a script to build and push all six images. If you want to use it, run “./scripts/build_and_push_docker_images.sh mycluster:8500/admin”.

After the images have been pushed you can see them also in the IBM Cloud private admin interface.

cloud-private-sample2

Before the sample can be deployed, Kubernetes needs to be configured. Open the admin interface (e.g. https://192.168.178.36:8443) and choose ‘Configure Client’. Copy and paste these commands in your terminal. For example:

kubectl config set-cluster mycluster --server=https://192.168.178.36:8001 --insecure-skip-tls-verify=true
kubectl config set-context mycluster-context --cluster=mycluster
kubectl config set-credentials mycluster-user --token=eyJhbG......q_ATOQe-J2A
kubectl config set-context mycluster-context --user=mycluster-user --namespace=default
kubectl config use-context mycluster-context


cloud-private-sample3

‘kubectl create -f manifests’ starts the deployment which takes a couple of minutes. After this the sample application can be accessed, e.g. via http://192.168.178.36:30056/#/speakers.

Thanks a lot, again, to Ansgar Schmidt for helping me with the setup.

Using Containers? Read our Kubernetes Comparison eBook to learn the positives and negatives of Kubernetes, Mesos, Docker Swarm and EC2 Container Services.

Topics:
cloud ,microprofile ,kubernetes ,ibm cloud private ,tutorial

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}