Welcome to the TechTalk hands-on lab! This lab is designed to guide you through three crucial aspects of modern software development: Resilience, CI/CD workflows, and Observability. By the end of this lab, you’ll have hands-on experience with Resilience4j in Java, setting up a GitHub workflow, and implementing observability with Prometheus.
This lab is divided into three sections:
- Java Resilience4j
- GitHub Workflow
- Prometheus Observability
To get the full experience you should complete these sections in the order presented. Each section builds on the concepts learned in the previous one, providing a comprehensive understanding of resilience and observability in software development.
To start you should fork the repository on the lab-java branch.
In this section, you’ll work with an existing Java application that demonstrates how to implement resilience patterns using the Resilience4j library. Resilience patterns like Circuit Breaker, Rate Limiter, and Retry are essential for building robust applications that can handle failures gracefully.
- Integrate Resilience4j into the Java application.
- Implement Circuit Breaker, Rate Limiter, Time limiter, and Retry patterns.
- Test the resilience features and understand their impact on application stability.
- CD to directory java-resilience4j-lab
- Complete the readme inside that dir
- Push the changes to your master branch
The second part of this lab focuses on Continuous Integration/Continuous Deployment (CI/CD) using GitHub Actions. Here, you will learn key concepts like the build, test, and deployment processes of your Java application. And implement the trigger for the action and also configure your repository to publish to your docker-hub
Pre-requirements
- Understand a GitHub Actions workflow.
- Integrate the Java App with a CI/CD pipeline and then publish the image to dockerhub
- Go to the workflow directory (root/.github/workflows)
- Edit the ci-cd.yml with the trigger described bellow
- On you github repository go to " Settings > Secrets and Variables > Actions "
- Add 2 new secrets on the "Repository secrets" DOCKERHUB_TOKEN & DOCKERHUB_USERNAME 5. You can get this 2 secrets from you docker hub "Personal Access Tokens" page
- Push the updated ci-cd.yml and what it run in the Actions page of you repository
- After the workflow is completed you can test modifying the docker-compose in the root of the project with the path of the created image 8. In the docker-compose.yml line 8 where it says "<<DOCKER_USER>>/lab-java4j:<<IMAGE_TAG>>" replace with your newly created repository 9. You can find it going to the https://hub.docker.com/ login in > clicking on your picture (top-right corner) > My profile and under the repositories tap should be a "<your_username>/lab-java4j" 10. inside the imaqe you can get the latest tag by going in the "Tags" tab and copying the version image tag.
Trigger
on:
push:
branches: [master]After mastering the GitHub workflow, you'll be ready to implement observability in the deployed application using Prometheus, which is the final part of this lab.
In the final section, you'll integrate Prometheus for observability, which is crucial for monitoring the health and performance of your application. Observability allows you to understand the internal state of your application based on the data it generates, which is vital for maintaining resilient and reliable services.
Key Objectives:
- Integrate Prometheus with the Java application.
- Set up metrics collection to monitor application performance.
- Visualize the data in Grafana to gain insights into the application's behavior.
- Go to the grafana directory (root/grafana/)
- Follow the readme present in that directory
By the end of this lab, you will have a robust Java application equipped with resilience patterns, automated CI/CD workflows using GitHub, and comprehensive observability through Prometheus. Each section is designed to build on the previous one, so be sure to complete them in the order provided.
Good luck, and enjoy the hands-on experience!
For more detailed instructions and specific configuration steps, please refer to the individual guides provided in each section.