Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions deployment/app-pgsql/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ services:
- gqueue
- observability

nginx:
image: nginx:alpine
ports:
- 8080:80
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
backoffice:
condition: service_started
pubsub:
condition: service_started
task:
condition: service_started
networks:
- app-network
deploy:
resources:
limits:
cpus: "0.5"
memory: 128M
reservations:
cpus: "0.1"
memory: 64M
profiles:
- complete
- gqueue
- observability

redis:
image: redis:latest
ports:
Expand Down
58 changes: 58 additions & 0 deletions deployment/app-pgsql/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;

sendfile on;
keepalive_timeout 65;
types_hash_max_size 2048;

limit_req_zone $binary_remote_addr zone=api:10m rate=2000r/s;

server {
listen 80;
server_name _;
client_max_body_size 1m;

# Common proxy settings (inherited by locations); path is passed through unchanged
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;

# Prefix routing: most specific first. No path rewrite — backend receives full URI.
location /api/v1/pubsub {
limit_req zone=api burst=1000 nodelay;
proxy_pass http://pubsub:8082;
}

location /api/v1/task {
limit_req zone=api burst=1000 nodelay;
proxy_pass http://task:8083;
}

location /api/v1/ {
limit_req zone=api burst=1000 nodelay;
proxy_pass http://backoffice:8081;
}

location / {
return 404;
}
}
}
10 changes: 5 additions & 5 deletions example/example.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Example create or update event

curl -X PATCH \
http://localhost:8081/api/v1/event/consumer \
http://localhost:8080/api/v1/event/consumer \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
Expand All @@ -11,11 +11,11 @@ curl -X PATCH \

curl -X GET \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
http://localhost:8081/api/v1/events/payment.charged1 | jq
http://localhost:8080/api/v1/events/payment.charged1 | jq

curl -X GET \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
http://localhost:8081/api/v1/events
http://localhost:8080/api/v1/events

curl -X GET \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
Expand All @@ -24,13 +24,13 @@ curl -X GET \
### Publisher data

curl -X POST \
http://localhost:8082/api/v1/pubsub \
http://localhost:8080/api/v1/pubsub \
-H "Content-Type: application/json" \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
-d @example/pubsub_event_payload.json

curl -X POST \
http://localhost:8083/api/v1/task \
http://localhost:8080/api/v1/task \
-H "Content-Type: application/json" \
-H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
-d @example/task_event_payload.json
Expand Down
2 changes: 1 addition & 1 deletion example/simulation/multiples_producer_pubsub.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

URL="http://localhost:8082/api/v1/pubsub"
URL="http://localhost:8080/api/v1/pubsub"
AUTH="Basic YWRtaW46cGFzc3dvcmQ="
DATA_FILE="example/pubsub_event_payload.json"

Expand Down
2 changes: 1 addition & 1 deletion example/simulation/multiples_producer_task.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

URL="http://localhost:8083/api/v1/task"
URL="http://localhost:8080/api/v1/task"
AUTH="Basic YWRtaW46cGFzc3dvcmQ="
DATA_FILE="example/task_event_payload.json"

Expand Down