diff --git a/pom.xml b/pom.xml
index 4e24f20..e90188d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
dev.quarkusclub
rinha-de-backend-bank
- 1.0.1
+ 1.0.2
3.12.1
21
diff --git a/quarkusclub/docker-compose.yml b/quarkusclub/docker-compose.yml
index 437a6ae..ac58a06 100644
--- a/quarkusclub/docker-compose.yml
+++ b/quarkusclub/docker-compose.yml
@@ -6,7 +6,7 @@ services:
#image: luizpais/rinha-de-backend-bank:1.0.1
hostname: api01
environment:
- - DB_URL=vertx-reactive:postgresql://127.0.0.1:5432/dbrinha
+ - DB_URL=vertx-reactive:postgresql://db:5432/dbrinha
- DB_USER_NAME=rinha
- DB_PASSWORD=backend
- DB_REACTIVE_MAX=10
@@ -14,7 +14,7 @@ services:
- SERVER_PORT=8088
ports:
- "8088:8088"
- network_mode: host
+# network_mode: host
depends_on:
db:
condition: service_healthy
@@ -29,7 +29,7 @@ services:
<<: *api
hostname: api02
environment:
- - DB_URL=vertx-reactive:postgresql://127.0.0.1:5432/dbrinha
+ - DB_URL=vertx-reactive:postgresql://db:5432/dbrinha
- DB_USER_NAME=rinha
- DB_PASSWORD=backend
- DB_REACTIVE_MAX=10
@@ -37,7 +37,7 @@ services:
- SERVER_PORT=8089
ports:
- "8089:8089"
- network_mode: host
+# network_mode: host
nginx:
image: nginx:latest
@@ -49,7 +49,7 @@ services:
ports:
# Obrigatório expor/usar a porta 9999 no load balancer!
- "9999:9999"
- network_mode: host
+# network_mode: host
deploy:
resources:
limits:
@@ -65,7 +65,7 @@ services:
- POSTGRES_DB=dbrinha
ports:
- "5432:5432"
- network_mode: host
+ #network_mode: host
volumes:
- ./sql/script.sql:/docker-entrypoint-initdb.d/script.sql
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c full_page_writes=0
@@ -80,7 +80,7 @@ services:
timeout: 5s
retries: 20
start_period: 10s
-#networks:
-# default:
-# driver: bridge
-# name: rinha-nginx-2024q1
+networks:
+ default:
+ driver: bridge
+ name: rinha-nginx-2024q1
diff --git a/quarkusclub/extrato b/quarkusclub/extrato
new file mode 100644
index 0000000..802d20b
--- /dev/null
+++ b/quarkusclub/extrato
@@ -0,0 +1 @@
+{"saldo":{"total":0,"data_extrato":"2024-02-24T22:43:21.471984","limite":100000},"ultimas_transacoes":[]}
\ No newline at end of file
diff --git a/quarkusclub/nginx.conf b/quarkusclub/nginx.conf
index 05260a9..6ddaf56 100644
--- a/quarkusclub/nginx.conf
+++ b/quarkusclub/nginx.conf
@@ -4,13 +4,13 @@ events {
}
http {
- access_log on ;
+ access_log on;
sendfile on;
upstream api {
least_conn;
- server 127.0.0.1:8088;
- server 127.0.0.1:8089;
+ server api01:8088;
+ server api02:8089;
}
server {
diff --git a/run/docker-compose.yml b/run/docker-compose.yml
deleted file mode 100644
index 0277928..0000000
--- a/run/docker-compose.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-version: "3.5"
-
-services:
- api01: &api
- image: docker.io/rinha/rinha-de-backend-bank:latest
- environment:
- - quarkus.datasource.reactive.url=vertx-reactive:postgresql://localhost:5432/dbrinha
- - quarkus.datasource.username=rinha
- - quarkus.datasource.password=backend
- - quarkus.datasource.reactive.max-size=10
- - quarkus.log.level=OFF
- - quarkus.http.port=8081
- network_mode: "host"
- depends_on:
- - db
- deploy:
- resources:
- limits:
- cpus: "0.45"
- memory: "100MB"
-
- api02:
- # Essa sintaxe reusa o que foi declarado em 'api01'.
- <<: *api
- environment:
- - quarkus.datasource.reactive.url=vertx-reactive:postgresql://localhost:5432/dbrinha
- - quarkus.datasource.username=rinha
- - quarkus.datasource.password=backend
- - quarkus.datasource.reactive.max-size=10
- - quarkus.log.level=OFF
- - quarkus.http.port=8082
-
- nginx:
- image: nginx:latest
- network_mode: "host"
- volumes:
- - ./nginx.conf:/etc/nginx/nginx.conf:ro
- depends_on:
- - api01
- - api02
- deploy:
- resources:
- limits:
- cpus: "0.20"
- memory: "20MB"
-
- db:
- image: postgres:latest
- network_mode: "host"
- environment:
- - POSTGRES_PASSWORD=backend
- - POSTGRES_USER=rinha
- - POSTGRES_DB=dbrinha
- volumes:
- - ./script.sql:/docker-entrypoint-initdb.d/script.sql
- command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c full_page_writes=0
- deploy:
- resources:
- limits:
- cpus: "0.4"
- memory: "200MB"
diff --git a/run/nginx.conf b/run/nginx.conf
deleted file mode 100644
index 2b4ef31..0000000
--- a/run/nginx.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-events {
- use epoll;
- worker_connections 1024;
-}
-
-http {
- access_log off;
- sendfile on;
-
- upstream api {
- least_conn;
- server localhost:8081;
- server localhost:8082;
- }
-
- server {
- listen 9999; # Lembra da porta 9999 obrigatória?
-
- location / {
- proxy_pass http://api;
- }
- }
-}
diff --git a/run/script.sql b/run/script.sql
deleted file mode 100644
index acaad02..0000000
--- a/run/script.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-
-create table public.contacorrente
-(
- id bigint not null primary key,
- limite bigint not null,
- saldo bigint not null,
- nome varchar(255)
-);
-
-create table public.movimento
-(
- datamovimento timestamp(6),
- id bigint not null primary key,
- idcliente bigint not null,
- valor bigint not null,
- descricao varchar(255),
- tipo varchar(255)
-);
-
-create sequence public.contacorrente_seq increment by 1;
-create sequence public.movimento_seq increment by 50;
-
-alter table public.movimento owner to rinha;
-alter table public.contacorrente owner to rinha;
-alter sequence public.contacorrente_seq owner to rinha;
-alter sequence public.movimento_seq owner to rinha;
-
-INSERT INTO public.contacorrente (id, nome, saldo, limite)
-VALUES (1, 'odorico paraguaçu', 0, 100000),
- (2, 'irmas cajazeira', 0, 80000),
- (3, 'coronel nepomuceno', 0, 1000000),
- (4, 'dirceu borboleta', 0, 10000000),
- (5, 'zeca diabo', 0, 500000);