From 3c5268fa8de4a03ef4694cf523394e42da31412b Mon Sep 17 00:00:00 2001 From: Lucas Rego Date: Tue, 22 Aug 2023 23:52:01 -0300 Subject: [PATCH] lucasraziel --- participantes/lucasraziel/README.md | 12 +++ participantes/lucasraziel/docker-compose.yml | 86 ++++++++++++++++++++ participantes/lucasraziel/nginx.conf | 20 +++++ 3 files changed, 118 insertions(+) create mode 100644 participantes/lucasraziel/README.md create mode 100644 participantes/lucasraziel/docker-compose.yml create mode 100644 participantes/lucasraziel/nginx.conf diff --git a/participantes/lucasraziel/README.md b/participantes/lucasraziel/README.md new file mode 100644 index 00000000..034fdada --- /dev/null +++ b/participantes/lucasraziel/README.md @@ -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 diff --git a/participantes/lucasraziel/docker-compose.yml b/participantes/lucasraziel/docker-compose.yml new file mode 100644 index 00000000..a161da0b --- /dev/null +++ b/participantes/lucasraziel/docker-compose.yml @@ -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: diff --git a/participantes/lucasraziel/nginx.conf b/participantes/lucasraziel/nginx.conf new file mode 100644 index 00000000..635d9525 --- /dev/null +++ b/participantes/lucasraziel/nginx.conf @@ -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; + } + } +} \ No newline at end of file