DEV Community

Cover image for 🚀 Deploying Spring Boot Microservices using Cyclops ☸️⚓
s-vamshi
s-vamshi

Posted on

🚀 Deploying Spring Boot Microservices using Cyclops ☸️⚓

Hello folks,

Let me quickly introduce you guys about Cyclops before we start.

What is Cyclops?

Cyclops is a web-based tool designed to simplify the containerization process of apps in Kubernetes. Cyclops gives as an intuitive web form where we can configure our app seamlessly and also it provides us a dashboard where we can view all our pods, deployments, services. Moreover, it provides us key metrics like cluster's performance, resource utilization and health. It helps us to onboard quickly without spending much time on configuring things.

GitHub Link: https://github.com/cyclops-ui/cyclops

Now that you know about Cyclops, let's dive in by deploying Spring Boot Microservices in Cyclops.

Table Of Contents

Setting up Cyclops Locally

  1. We need a Kubernetes Cluster to try out Cyclops. If you don't have one you can install MiniKube which provides use local kubernetes cluster. For more details on installation process, click here.

  2. Now that Minikube is installed, let's start it!

    minikube start
    
  3. Now we need to install Cyclops into our cluster, to do that run below command:

    kubectl apply -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.8.2/install/cyclops-install.yaml
    kubectl apply -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.8.2/install/demo-templates.yaml
    
  4. To access Cyclops outside of the cluster, run the below command:

    kubectl port-forward svc/cyclops-ui 3000:3000 -n cyclops
    
  5. Now when you hit localhost:3000 in your browser, it shows you
    cyclops-ui!

Creating Microservices and Deploying to Cyclops

  1. I have created a student service which communicates with library service using rest template, repo link

  2. Dockerfile of student service is as below

    FROM openjdk:17-jdk-alpine
    WORKDIR /studentService
    COPY target/studentService-0.0.1-SNAPSHOT.jar studentService.jar
    EXPOSE 8090
    ENTRYPOINT ["java", "-jar", "studentService.jar"]
    
  3. Dockerfile of library service is as below

    FROM openjdk:17-jdk-alpine
    WORKDIR /libraryService
    COPY target/libraryService-0.0.1-SNAPSHOT.jar libraryService.jar
    EXPOSE 8090
    ENTRYPOINT ["java", "-jar", "libraryService.jar"]
    
  4. Now we will build the images of both the services by checking out to each service folder where Dockerfile is present:

    docker build -t student-service .
    docker build -t library-service .
    
  5. Let's tag this images and push to docker hub!

    docker tag student-service your-dockerhub-username/student-service:latest
    docker tag library-service your-dockerhub-username/library-service:latest
    docker push your-dockerhub-username/student-service:latest
    docker push your-dockerhub-username/library-service:latest
    
  6. To deploy this services we generally define Deployment and Service YAML files. But here Cyclops comes into play and does that for us. We just need to create modules and wait for it to be up and running!

  7. Now that we deployed microservices to Cyclops, we should also be able to access them from our browser and to do that forward the ports!

    kubectl port-forward svc/student-service 8091:8091
    kubectl port-forward svc/library-service 8092:8092
    

How I Contributed to Cyclops

Cyclops team has opened issues(features/bugs) on their GitHub Repository for us to built Cyclops together!

And issues on which I worked were:

  1. Broken links in deployed modules

    After creating a modules, the module card shows repo and path link. Now, this when path link was clicked it used to take use to broken Github link by eating current page.
    Solution:
    I have made changes such that when path link is clicked it opens in a new tab. And also, broken path link was fixed by using resolvedVersion _in url if present, if not then by using _version _ else using _main.

  2. Enhancing Node Conditions card

    Nodes page used to show the status of the node when clicked on details of specific node.
    Solution:
    I have also added lastHeartbeatTime, lastTransitionTime, and message of a particular condition of the node
    Image description

Top comments (1)

Collapse
 
fernandezbaptiste profile image
Bap

Excellent piece!