Skip to content

Commit

Permalink
Add safe events service docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 committed Oct 3, 2023
1 parent fa337c8 commit d0709c7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
9 changes: 9 additions & 0 deletions container_env_files/evs.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DATABASE_URL=psql://postgres:postgres@evs-db:5432/postgres
AMQP_URL=amqp://general-rabbitmq:5672
AMQP_EXCHANGE=safe-transaction-service-events
AMQP_QUEUE=safe-events-service
ADMIN_EMAIL=admin@safe
ADMIN_PASSWORD=password
WEBHOOKS_CACHE_TTL=300000
NODE_ENV=production
URL_BASE_PATH=/evs
31 changes: 30 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.8"
volumes:
nginx-shared-txs:
nginx-shared-cfg:

x-healthcheck-db-template: &pghealthcheck
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down Expand Up @@ -32,6 +32,7 @@ services:
- txs-web
- cfg-web
- cgw-web
- evs-web

txs-db:
image: postgres:14-alpine
Expand All @@ -49,6 +50,14 @@ services:
- ./data/cfg-db:/var/lib/postgresql/data
<<: *pghealthcheck

evs-db:
image: postgres:14-alpine
environment:
POSTGRES_PASSWORD: postgres
volumes:
- ./data/evs-db:/var/lib/postgresql/data
<<: *pghealthcheck

# Safe Transaction Service
txs-redis:
image: redis:alpine
Expand Down Expand Up @@ -152,3 +161,23 @@ services:
- nginx
ports:
- "${REVERSE_PROXY_UI_PORT}:8080"


general-rabbitmq:
image: rabbitmq:alpine
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 15s
timeout: 30s
retries: 3
start_period: 15s

evs-web:
image: docker.io/library/safe-events-service-web
env_file:
- container_env_files/evs.env
depends_on:
evs-db:
condition: service_healthy
general-rabbitmq:
condition: service_healthy
24 changes: 24 additions & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ http {
keepalive 32;
}

upstream evs_app_server {
ip_hash; # For load-balancing
server evs-web:3000 fail_timeout=0;
#
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
keepalive 32;
}

server {
access_log off;
listen 8000 deferred;
Expand Down Expand Up @@ -120,6 +129,21 @@ http {
proxy_redirect off;
proxy_pass http://cgw_app_server/;

proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header Front-End-Https on;
}

## Events service mounting point
location /evs/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://evs_app_server/evs/;

proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header Front-End-Https on;
Expand Down

0 comments on commit d0709c7

Please sign in to comment.