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-lbRun the command:
docker-compose up -dThis 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-lbExecute o comando:
docker-compose up -dIsso 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! 😊