Skip to content

Commit

Permalink
Submissão Wallace (zanfranceschi#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
WallacePinho authored Mar 11, 2024
1 parent e3f3b3a commit b1096b6
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
7 changes: 7 additions & 0 deletions participantes/wallacepinho/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**<center>API feita em Python com FastAPI, PostgreSQL e NGINX</center>**


Repositório da API: [WallacePinho/rinha-backend-2024-q1-fastapi](https://github.com/WallacePinho/rinha-backend-2024-q1-fastapi)
<br>
Contato: [LinkedIn](https://www.linkedin.com/in/wallacepinho/)

56 changes: 56 additions & 0 deletions participantes/wallacepinho/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: "3.5"

services:
api1: &api
image: wallacepinho/rinha-backend-2024-q1-fastapi
hostname: api1
environment:
- PYTHONPATH=/code/app
depends_on:
- postgres
deploy:
resources:
limits:
cpus: "0.5"
memory: "200MB"

api2:
<<: *api
hostname: api2

nginx:
image: nginx:latest
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.25"
memory: "10MB"

postgres:
image: postgres:16.2
hostname: postgres
environment:
- POSTGRES_PASSWORD=rinha
- POSTGRES_USER=rinha
- POSTGRES_DB=rinha
ports:
- "5432:5432"
volumes:
- ./database:/docker-entrypoint-initdb.d/
deploy:
resources:
limits:
cpus: "0.25"
memory: "140MB"

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

http {
access_log off;
sendfile on;

upstream api {
server api1:80;
server api2:80;
}

server {
listen 9999;

location / {
proxy_pass http://api;
}
}
}
24 changes: 24 additions & 0 deletions participantes/wallacepinho/script.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
create schema rinha;

-- tables
create table rinha.cliente (
id integer,
limite integer,
saldo integer
);

create table rinha.transacao (
cliente_id integer,
valor integer,
tipo varchar(1),
descricao varchar(10),
realizada_em timestamp
);

-- data
insert into rinha.cliente(id, limite, saldo) values
(1, 100000, 0),
(2, 80000, 0),
(3, 1000000, 0),
(4, 10000000, 0),
(5, 500000, 0);

0 comments on commit b1096b6

Please sign in to comment.