Fight Microservice
Deploy application using Quarkus Maven plugin
Open the Web Terminal. Then run this command to clone Git repository to local.
git clone http://git.gitea.svc.cluster.local:3000/lab-user/developer-advocacy-2022.git
Notice that the URL is internal DNS! Yes, there is a Git server (Gitea) running in the same cluster but different project.
Deploy application Run this command to go into the Fight microservice project directory.
cd developer-advocacy-2022/code/rest-fights && ls -l
Deploy application Run this command to build and deploy microservice to OpenShift cluster.
./mvnw -s maven-setting.xml install \ -DskipTests \ -Dquarkus.container-image.group=$(oc project --short) \ -Dquarkus.profile=openshift-17 \ -Dquarkus.kubernetes.deploy=true
Yes!, you don't have to write Dockerfile, build container image, push the image to container registry e.g. Docker Hub, Quay.io, then deploy the container image to OpenShift cluster step by step. With one command you can get all of these done! Thank you Quarkus ecosystem 🙏
Wait until the build success. Then go to Builds menu, you should see a new rest-fights BuildConfigs for OpenShift Build (Binary).
What happens behind the scene is that when you run Maven build in local, Quarkus Maven plugin (plus a bunch of configurations) talks to OpenShift to create required resources for your service i.e. ConfigMap, Secret, Deployment etc. including the BuildConfigs as well. When code build in local is done, the plugin will upload artefacts a.k.a binaries e.g. jar, war, libraries to OpenShift and after that the OpenShift Build kicks off the container image build and deploy.
Click on the rest-fights BuildConfigs to see build logs.
Deploy application Go to Builds tab, you should see the build task.
Deploy application Now go back to Topology menu. You'll be more surprised. The microservice has been deployed as well as visual connectors (arrow lines) by just using Maven command. This is the magic of Quarkus!
Deploy application
What have you learnt?
How to deploy microservice using Maven command.
Magic of Quarkus framework! (well, you didn't learn anything but you saw it, right? 😆)
How to check OpenShift Build logs.
Last updated