Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

IBM/visitor

 
 

Repository files navigation

Hybrid chart approach solution 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:

$ git clone https://github.com/IBM/visitor.git
$ git checkout -b solution/hybrid-chart-lab
$ git pull

Try to build the project locally using Run-Visitor-Microservice.adoc.

Build the image with:

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2docker 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

Important
If you already have the Docker image for Landmark Microservice and/or the installation of the leader charts, skip these steps and just install the visitor charts .

Working locally with the Docker image for Landmark Microservice

Clone the repository https://github.com/IBM/landmark.

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

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 src/main/docker/Dockerfile.jvm -t quarkus/landmark:1.0 .
$ docker tag quarkus/landmark:1.0 localhost:5000/quarkus/landmark:1.0
$ docker push localhost:5000/quarkus/landmark:1.0

Leader Helm chart installation

Return to the visitor project you were earlier on because you already have your leader charts solution there. 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!

Validation and more

Looking to validate your charts?

Navigate to global instructions

Navigate to previous section


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.

About

This repository is for visitor microservice.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published