Browse Source

NET-517 (#2510)

* Fixed emqx docker compose file syntax and added volumes for persistence.

* Added helper comments for docker-compose.yml and netmaker.env files to enable emqx broker support.
Farukh Khan 2 years ago
parent
commit
185728ad71
3 changed files with 19 additions and 7 deletions
  1. 14 5
      compose/docker-compose-emqx.yml
  2. 4 1
      compose/docker-compose.yml
  3. 1 1
      scripts/netmaker.default.env

+ 14 - 5
compose/docker-compose-emqx.yml

@@ -4,14 +4,23 @@ services:
   mq:
     container_name: mq
     image: emqx/emqx:5.0.9
+    env_file: ./netmaker.env
     restart: unless-stopped
     environment:
-      - EMQX_NAME: "emqx"
+      - EMQX_NAME=emqx
       - EMQX_DASHBOARD__DEFAULT_PASSWORD=${MQ_PASSWORD}
       - EMQX_DASHBOARD__DEFAULT_USERNAME=${MQ_USERNAME}
     ports:
-      - "1883:1883" # MQTT
-      - "8883:8883" # SSL MQTT
-      - "8083:8083" # Websockets
+      - "1883:1883"   # MQTT
+      - "8883:8883"   # SSL MQTT
+      - "8083:8083"   # Websockets
+      - "8084:8084"   # SSL Websockets
       - "18083:18083" # Dashboard/REST_API
-
+    volumes:
+      - emqx_data:/opt/emqx/data
+      - emqx_etc:/opt/emqx/etc
+      - emqx_logs:/opt/emqx/log
+volumes:
+  emqx_data: { } # storage for emqx data
+  emqx_etc: { }  # storage for emqx etc
+  emqx_logs: { } # storage for emqx logs

+ 4 - 1
compose/docker-compose.yml

@@ -14,7 +14,10 @@ services:
       # config-dependant vars
       - STUN_LIST=stun1.netmaker.io:3478,stun2.netmaker.io:3478,stun1.l.google.com:19302,stun2.l.google.com:19302
       # The domain/host IP indicating the mq broker address
-      - BROKER_ENDPOINT=wss://broker.${NM_DOMAIN}
+      - BROKER_ENDPOINT=wss://broker.${NM_DOMAIN} # For EMQX broker use `BROKER_ENDPOINT=wss://broker.${NM_DOMAIN}/mqtt`
+      # For EMQX broker (uncomment the two lines below)
+      #- BROKER_TYPE=emqx
+      #- EMQX_REST_ENDPOINT=http://mq:18083
       # The base domain of netmaker
       - SERVER_NAME=${NM_DOMAIN}
       - SERVER_API_CONN_STRING=api.${NM_DOMAIN}:443

+ 1 - 1
scripts/netmaker.default.env

@@ -41,7 +41,7 @@ DISPLAY_KEYS="on"
 DATABASE="sqlite"
 # The address of the mq server. If running from docker compose it will be "mq". Otherwise, need to input address.
 # If using "host networking", it will find and detect the IP of the mq container.
-SERVER_BROKER_ENDPOINT="ws://mq:1883"
+SERVER_BROKER_ENDPOINT="ws://mq:1883" # For EMQX websockets use `SERVER_BROKER_ENDPOINT=ws://mq:8083/mqtt`
 # The reachable port of STUN on the server
 STUN_PORT="3478"
 # Logging verbosity level - 1, 2, or 3