From 464ca7827fc4418bf95080456e238a32fc3c878b Mon Sep 17 00:00:00 2001 From: Farukh Khan Date: Fri, 11 Aug 2023 18:48:25 +0800 Subject: [PATCH] NET-517 * 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. --- compose/docker-compose-emqx.yml | 19 ++++++++++++++----- compose/docker-compose.yml | 5 ++++- scripts/netmaker.default.env | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/compose/docker-compose-emqx.yml b/compose/docker-compose-emqx.yml index 861e0693d..61dabf08e 100644 --- a/compose/docker-compose-emqx.yml +++ b/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 diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index e7b5db1f5..d17275291 100644 --- a/compose/docker-compose.yml +++ b/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 diff --git a/scripts/netmaker.default.env b/scripts/netmaker.default.env index 799df19f7..e714c19a1 100644 --- a/scripts/netmaker.default.env +++ b/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