diff --git a/participantes/thiagosantana/README.md b/participantes/thiagosantana/README.md new file mode 100644 index 000000000..ff7440376 --- /dev/null +++ b/participantes/thiagosantana/README.md @@ -0,0 +1,16 @@ +# Submissão para Rinha de Backend, Segunda Edição: 2024/Q1 - Controle de Concorrência + + +logo nginx +logo quarkus +logo mongodb + + +## Thiago Santana +Submissão feita com: +- `nginx` como load balancer +- `mongodb` como banco de dados +- `Java` para api utilizando Quarkus +- [Repositório da api](https://github.com/ThiagoSousaSantana/rinha-de-backend-2024-Q1-quarkus) + +[@thiagos_santana](https://twitter.com/thiagos_santana) @ twitter diff --git a/participantes/thiagosantana/docker-compose.yml b/participantes/thiagosantana/docker-compose.yml new file mode 100644 index 000000000..8a070f12c --- /dev/null +++ b/participantes/thiagosantana/docker-compose.yml @@ -0,0 +1,66 @@ +version: "3.8" + +services: + api01: &api + image: thiagosousa/rinha-api:latest + hostname: api01 + environment: + - MONGO_URI=mongodb://username:password@mongodb:27017 + - MONGO_DB=rinha + ports: + - "8080:8080" + depends_on: + mongodb: + condition: service_healthy + deploy: + resources: + limits: + cpus: "0.5" + memory: "200MB" + api02: + <<: *api + hostname: api02 + environment: + - MONGO_URI=mongodb://username:password@mongodb:27017 + - MONGO_DB=rinha + - PORT=8081 + depends_on: + - api01 + ports: + - "8081:8081" + + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - api01 + - api02 + ports: + - "9999:9999" + deploy: + resources: + limits: + cpus: "0.2" + memory: "10MB" + + mongodb: + image: mongo:latest + container_name: mongodb + restart: unless-stopped + environment: + MONGO_INITDB_ROOT_USERNAME: username + MONGO_INITDB_ROOT_PASSWORD: password + ports: + - 27017:27017 + deploy: + resources: + limits: + cpus: "0.3" + memory: "140MB" + healthcheck: + test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27017'}]}) }" | mongosh --port 27017 --quiet + interval: 5s + timeout: 30s + start_period: 0s + retries: 30 \ No newline at end of file diff --git a/participantes/thiagosantana/nginx.conf b/participantes/thiagosantana/nginx.conf new file mode 100644 index 000000000..206fd13ae --- /dev/null +++ b/participantes/thiagosantana/nginx.conf @@ -0,0 +1,21 @@ +events { + worker_connections 1000; +} + +http { + access_log off; + sendfile on; + + upstream api { + server api01:8080; + server api02:8081; + } + + server { + listen 9999; + + location / { + proxy_pass http://api; + } + } +}