From 0c7f5a2b2af9db2cad09c4e72c4f65d748cf1c18 Mon Sep 17 00:00:00 2001 From: Alexander Palchikov Date: Mon, 17 May 2021 23:42:35 +0500 Subject: [PATCH] nats messaging system --- .env.example | 5 +++++ docker-compose.yml | 9 +++++++++ nats/Dockerfile | 5 +++++ nats/nats-server.conf | 25 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 nats/Dockerfile create mode 100644 nats/nats-server.conf diff --git a/.env.example b/.env.example index 13bc982d..13b7ae8a 100644 --- a/.env.example +++ b/.env.example @@ -1003,3 +1003,8 @@ ELK_VERSION=7.9.1 ### Tarantool ################################################## TARANTOOL_PORT=3301 TARANTOOL_ADMIN_PORT=8002 + +### NATS ################################################## +NATS_CLIENT_PORT=4222 +NATS_MONITORING_PORT=6222 +NATS_ROUTE_PORT=8222 diff --git a/docker-compose.yml b/docker-compose.yml index 62c3bcf5..e6804ef6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -612,6 +612,15 @@ services: image: 'neo4j:latest' networks: - backend +### Nats ################################################ + nats: + build: ./nats + ports: + - "${NATS_CLIENT_PORT}:4222" + - "${NATS_MONITORING_PORT}:6222" + - "${NATS_ROUTE_PORT}:8222" + networks: + - backend ### MongoDB ############################################## mongo: diff --git a/nats/Dockerfile b/nats/Dockerfile new file mode 100644 index 00000000..9e381b2f --- /dev/null +++ b/nats/Dockerfile @@ -0,0 +1,5 @@ +FROM nats:latest + +LABEL maintainer="Alexander Palchikov " + +COPY nats-server.conf /etc/nats/nats-server.conf \ No newline at end of file diff --git a/nats/nats-server.conf b/nats/nats-server.conf new file mode 100644 index 00000000..cac772b0 --- /dev/null +++ b/nats/nats-server.conf @@ -0,0 +1,25 @@ +# Client port of 4222 on all interfaces +port: 4222 + +# HTTP monitoring port +monitor_port: 8222 + +# This is for clustering multiple servers together. +cluster { + + # Route connections to be received on any interface on port 6222 + port: 6222 + + # Routes are protected, so need to use them with --routes flag + # e.g. --routes=nats-route://ruser:T0pS3cr3t@otherdockerhost:6222 + authorization { + user: ruser + password: T0pS3cr3t + timeout: 2 + } + + # Routes are actively solicited and connected to from this server. + # This Docker image has none by default, but you can pass a + # flag to the gnatsd docker image to create one to an existing server. + routes = [] +} \ No newline at end of file