Skip to content

Commit

Permalink
Merge pull request #79 from opencodeco/main
Browse files Browse the repository at this point in the history
Participação da OpenCodeCo com Swoole & Hyperf na Rinha
  • Loading branch information
zanfranceschi committed Aug 21, 2023
2 parents d661d04 + 4f8f3e3 commit cfe2b1d
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
5 changes: 5 additions & 0 deletions participantes/OpenCodeCo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Swoole & Hyperf

- GitHub: [@opencodeco](https://github.com/opencodeco)
- Twitter: [@opencodeco](https://github.com/opencodeco)
- Repositório: [github.com/opencodeco/rinha-de-backend-2023-q3](https://github.com/opencodeco/rinha-de-backend-2023-q3) (branch `dev`)
55 changes: 55 additions & 0 deletions participantes/OpenCodeCo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3.5'
services:
api1: &api
image: opencodeco/rinha-de-backend:2023-q3
environment:
DB_HOST: db
DB_DATABASE: rinha
DB_USERNAME: root
DB_PASSWORD: rinha
REDIS_HOST: cache
depends_on:
- db
- cache
deploy:
resources:
limits:
cpus: '0.25'
memory: '0.7GB'

api2:
<<: *api

db:
image: mysql:8.1
command: --default-authentication-plugin=mysql_native_password
volumes:
- ./migrations.sql:/docker-entrypoint-initdb.d/migrations.sql
environment:
MYSQL_ROOT_PASSWORD: rinha
MYSQL_DATABASE: rinha

cache:
image: redis:7.2
ports:
- '6379:6379'
deploy:
resources:
limits:
cpus: '0.1'
memory: '0.5GB'

nginx:
image: nginx:1.25
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ports:
- 9999:9999
deploy:
resources:
limits:
cpus: '0.25'
memory: '0.1GB'
8 changes: 8 additions & 0 deletions participantes/OpenCodeCo/migrations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
create table person(
id varchar(36) primary key unique,
nick varchar(32) not null,
name varchar(100) not null,
searchable longtext not null,
birth date not null,
stack json
);
27 changes: 27 additions & 0 deletions participantes/OpenCodeCo/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
worker_processes auto;

events {
worker_connections 4096;
}

http {
access_log off;
#proxy_cache_path /tmp/cache keys_zone=cacherinha:100m max_size=1G use_temp_path=off;
#proxy_cache_valid any 15s;

upstream api {
server api1:9501;
server api2:9501;
}

server {
listen 9999;

location / {
proxy_pass http://api;

#proxy_cache cacherinha;
#proxy_cache_background_update on;
}
}
}

0 comments on commit cfe2b1d

Please sign in to comment.