Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
/ visitor Public archive

This repository is for visitor microservice.

License

Notifications You must be signed in to change notification settings

IBM/visitor

Repository files navigation

Hybrid chart approach with Helm Charts in Openshift

This approach means to create one 'leader' chart per service group, while keeping one dependent chart per service, having values and specific aditions.

Goal of this section: deploy the visitor and landmark microservices using Helm charts.

Leader chart approach will be used for deploying landmark microservice, while visitor microservice will be deployed via chart per service approach.

All the below commands will be executed in a terminal window.

Preparation

To login to the OpenShift cluster from the Terminal run:

$ oc login -u kubeadmin -p YOUR_SECRET_PASSWORD https://api.crc.testing:6443

Check if you already have the dev project:

$ oc get project
$ oc new-project dev
$ oc project dev

The landmark microservice will persist its data into a database, in this case a PostgreSQL database instance.

Check if the Helm repo https://charts.bitnami.com/bitnami is added to your existing list:

$ helm repo list

If the repo is not there, please run the following set of commands:

$ helm repo add bitnami https://charts.bitnami.com/bitnami

Working locally with the Docker image for Visitor Microservice

Clone the repository https://github.com/IBM/visitor. Try to build the project locally using Run-Visitor-Microservice.adoc.

If you wish to build the image locally, please use:

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
$ docker build -t springboot/visitor:1.0 .
$ docker tag springboot/visitor:1.0 localhost:5000/springboot/visitor:1.0
$ docker push localhost:5000/springboot/visitor:1.0

Install leader chart for Landmark microservice

If you have not deployed the landmark microservice using leader chart approach, please execute the following:

$ git clone https://github.com/IBM/landmark.git
$ git checkout solution/leader-chart-lab
$ git pull

NOTE: Do the bellow steps only if you do not have the landmark Docker image created yet.

Working locally with the Docker image for Landmark Microservice

Clone the repository https://github.com/IBM/landmark. Try to build the project locally using Run-Landmark-Microservice.adoc.

Make sure that you are under root folder of the clone repository (landmark) and run:

$ mvn package

Then, build the image with:

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
$ docker build -f Dockerfile -t spring-boot/visitor:1.0 .
$ docker tag spring-boot/visitor:1.0 localhost:5000/spring-boot/visitor:1.0
$ docker push localhost:5000/spring-boot/visitor:1.0

Leader Helm chart setup

Install your charts in your current project:

$ helm install leader ./leader
$ helm status leader

Install Helm chart for Visitor microservice

Return to the root folder of visitor microservice (visitor) and install its Helm charts:

$ cd chart
$ helm install visitor ./visitor
$ helm status visitor
$ kubectl get ns
$ kubectl get svc
$ kubectl port-forward --namespace qa svc/visitor 8080

Go in a browser window and copy-paste http://localhost:8080/api/visit/museum/ams

Congratulations, you visited a landmark by using two microservices!

Compatibility

The Java code in the repositories is compatible with Java11.


License

This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0.