From 7d3f854f8d7918f01ff11ea73ce88c0dcf09b3d8 Mon Sep 17 00:00:00 2001 From: Schrammel Date: Sun, 10 Mar 2024 21:42:25 -0300 Subject: [PATCH 1/5] add prisma-bun --- participantes/schrammel-bun-prisma/README.md | 14 +++++ .../schrammel-bun-prisma/docker-compose.yml | 59 +++++++++++++++++++ participantes/schrammel-bun-prisma/nginx.conf | 22 +++++++ 3 files changed, 95 insertions(+) create mode 100644 participantes/schrammel-bun-prisma/README.md create mode 100644 participantes/schrammel-bun-prisma/docker-compose.yml create mode 100644 participantes/schrammel-bun-prisma/nginx.conf diff --git a/participantes/schrammel-bun-prisma/README.md b/participantes/schrammel-bun-prisma/README.md new file mode 100644 index 000000000..8b9e91b5c --- /dev/null +++ b/participantes/schrammel-bun-prisma/README.md @@ -0,0 +1,14 @@ + +# Rinha Backend 2ª Edição + * Repositorio do projeto: https://github.com/Schrammel/rinha-backend + +## O que é preciso para subir os apps? + +apenas executar o comando `docker compose up` e é isso, já pode rodar os testes. + +## Tecnologias utilizadas + + - [Bun](https://bun.sh/) + - [Prisma](prisma.io) + + diff --git a/participantes/schrammel-bun-prisma/docker-compose.yml b/participantes/schrammel-bun-prisma/docker-compose.yml new file mode 100644 index 000000000..d3528b675 --- /dev/null +++ b/participantes/schrammel-bun-prisma/docker-compose.yml @@ -0,0 +1,59 @@ +version: '3' + +services: + postgresdb: + image: postgres + ports: + - 5432:5432 + environment: + POSTGRES_DB: rinha + POSTGRES_USER: rinha + POSTGRES_PASSWORD: rinha + command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c full_page_writes=0 + deploy: + resources: + limits: + cpus: '0.25' + memory: '140MB' + + app1: + image: davidschrammel/prisma_rinha_backend + environment: + DATABASE_URL: "postgresql://rinha:rinha@postgresdb:5432/rinha?connection_limit=13" + entrypoint: "bun prod:migration" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + resources: + limits: + cpus: '0.55' + memory: '150MB' + + app2: + image: davidschrammel/prisma_rinha_backend + entrypoint: "bun prod" + environment: + DATABASE_URL: "postgresql://rinha:rinha@postgresdb:5432/rinha?connection_limit=13" + deploy: + replicas: 1 + restart_policy: + condition: on-failure + resources: + limits: + cpus: '0.55' + memory: '150MB' + + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + restart: on-failure + ports: + - "9999:9999" + deploy: + resources: + limits: + cpus: "0.15" + memory: "50MB" + diff --git a/participantes/schrammel-bun-prisma/nginx.conf b/participantes/schrammel-bun-prisma/nginx.conf new file mode 100644 index 000000000..215155502 --- /dev/null +++ b/participantes/schrammel-bun-prisma/nginx.conf @@ -0,0 +1,22 @@ +worker_processes 1; + +events { + use epoll; + worker_connections 1024; +} + +http { + access_log off; + upstream api { + server app1:9999; + server app2:9999; + } + + server { + listen 9999; + + location / { + proxy_pass http://api; + } + } +} \ No newline at end of file From ae68013ac451d4f36bdfa6503d6cfb8cdf169536 Mon Sep 17 00:00:00 2001 From: Schrammel Date: Sun, 10 Mar 2024 23:26:09 -0300 Subject: [PATCH 2/5] improve compose --- .../schrammel-bun-prisma/docker-compose.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/participantes/schrammel-bun-prisma/docker-compose.yml b/participantes/schrammel-bun-prisma/docker-compose.yml index d3528b675..9d6419d4c 100644 --- a/participantes/schrammel-bun-prisma/docker-compose.yml +++ b/participantes/schrammel-bun-prisma/docker-compose.yml @@ -3,8 +3,6 @@ version: '3' services: postgresdb: image: postgres - ports: - - 5432:5432 environment: POSTGRES_DB: rinha POSTGRES_USER: rinha @@ -13,8 +11,8 @@ services: deploy: resources: limits: - cpus: '0.25' - memory: '140MB' + cpus: '0.24' + memory: '200MB' app1: image: davidschrammel/prisma_rinha_backend @@ -22,12 +20,11 @@ services: DATABASE_URL: "postgresql://rinha:rinha@postgresdb:5432/rinha?connection_limit=13" entrypoint: "bun prod:migration" deploy: - replicas: 1 restart_policy: condition: on-failure resources: limits: - cpus: '0.55' + cpus: '0.58' memory: '150MB' app2: @@ -36,24 +33,24 @@ services: environment: DATABASE_URL: "postgresql://rinha:rinha@postgresdb:5432/rinha?connection_limit=13" deploy: - replicas: 1 restart_policy: condition: on-failure resources: limits: - cpus: '0.55' + cpus: '0.58' memory: '150MB' nginx: image: nginx:latest volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - restart: on-failure ports: - "9999:9999" deploy: + restart_policy: + condition: on-failure resources: limits: - cpus: "0.15" + cpus: "0.10" memory: "50MB" From db8ef07b4152f4a6b049423dec958043184a192e Mon Sep 17 00:00:00 2001 From: Schrammel Date: Sun, 10 Mar 2024 23:38:08 -0300 Subject: [PATCH 3/5] add nome --- participantes/schrammel-bun-prisma/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/participantes/schrammel-bun-prisma/README.md b/participantes/schrammel-bun-prisma/README.md index 8b9e91b5c..649ac10d4 100644 --- a/participantes/schrammel-bun-prisma/README.md +++ b/participantes/schrammel-bun-prisma/README.md @@ -1,4 +1,6 @@ +Nome: David Schrammel + # Rinha Backend 2ª Edição * Repositorio do projeto: https://github.com/Schrammel/rinha-backend From 0875489cdbc245135cde280608725c5acfba8cb8 Mon Sep 17 00:00:00 2001 From: Schrammel Date: Sun, 10 Mar 2024 23:39:00 -0300 Subject: [PATCH 4/5] add email --- participantes/schrammel-bun-prisma/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/participantes/schrammel-bun-prisma/README.md b/participantes/schrammel-bun-prisma/README.md index 649ac10d4..e3cdfa579 100644 --- a/participantes/schrammel-bun-prisma/README.md +++ b/participantes/schrammel-bun-prisma/README.md @@ -1,5 +1,6 @@ Nome: David Schrammel +email: schrammel@live.com # Rinha Backend 2ª Edição * Repositorio do projeto: https://github.com/Schrammel/rinha-backend From dcb75a735c53aeb42827033df88ad03be39d42e7 Mon Sep 17 00:00:00 2001 From: Schrammel Date: Mon, 11 Mar 2024 00:26:47 -0300 Subject: [PATCH 5/5] remove test --- participantes/schrammel-bun-prisma/testada | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 participantes/schrammel-bun-prisma/testada diff --git a/participantes/schrammel-bun-prisma/testada b/participantes/schrammel-bun-prisma/testada deleted file mode 100644 index 0ae695969..000000000 --- a/participantes/schrammel-bun-prisma/testada +++ /dev/null @@ -1,2 +0,0 @@ -testada em Mon Mar 11 02:44:34 UTC 2024 -abra um PR removendo esse arquivo caso queira que sua API seja testada novamente