-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from giggio/gb
Adiciona Giovanni
- Loading branch information
Showing
4 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |