diff --git a/docker/.env b/docker/.env index 1970b210b8..79b9cc0edd 100644 --- a/docker/.env +++ b/docker/.env @@ -8,6 +8,8 @@ MF_NGINX_MQTTS_PORT=8883 ## Nats MF_NATS_PORT=4222 +MF_NATS_HTTP_PORT=8222 +MF_NATS_JETSTREAM_KEY=u7wFoAPgXpDueXOFldBnXDh4xjnSOyEJ2Cb8Z5SZvGLzIZ3U4exWhhoIBZHzuNvh MF_NATS_URL=nats://broker:${MF_NATS_PORT} ## RabbitMQ diff --git a/docker/brokers/nats.yml b/docker/brokers/nats.yml index f2a53d9732..4c8e2fd2f9 100644 --- a/docker/brokers/nats.yml +++ b/docker/brokers/nats.yml @@ -1,8 +1,13 @@ services: broker: - image: nats:2.2.4-alpine - command: "-c /etc/nats/nats.conf -DV" + image: nats:2.9.21-alpine + command: "--config=/etc/nats/nats.conf" volumes: - ./../nats/:/etc/nats + environment: + - MF_NATS_PORT=${MF_NATS_PORT} + - MF_NATS_HTTP_PORT=${MF_NATS_HTTP_PORT} + - MF_NATS_JETSTREAM_KEY=${MF_NATS_JETSTREAM_KEY} ports: - ${MF_NATS_PORT}:${MF_NATS_PORT} + - ${MF_NATS_HTTP_PORT}:${MF_NATS_HTTP_PORT} diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index ab21694ba8..b6e27d11da 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -13,7 +13,7 @@ volumes: mainflux-things-redis-volume: mainflux-es-redis-volume: mainflux-mqtt-broker-volume: - + mainflux-broker-volume: services: nginx: @@ -53,8 +53,8 @@ services: restart: on-failure networks: - mainflux-base-net - ports: - - 4222:4222 + volumes: + - mainflux-broker-volume:/data things-db: image: postgres:13.3-alpine diff --git a/docker/nats/nats.conf b/docker/nats/nats.conf index 6f2b26f864..ffbb4c615c 100644 --- a/docker/nats/nats.conf +++ b/docker/nats/nats.conf @@ -1,2 +1,12 @@ -# maximum payload -max_payload: 268435456 +max_payload: 1MB +max_connections: 1M +port: $MF_NATS_PORT +http_port: $MF_NATS_HTTP_PORT +trace: true + +jetstream { + store_dir: "/data" + cipher: "aes" + key: $MF_NATS_JETSTREAM_KEY + max_mem: 1G +}