Skip to content

Commit

Permalink
Merge pull request #228 from giggio/gb
Browse files Browse the repository at this point in the history
Adiciona Giovanni
  • Loading branch information
zanfranceschi authored Aug 23, 2023
2 parents 892a742 + ec814d9 commit 40ea046
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
3 changes: 3 additions & 0 deletions participantes/giovannibassi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Rinha App com ASP.NET 8 (Preview 7)

Veja mais no repo: <https://github.com/giggio/rinhagiggio>
24 changes: 24 additions & 0 deletions participantes/giovannibassi/ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
"MigrationId" character varying(150) NOT NULL,
"ProductVersion" character varying(32) NOT NULL,
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
);

START TRANSACTION;

CREATE TABLE "Pessoas" (
"Id" uuid NOT NULL,
"Apelido" character varying(32) NOT NULL,
"Nome" character varying(100) NOT NULL,
"Nascimento" date NOT NULL,
"Stack" text[],
CONSTRAINT "PK_Pessoas" PRIMARY KEY ("Id")
);

CREATE UNIQUE INDEX "IX_Pessoas_Apelido" ON "Pessoas" ("Apelido");

INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
VALUES ('20230823002823_First', '8.0.0-preview.7.23375.4');

COMMIT;

101 changes: 101 additions & 0 deletions participantes/giovannibassi/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
version: '3.9'
name: 'rinha-giovannibassi'

services:
api1:
image: giggio/rinhabackend-2023-q3
hostname: api1
environment:
- ConnectionStrings__Rinha=Host=db;Database=rinha;Username=rinha;Password=rinha
depends_on:
db:
condition: service_healthy
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.5'
memory: '960MB'
networks:
- app-network
healthcheck:
test: curl -o /dev/null -fs --retry 0 --head http://localhost:5000/healthz || exit 1
interval: 10s
retries: 3
start_period: 5s
timeout: 2s

api2:
image: giggio/rinhabackend-2023-q3
hostname: api2
environment:
- ConnectionStrings__Rinha=Host=db;Database=rinha;Username=rinha;Password=rinha
depends_on:
db:
condition: service_healthy
ulimits:
nofile:
soft: 1000000
hard: 1000000
deploy:
resources:
limits:
cpus: '0.5'
memory: '960MB'
networks:
- app-network
healthcheck:
test: curl -o /dev/null -fs --retry 0 --head http://localhost:5000/healthz || exit 1
interval: 10s
retries: 3
start_period: 5s
timeout: 2s

nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- "9999:9999"
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.1'
memory: '128MB'

db:
image: postgres:latest
command: 'postgres -c max_connections=200 -c shared_buffers=256MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off'
hostname: db
environment:
- POSTGRES_PASSWORD=rinha
- POSTGRES_USER=rinha
- POSTGRES_DB=rinha
ports:
- "5432:5432"
volumes:
- ./ddl.sql:/docker-entrypoint-initdb.d/ddl.sql
deploy:
resources:
limits:
cpus: '0.4'
memory: '1GB'
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s

networks:
app-network:
21 changes: 21 additions & 0 deletions participantes/giovannibassi/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
events {
worker_connections 10000;
}
http {
access_log off;
error_log off;

upstream api {
least_conn;
server api1:5000;
server api2:5000;
}

server {
listen 9999;

location / {
proxy_pass http://api;
}
}
}

0 comments on commit 40ea046

Please sign in to comment.