Skip to content

Commit

Permalink
Merge pull request #227 from lucasraziel/main
Browse files Browse the repository at this point in the history
lucasraziel
  • Loading branch information
zanfranceschi authored Aug 23, 2023
2 parents 1f6ee3d + 3c5268f commit 892a742
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
12 changes: 12 additions & 0 deletions participantes/lucasraziel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Node/MongoDB/Redis

Github: [Lucas Rego](https://github.com/lucasraziel)
Twitter/X: [Lucas Rego](https://twitter.com/lucasraziel)

Project Url: [rinha-de-backend](https://github.com/lucasraziel/rinha-de-backend )

### Technologies

- Node using [Fastify](https://fastify.dev/)
- MongoDB
- Redis
86 changes: 86 additions & 0 deletions participantes/lucasraziel/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
version: "3.5"
services:
db:
image: mongo
hostname: db
ports:
- "27017:27017"
deploy:
resources:
limits:
cpus: "0.7"
memory: "0.9GB"
networks:
- rinha-node

cache:
hostname: cache
image: redis:latest
ports:
- "6379:6379"
deploy:
resources:
limits:
cpus: "0.04"
memory: "0.5GB"
networks:
- rinha-node

api1: # API - Instância 01
image: lucasraziel/rinha-node:latest
hostname: api1
depends_on:
- db
- cache
environment:
- MONGO_URI=mongodb://db:27017
- REDIS_PORT=6379
- REDIS_HOST=cache
ports:
- "3002:3000"
deploy:
resources:
limits:
cpus: "0.37"
memory: "0.5GB"
networks:
- rinha-node

api2: # API - Instância 02
image: lucasraziel/rinha-node:latest
hostname: api2
depends_on:
- db
- cache
environment:
- MONGO_URI=mongodb://db:27017
- REDIS_PORT=6379
- REDIS_HOST=cache
ports:
- "3001:3000"
deploy:
resources:
limits:
cpus: "0.37"
memory: "0.5GB"
networks:
- rinha-node

nginx: # Load Balancer
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.2"
memory: "0.2GB"
networks:
- rinha-node
networks:
rinha-node:
20 changes: 20 additions & 0 deletions participantes/lucasraziel/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
worker_processes auto;

events {
worker_connections 10000;
}

http {

upstream api {
server api1:3000;
server api2:3000;
}
server {
listen 9999;

location / {
proxy_pass http://api;
}
}
}

0 comments on commit 892a742

Please sign in to comment.