Skip to content

Commit

Permalink
Merge pull request #44 from doceazedo/clean
Browse files Browse the repository at this point in the history
Adicionar participante doceazedo
  • Loading branch information
zanfranceschi authored Feb 8, 2024
2 parents afa456c + 989b90b commit e165a89
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
36 changes: 36 additions & 0 deletions participantes/doceazedo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<h1 align="center">Rinha de Backend - 2024/Q1</h1>
<p align="center">✨🧡 — <i><b>SvelteKit Edition</b></i> — 🧡✨</p>

> [!NOTE]
> **O repositório com o código-fonte está disponível [aqui](https://github.com/doceazedo/rinha-de-backend-2024-q1/tree/main/participantes/doceazedo).**
Você já pensou o que aconteceria se um dev frontend participasse de uma rinha de backend?

Ele mete uma stack dessas:

- 🧡 [**SvelteKit**](https://kit.svelte.dev): Framework para aplicações Svelte (tal qual o Next é para o React) que, por acaso, serve muito bem pra fazer APIs (em teoria).
- 💚 [**Drizzle**](https://orm.drizzle.team): ORM para TypeScript
- 💙 [**Zod**](https://zod.dev): Validação de dados com TypeScript
- 🐘 [**PostgreSQL**](https://orm.drizzle.team/docs/get-started-postgresql): Banco de dados relacional

E isso aqui acontece:

![](https://i.imgur.com/XffIUTj.png)

_100% de taxa de sucesso e uma média de 5ms de tempo de resposta!_

## Instruções

Nenhuma configuração adicional é necessária, apenas use o comando...

```sh
$ docker-compose up
```

...e voilà! 🪄

## Autor

- Doce — Twitter: [@doceazedo911](https://twitter.com/doceazedo911) ✦ Site: [doceazedo.com](https://doceazedo.com)

[![](https://discord-invite.doceazedo.com/vEGRe2kq8B.svg)](https://discord.gg/vEGRe2kq8B)
53 changes: 53 additions & 0 deletions participantes/doceazedo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
services:
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api01
- api02
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.1"
memory: "50MB"

postgres:
image: postgres:16.1-alpine
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "123456"
POSTGRES_DB: "postgres"
volumes:
- postgres:/var/lib/postgresql/data
- ./postgresql.conf:/etc/postgresql.conf
deploy:
resources:
limits:
cpus: "0.6"
memory: "200MB"

api01: &api01
image: doceazedo/rinha-de-backend-2024-q1:latest
environment:
DB_HOST: "postgres"
DB_PORT: "5432"
DB_USER: "postgres"
DB_PASSWORD: "123456"
DB_DATABASE: "postgres"
depends_on:
- postgres
restart: always
deploy:
resources:
limits:
cpus: "0.4"
memory: "150MB"

api02:
<<: *api01

volumes:
postgres:
20 changes: 20 additions & 0 deletions participantes/doceazedo/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
worker_processes auto;

events {
worker_connections 256;
}

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

server {
listen 9999;

location / {
proxy_pass http://api;
}
}
}
2 changes: 2 additions & 0 deletions participantes/doceazedo/postgresql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shared_buffers = 256MB
effective_cache_size = 1GB

0 comments on commit e165a89

Please sign in to comment.