This repository provides a practical setup for implementing a load balancer, a rate limiter using NGINX, as well as a circuit breaker and monitoring with Spring Actuator, Prometheus, and Grafana.
- Docker and Docker Compose installed.
- Access to backend instances (applications that will receive balanced traffic).
git clone https://github.com/MSpilari/nginx-proxy-lb.git
cd nginx-proxy-lb
Run the command:
docker-compose up -d
This will start:
- A container with NGINX configured as a reverse proxy, load balancer, and rate limiter.
- Two containers running Spring Boot, simulating two backend servers.
- A container with Prometheus.
- A container with Grafana.
Access the application through the URL configured in the container (e.g., http://localhost:8080/hello-world
).
Access the Grafana dashboard, already consuming data from Prometheus, via http://localhost:3000/
.
spring_app_server/
βββ .mvn/
β βββ [Maven Wrapper files]
βββ nginx/
β βββ [Nginx-related configurations]
βββ prometheus/
β βββ [Prometheus configuration files]
βββ src/
β βββ main/
β β βββ java/
β β β βββ [Java source code files]
β β βββ resources/
β β βββ [Spring Boot resource files like application.properties or application.yml]
β βββ test/
β βββ [Unit tests and integration tests]
βββ target/
β βββ [Build output directory]
βββ .gitattributes
βββ .gitignore
βββ docker-compose.yaml
βββ Dockerfile
βββ HELP.md
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
βββ README.md
- Fork the project.
- Create a branch for your feature/fix:
git checkout -b my-feature
. - Make the changes and commit them:
git commit -m "My new feature"
. - Push it to your fork:
git push origin my-feature
. - Open a Pull Request.
This project is licensed under the MIT License. Feel free to use, modify, and share it.
- MSpilari
If you have any questions or suggestions, feel free to open an issue! π
Este repositório contém uma configuração prÑtica para implementar um balanceador de carga, um rate limiter utilizando o NGINX, além de um circuit breaker e monitoramento com Spring Actuator, Prometheus e Grafana.
- Docker e Docker Compose instalados.
- Acesso às instÒncias de backend (aplicaçáes que receberão o trÑfego balanceado).
git clone https://github.com/MSpilari/nginx-proxy-lb.git
cd nginx-proxy-lb
Execute o comando:
docker-compose up -d
Isso iniciarΓ‘ um contΓͺiner com o NGINX configurado como proxy reverso, balanceador de carga, rate limiter. Dois contΓͺineres com Sprig boot, rodando uma aplicação simulando dois servidores. Um contΓͺiner com Prometheus. Um contΓͺiner com Grafana.
Acesse a aplicação atravΓ©s da URL configurada no contΓͺiner (por exemplo, http://localhost:8080/hello-world
).
Acesso o dashboard do Grafana, jΓ‘ consumindo dados do Prometheus atravΓ©s do URL http://localhost:3000/
spring_app_server/
βββ .mvn/
β βββ [Maven Wrapper files]
βββ nginx/
β βββ [Nginx-related configurations]
βββ prometheus/
β βββ [Prometheus configuration files]
βββ src/
β βββ main/
β β βββ java/
β β β βββ [Java source code files]
β β βββ resources/
β β βββ [Spring Boot resource files like application.properties or application.yml]
β βββ test/
β βββ [Unit tests and integration tests]
βββ target/
β βββ [Build output directory]
βββ .gitattributes
βββ .gitignore
βββ docker-compose.yaml
βββ Dockerfile
βββ HELP.md
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
βββ README.md
- Faça um fork do projeto.
- Crie uma branch para a sua funcionalidade/correção:
git checkout -b minha-feature
. - Realize as alteraçáes e comite:
git commit -m "Minha nova feature"
. - Envie para o seu fork:
git push origin minha-feature
. - Abra um Pull Request.
Este projeto estΓ‘ licenciado sob a MIT License. Sinta-se Γ vontade para usar, modificar e compartilhar.
- MSpilari
Se tiver dΓΊvidas ou sugestΓ΅es, sinta-se Γ vontade para abrir uma issue! π