Skip to content

Commit

Permalink
adiciona participante vitorbgs (zanfranceschi#1642)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitor-bgs authored Mar 11, 2024
1 parent 035f0a6 commit 1cdbc9c
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
62 changes: 62 additions & 0 deletions participantes/vitorbgs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: "3.8"

services:
api01: &api
image: vitorbgs/crebito-rinha-backend-2024q1
hostname: api01
environment:
- ASPNETCORE_ENVIRONMENT=Loadtest
- ConnectionStrings__CrebitoDbConnection=Host=db;Database=rinha;Username=admin;Password=123;Maximum Pool Size=4;
ports:
- "8081:8080"
depends_on:
- db
deploy:
resources:
limits:
cpus: "0.4"
memory: "70MB"

api02:
<<: *api
hostname: api02
ports:
- "8080:8080"

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: "20MB"

db:
image: postgres:latest
hostname: db
environment:
- POSTGRES_PASSWORD=123
- POSTGRES_USER=admin
- POSTGRES_DB=rinha
command: 'postgres -c max_connections=20 -c shared_buffers=128MB -c effective_cache_size=256MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off'
ports:
- "5432:5432"
volumes:
- ./script.sql:/docker-entrypoint-initdb.d/script.sql
deploy:
resources:
limits:
cpus: "0.5"
memory: "390MB"

networks:
default:
driver: bridge
name: rinha-nginx-2024q1
29 changes: 29 additions & 0 deletions participantes/vitorbgs/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
events {
worker_connections 512;
}


http {
upstream api {
server api01:8080;
server api02:8080;
}

server {
listen 9999;
access_log off;
location / {
proxy_buffering off;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Keep-Alive "";
proxy_set_header Proxy-Connection "keep-alive";
proxy_pass http://api;

# Timeouts
proxy_connect_timeout 30s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}
}
19 changes: 19 additions & 0 deletions participantes/vitorbgs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Rinha de Backend 2024q1 - vitorbgs

### Tecnologias
- .NET 8
- Minimal API
- Clean Architecture
- FluentValidation
- Dapper
- PostgreSQL
- NGINX

### Resultados
![image](https://github.com/vitor-bgs/crebito-rinha-backend-2024q1/assets/40612400/2990e35b-bf1a-47c4-bd62-c631706cf517)


### Info
Repositório da Rinha: [zanfranceschi/rinha-de-backend-2024-q1](https://github.com/zanfranceschi/rinha-de-backend-2024-q1)

LinkedIn: [Vitor Breno Gomes da Silva](https://www.linkedin.com/in/vitorbgs/)
43 changes: 43 additions & 0 deletions participantes/vitorbgs/script.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- Table: public.contas

-- DROP TABLE IF EXISTS public.contas;

CREATE TABLE IF NOT EXISTS public.contas
(
id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
cliente_id integer NOT NULL,
limite integer NOT NULL,
saldo integer NOT NULL,
CONSTRAINT pk_clientes PRIMARY KEY (id)
);

CREATE INDEX IF NOT EXISTS idx_contas_cliente_id ON public.contas(cliente_id);

-- Table: public.Transacoes

-- DROP TABLE IF EXISTS public.transacoes;

CREATE TABLE IF NOT EXISTS public.transacoes
(
id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
conta_id integer NOT NULL,
tipo character(1) COLLATE pg_catalog."default" NOT NULL,
descricao text COLLATE pg_catalog."default" NOT NULL,
valor integer NOT NULL,
realizada_em timestamp with time zone NOT NULL,
CONSTRAINT pk_transacoes PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS idx_transacoes_conta_id ON public.transacoes(conta_id);


DELETE FROM public.contas;
DELETE FROM public.transacoes;

INSERT INTO public.contas(cliente_id, limite, saldo)
VALUES
(1, 100000, 0),
(2, 80000, 0),
(3, 1000000, 0),
(4, 10000000, 0),
(5, 500000, 0);

0 comments on commit 1cdbc9c

Please sign in to comment.