-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from lucasraziel/main
lucasraziel
- Loading branch information
Showing
3 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |