feat: adiciona payment processor
This commit is contained in:
parent
1047c9fc26
commit
1f0847569d
96
payment-processor/docker-compose-arm64.yml
Normal file
96
payment-processor/docker-compose-arm64.yml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
x-service-templates:
|
||||||
|
payment-processor: &payment-processor
|
||||||
|
image: zanfranceschi/payment-processor:arm64-20250807221836
|
||||||
|
networks:
|
||||||
|
- payment-processor
|
||||||
|
- payment-processor-db
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
delay: 2s
|
||||||
|
max_attempts: 10
|
||||||
|
window: 5s
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1.5"
|
||||||
|
memory: "100MB"
|
||||||
|
|
||||||
|
payment-processor-db: &payment-processor-db
|
||||||
|
image: postgres:17-alpine
|
||||||
|
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0
|
||||||
|
networks:
|
||||||
|
- payment-processor-db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_DB=rinha
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
delay: 2s
|
||||||
|
max_attempts: 10
|
||||||
|
window: 5s
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1.5"
|
||||||
|
memory: "250MB"
|
||||||
|
|
||||||
|
services:
|
||||||
|
payment-processor-1:
|
||||||
|
<<: *payment-processor
|
||||||
|
container_name: payment-processor-default
|
||||||
|
hostname: payment-processor-default
|
||||||
|
environment:
|
||||||
|
- TRANSACTION_FEE=0.05
|
||||||
|
- RATE_LIMIT_SECONDS=5
|
||||||
|
- INITIAL_TOKEN=123
|
||||||
|
- DB_CONNECTION_STRING=Host=/var/run/postgresql;Port=5432;Database=rinha;Username=postgres;Password=postgres;Minimum Pool Size=15;Maximum Pool Size=20;Connection Pruning Interval=3
|
||||||
|
ports:
|
||||||
|
- 8001:8080
|
||||||
|
volumes:
|
||||||
|
- postgres-socket-01:/var/run/postgresql
|
||||||
|
depends_on:
|
||||||
|
- payment-processor-db-1
|
||||||
|
|
||||||
|
payment-processor-db-1:
|
||||||
|
<<: *payment-processor-db
|
||||||
|
container_name: payment-processor-default-db
|
||||||
|
hostname: payment-processor-default-db
|
||||||
|
volumes:
|
||||||
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
- postgres-socket-01:/var/run/postgresql
|
||||||
|
|
||||||
|
payment-processor-2:
|
||||||
|
<<: *payment-processor
|
||||||
|
container_name: payment-processor-fallback
|
||||||
|
hostname: payment-processor-fallback
|
||||||
|
environment:
|
||||||
|
- TRANSACTION_FEE=0.15
|
||||||
|
- RATE_LIMIT_SECONDS=5
|
||||||
|
- INITIAL_TOKEN=123
|
||||||
|
- DB_CONNECTION_STRING=Host=/var/run/postgresql;Port=5432;Database=rinha;Username=postgres;Password=postgres;Minimum Pool Size=15;Maximum Pool Size=20;Connection Pruning Interval=3
|
||||||
|
ports:
|
||||||
|
- 8002:8080
|
||||||
|
volumes:
|
||||||
|
- postgres-socket-02:/var/run/postgresql
|
||||||
|
depends_on:
|
||||||
|
- payment-processor-db-2
|
||||||
|
|
||||||
|
payment-processor-db-2:
|
||||||
|
<<: *payment-processor-db
|
||||||
|
container_name: payment-processor-fallback-db
|
||||||
|
hostname: payment-processor-fallback-db
|
||||||
|
volumes:
|
||||||
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
- postgres-socket-02:/var/run/postgresql
|
||||||
|
|
||||||
|
networks:
|
||||||
|
payment-processor:
|
||||||
|
name: payment-processor
|
||||||
|
driver: bridge
|
||||||
|
payment-processor-db:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-socket-01:
|
||||||
|
postgres-socket-02:
|
||||||
96
payment-processor/docker-compose.yml
Normal file
96
payment-processor/docker-compose.yml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
x-service-templates:
|
||||||
|
payment-processor: &payment-processor
|
||||||
|
image: zanfranceschi/payment-processor:amd64-20250807222453
|
||||||
|
networks:
|
||||||
|
- payment-processor
|
||||||
|
- payment-processor-db
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
delay: 2s
|
||||||
|
max_attempts: 10
|
||||||
|
window: 5s
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1.5"
|
||||||
|
memory: "100MB"
|
||||||
|
|
||||||
|
payment-processor-db: &payment-processor-db
|
||||||
|
image: postgres:17-alpine
|
||||||
|
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0
|
||||||
|
networks:
|
||||||
|
- payment-processor-db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_DB=rinha
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
delay: 2s
|
||||||
|
max_attempts: 10
|
||||||
|
window: 5s
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1.5"
|
||||||
|
memory: "250MB"
|
||||||
|
|
||||||
|
services:
|
||||||
|
payment-processor-1:
|
||||||
|
<<: *payment-processor
|
||||||
|
container_name: payment-processor-default
|
||||||
|
hostname: payment-processor-default
|
||||||
|
environment:
|
||||||
|
- TRANSACTION_FEE=0.05
|
||||||
|
- RATE_LIMIT_SECONDS=5
|
||||||
|
- INITIAL_TOKEN=123
|
||||||
|
- DB_CONNECTION_STRING=Host=/var/run/postgresql;Port=5432;Database=rinha;Username=postgres;Password=postgres;Minimum Pool Size=15;Maximum Pool Size=20;Connection Pruning Interval=3
|
||||||
|
ports:
|
||||||
|
- 8001:8080
|
||||||
|
volumes:
|
||||||
|
- postgres-socket-01:/var/run/postgresql
|
||||||
|
depends_on:
|
||||||
|
- payment-processor-db-1
|
||||||
|
|
||||||
|
payment-processor-db-1:
|
||||||
|
<<: *payment-processor-db
|
||||||
|
container_name: payment-processor-default-db
|
||||||
|
hostname: payment-processor-default-db
|
||||||
|
volumes:
|
||||||
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
- postgres-socket-01:/var/run/postgresql
|
||||||
|
|
||||||
|
payment-processor-2:
|
||||||
|
<<: *payment-processor
|
||||||
|
container_name: payment-processor-fallback
|
||||||
|
hostname: payment-processor-fallback
|
||||||
|
environment:
|
||||||
|
- TRANSACTION_FEE=0.15
|
||||||
|
- RATE_LIMIT_SECONDS=5
|
||||||
|
- INITIAL_TOKEN=123
|
||||||
|
- DB_CONNECTION_STRING=Host=/var/run/postgresql;Port=5432;Database=rinha;Username=postgres;Password=postgres;Minimum Pool Size=15;Maximum Pool Size=20;Connection Pruning Interval=3
|
||||||
|
ports:
|
||||||
|
- 8002:8080
|
||||||
|
volumes:
|
||||||
|
- postgres-socket-02:/var/run/postgresql
|
||||||
|
depends_on:
|
||||||
|
- payment-processor-db-2
|
||||||
|
|
||||||
|
payment-processor-db-2:
|
||||||
|
<<: *payment-processor-db
|
||||||
|
container_name: payment-processor-fallback-db
|
||||||
|
hostname: payment-processor-fallback-db
|
||||||
|
volumes:
|
||||||
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
- postgres-socket-02:/var/run/postgresql
|
||||||
|
|
||||||
|
networks:
|
||||||
|
payment-processor:
|
||||||
|
name: payment-processor
|
||||||
|
driver: bridge
|
||||||
|
payment-processor-db:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-socket-01:
|
||||||
|
postgres-socket-02:
|
||||||
8
payment-processor/init.sql
Normal file
8
payment-processor/init.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
CREATE UNLOGGED TABLE payments (
|
||||||
|
correlationId UUID PRIMARY KEY,
|
||||||
|
amount DECIMAL NOT NULL,
|
||||||
|
requested_at TIMESTAMP NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX payments_requested_at ON payments (requested_at);
|
||||||
Loading…
x
Reference in New Issue
Block a user