Skip to content

The ResIOT team created a single, fully configurable image for ResIOT LoRaWAN Network Server & IoT Platform, the name is resiot/resiot:1000020

note 1: at each reboot the resiot/resiot:1000020 image proceeds with automatic updating to the latest version available
note 2: at the first start, wait a couple of minutes to allow time to perform all the necessary configurations

Docker Stack Multi Instance Basic Example with LoRaWAN Gateway connected via UDP

This example allows you to create an example deployment with 3 ResIOT instances in HA with Docker stack
In this example we have:
IP of the server to be reached from the outside and from the gateways:
Tcp port to access the platform via web: 58089
ResIOT Platform access address is:
Tcp port for Grpc protocol: 58096
Grpc host for gateway connection:
Udp port for gateway connection: 57678
persistent volume folders to backup: ./resiotdata , ./rdbdata , ./dbdata
persistent volume for use by ResIOT for automatic updates and files that do not need to be backed up: ./resiotupdfld

remember to open the firewall ports:
58089 TCP
58096 TCP
57678 UDP

this example includes two files docker-compose-stack.yaml and nginx.conf to be created in the same folder
follow the next three step

Step 1 - contents of docker-compose-stack.yaml file:

version: "3.2"
     image: postgres:12.5-alpine
       - ./dbdata:/var/lib/postgresql/data
     restart: always
       POSTGRES_USER: resiotdb
       POSTGRES_PASSWORD: yourpasswordtest
       POSTGRES_DB: resiotcore
       PGDATA: /var/lib/postgresql/data/pgdata
     image: redis:5.0.10-alpine
       - ./rdbdata:/data
     restart: always
     image: eclipse-mosquitto
     restart: always
       - dbresiot
       - mqtt
       - rdb
     image: resiot/resiot:1000020
       replicas: 3
       - "8088"
       - "8095"
       - "7677/udp"
       - ./resiotupdfld:/run
       - ./resiotdata:/data
     restart: always
       NO_LNS: "n"
       NO_PLA: "n"
       RESIOT_DB_TYPE: postgres
       RESIOT_DB_URL: postgres://resiotdb:yourpasswordtest@dbresiot:5432/resiotcore?sslmode=disable
       RESIOT_REDIS_URL: redis://rdb:6379
       RESIOT_MQTT_URL: tcp://mqtt:1883
       RESIOT_LORA_BAND: EU_863_870
     image: nginx:latest
       - ./nginx.conf:/etc/nginx/nginx.conf:ro
       - resiot
       - "58089:58089"
       - "58096:58096"
       - "57678:57678/udp"

Step 2 - contents of nginx.conf file:

user  nginx;
events {
    worker_connections   1000;
http {
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    upstream resiottcp_8088_backend {
        server resiot:8088;
    server {
        listen 58089;
        location / {
                        proxy_pass http://resiottcp_8088_backend;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection $connection_upgrade;
                        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 http;
                        proxy_read_timeout 36000s;
                        proxy_redirect off;
    server {
        listen 58096 http2;
        location / {
                        grpc_pass grpc://resiot:8095;
stream {
    upstream resiotudp_7677_backend {
        server resiot:7677;
    server {
        listen 57678 udp;
        proxy_pass resiotudp_7677_backend;

Step 3 - Docker stack deployment

# in the folder where the docker-compose-stack.yaml and nginx.conf files are present i create the folders dbdata,rdbdata,resiotdata and resiotupdfld
# example for linux:
sudo mkdir dbdata ; sudo mkdir rdbdata ; sudo mkdir resiotdata ; sudo mkdir resiotupdfld

# docker stack deploy with name stack0001
sudo docker stack deploy --compose-file docker-compose-stack.yaml stack0001

(you can also use docker-compose with sudo docker-compose --compatibility up
for testing but without replication because on a machine it is not managed correctly as in particular configurations all the instances restart simultaneously losing the condition of ha)

# now visit after two/three minutes

# Other commands:
# see active services
sudo docker stack services stack0001

# to see the logs
sudo docker service logs stack0001_resiot
sudo docker service logs stack0001_nginx
sudo docker service logs stack0001_dbresiot
sudo docker service logs stack0001_mqtt
sudo docker service logs stack0001_rdb

# to delete
sudo docker stack rm stack0001
sudo rm -rf dbdata ; sudo rm -rf rdbdata ; sudo rm -rf resiotdata ; sudo rm -rf resiotupdfld