From 7555cfc8a3167273f9798d6ef62ce36e696edf49 Mon Sep 17 00:00:00 2001 From: Misha Merkushin Date: Mon, 11 Nov 2019 15:19:41 +0300 Subject: [PATCH] chore: run rpc servers behind proxy --- config/anycable_nginx.conf | 16 ++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 config/anycable_nginx.conf diff --git a/config/anycable_nginx.conf b/config/anycable_nginx.conf new file mode 100644 index 0000000..fa6cb1e --- /dev/null +++ b/config/anycable_nginx.conf @@ -0,0 +1,16 @@ +upstream grpcservers { + server anycable-rpc-one:50051; + server anycable-rpc-two:50051; +} + +server { + listen 50051 http2; + server_name localhost; + + access_log /var/log/nginx/grpc_log.json; + error_log /var/log/nginx/grpc_error_log.json debug; + + location / { + grpc_pass grpc://grpcservers; + } +} diff --git a/docker-compose.yml b/docker-compose.yml index ee98a08..7def012 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,6 +88,23 @@ services: - redis anycable-rpc: + image: nginx:1.17.3-alpine + volumes: + - ./log:/var/log/nginx + - ./config/anycable_nginx.conf:/etc/nginx/conf.d/anycable.conf + ports: + - '50051' + depends_on: + - anycable-rpc-one + - anycable-rpc-two + + anycable-rpc-one: + <<: *backend + command: bundle exec anycable + ports: + - '50051' + + anycable-rpc-two: <<: *backend command: bundle exec anycable ports: