Giter VIP home page Giter VIP logo

emqx-docker's Introduction

The code for this project has been migrated to emqx/emqx-rel and this project is no longer maintained

emqx-docker's People

Contributors

emqplus avatar fungiboletus avatar hacktohell avatar huangdan avatar je-al avatar leberkleber avatar raymondmouthaan avatar rory-z avatar spring2maz avatar terry-xiaoyu avatar tldzyx avatar vowstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emqx-docker's Issues

Let user specify network name for autoscaling in Docker Swarm

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

FEATURE REQUEST

Missing feature

Able to specify a network interface in env var, then start.sh or cluster.sh uses the specified network to resolve the default IP into $LOCAL_IP.

devOps should be able to dynamically allocate EMQ_HOST or EMQ_NODE__NAME in a deterministic way, since Docker services with multiple networks will attach interfaces in random order.

Justification

With multiple networks attached, the current way to get LOCAL_IP in start.sh is not deterministic; While IP is generated after the container is spawn.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

In short, no.

The overlay network address is load balanced and cannot resolve single nodes, individual nodes spawned need a way to resolve their own unique address correctly, especially when there are more than one interface and/or IP available.

emq_auth_mysql load fail : Got an error reading communication packets

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

Make a mariadb to connect EMQ, and make EMQ enable 'emq_auth_mysql' plugin

Actual behavior

error

load plugin error: {emq_auth_mysql,
                    {bad_return,
                     {{emq_auth_mysql_app,start,[normal,[]]},
                      {'EXIT',
                       {{badmatch,
                         {error,
                          {shutdown,
                           {failed_to_start_child,emq_auth_mysql,
                            {shutdown,
                             {failed_to_start_child,worker_sup,
                              {shutdown,
                               {failed_to_start_child,
                                {worker,1},
                                {{badmatch,{error,econnrefused}},
                                 [{mysql,init,1,
                                   [{file,"src/mysql.erl"},{line,484}]},
                                  {gen_server,init_it,6,
                                   [{file,"gen_server.erl"},{line,328}]},
                                  {proc_lib,init_p_do_apply,3,
                                   [{file,"proc_lib.erl"},
                                    {line,247}]}]}}}}}}}}},
                        [{emq_auth_mysql_app,start,2,
                          [{file,"src/emq_auth_mysql_app.erl"},{line,33}]},
                         {application_master,start_it_old,4,
                          [{file,"application_master.erl"},{line,273}]}]}}}}}

Test code

db schema ref EMQ supplier

version: "3.2"
services:
  mariadb:
    image: mariadb
    container_name: mariadb
    ports:
      - 6612:3306/tcp
    environment:
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - ./database/schema.sql:/docker-entrypoint-initdb.d/base_schema.sql
      
  mqtt_broker:
    image: emqttd:2.3-rc.2
    ports:
      - 18083:18083/tcp # dashboard
      - 1883:1883/tcp   # MQTT TCP port
      - 8883:8883/tcp   # MQTT TCP TLS/SSL port
      - 8083:8083/tcp   # HTTP and WebSocket port
      - 8084:8084/tcp   # HTTPS and WSS port
      - 8080:8080/tcp   # mgmt API port
    container_name: mqtt_broker
    depends_on:
      - mariadb
    links:
      - mariadb
    # domainname: 
    # hostname: 
    user: root
    environment:
      # configure : https://github.com/emqtt/emqttd/blob/master/etc/emq.conf
      # - EMQ_HOST=
      - EMQ_WAIT_TIME=5
      - EMQ_ADMIN_PASSWORD=admin
      # - EMQ_LOG__CONSOLE=console
      - EMQ_MQTT__ALLOW_ANONYMOUS=true
      - EMQ_MQTT__MAX_PACKET_SIZE=64KB
      - EMQ_LOADED_PLUGINS="emq_auth_mysql, emq_recon, emq_modules, emq_retainer, emq_dashboard"

      # #mysql parameters
      - EMQ_AUTH__MYSQL__SERVER=mariadb:6612
      # - EMQ_AUTH__MYSQL__POOL=8
      - EMQ_AUTH__MYSQL__USERNAME=root
      - EMQ_AUTH__MYSQL__PASSWORD=root
      - EMQ_AUTH__MYSQL__DATABASE=mqtt_demo
      - EMQ_AUTH__MYSQL__AUTH_QUERY=SELECT password FROM mqtt_user WHERE username = '%u' LIMIT 1
      - EMQ_AUTH__MYSQL__PASSWORD_HASH=plain #plain, md5, sha, sha256, bcrypt
      - EMQ_AUTH__MYSQL__SUPER_QUERY=select is_superuser from mqtt_user where username = '%u' limit 1
      - EMQ_AUTH__MYSQL__ACL_QUERY=select allow, ipaddr, username, clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'
      - EMQ_AUTH__MYSQL__ACL_QUERY=select allow, ipaddr, username, clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'
      - EMQ_AUTH__MYSQL__ACL_NOMATCH=deny

EMQ version

2.3-rc.2

Docker version

Docker version 17.09.0-ce, build afdb6d4

System

What system do you use?
osx


Running Docker container with Autoclustering cannot starts because of denied permission

BUG REPORT

Expected behavior

The emq Docker container should runs smoothly when I'm running the container with following env var:

EMQ_CLUSTER__DISCOVERY="k8s"
EMQ_NAME="emq"
EMQ_CLUSTER__K8S__APP_NAME="emq"
EMQ_CLUSTER__K8S__APISERVER="https://kubernetes.default:443"
EMQ_CLUSTER__K8S__SERVICE_NAME="emq"
EMQ_CLUSTER__K8S__ADDRESS_TYPE="ip"
EMQ_NODE__COOKIE="lorem-ipsum"
EMQ_CLUSTER__NAME="mqtt"
EMQ_CLUSTER__AUTOHEAL="on"
EMQ_CLUSTER__AUTOCLEAN="5m"
EMQ_LOADED_PLUGINS="emq_auth_redis emq_dashboard emq_retainer emq_recon"
EMQ_MQTT__ALLOW_ANONYMOUS="false"
EMQ_AUTH__REDIS__SERVER="redis"
EMQ_AUTH__REDIS__PASSWORD="<REDACTED>"
EMQ_AUTH__REDIS__PASSWORD_HASH="sha256"
EMQ_LISTENER__WSS__EXTERNAL__CERTFILE="/etc/secret/tls.crt"
EMQ_LISTENER__WSS__EXTERNAL__KEYFILE="/etc/secret/tls.key"

Actual behavior

The permission error in start.sh seems to break all the configuration sets from ENV vars in later part of the script.

/opt/emqttd/start.sh: line 48: can't create /etc/hosts: Permission denied
listener.ssl.external.acceptors=32
node.max_ets_tables=2097152
node.process_limit=2097152
listener.wss.external.certfile=/etc/secret/tls.crt
sed: bad option in substitution expression
cluster.k8s.service_name=emq
cluster.k8s.service_name=emq
listener.ws.external.acceptors=16
cluster.discovery=k8s
cluster.discovery=k8s
node.cookie=lorem-ipsum
mqtt.allow_anonymous=false
[email protected]
cluster.k8s.app_name=emq
cluster.k8s.app_name=emq
listener.tcp.external.max_clients=1000000
sed: bad option in substitution expression
listener.wss.external.keyfile=/etc/secret/tls.key
sed: bad option in substitution expression
cluster.k8s.apiserver=https://kubernetes.default:443
cluster.k8s.apiserver=https://kubernetes.default:443
sed: bad option in substitution expression
cluster.autoclean=5m
cluster.autoclean=5m
cluster.autoheal=on
cluster.autoheal=on
listener.ssl.external.max_clients=500000
node.max_ports=1048576
auth.redis.password_hash=sha256
cluster.k8s.address_type=ip
cluster.k8s.address_type=ip
listener.tcp.external.acceptors=64
log.console=console
auth.redis.server=redis
cluster.name=mqtt
cluster.name=qtt
auth.redis.password=<REDACTED>
listener.ws.external.max_clients=250000
name=emq
EMQ_LOADED_PLUGINS=emq_auth_redis emq_dashboard emq_retainer emq_recon
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:25Z']:waiting emqttd
23:30:26.044 [error] Error generating configuration in phase apply_translations
23:30:26.045 [error] Translation for 'ekka.cluster_discovery' expected to find setting 'cluster.k8s.apiserver' but was missing
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:27Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:28Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:30Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:31Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2017-10-25T23:30:33Z']:waiting emqttd
['2017-10-25T23:30:33Z']:timeout error

Test code

git clone https://github.com/emqtt/emq-docker
cd emq-docker
git checkout 4a0150f824e8fcf8193144864990bdaad00d48a6
docker build -t my-emq .
docker run --rm -it \
-e EMQ_CLUSTER__DISCOVERY="k8s" \
-e EMQ_NAME="emq" \
-e EMQ_CLUSTER__K8S__APP_NAME="emq" \
-e EMQ_CLUSTER__K8S__APISERVER="https://kubernetes.default:443" \
-e EMQ_CLUSTER__K8S__SERVICE_NAME="emq" \
-e EMQ_CLUSTER__K8S__ADDRESS_TYPE="ip" \
-e EMQ_NODE__COOKIE="lorem-ipsum" \
-e EMQ_CLUSTER__NAME="mqtt" \
-e EMQ_CLUSTER__AUTOHEAL="on" \
-e EMQ_CLUSTER__AUTOCLEAN="5m" \
-e EMQ_LOADED_PLUGINS="emq_auth_redis emq_dashboard emq_retainer emq_recon" \
-e EMQ_MQTT__ALLOW_ANONYMOUS="false" \
-e EMQ_AUTH__REDIS__SERVER="redis" \
-e EMQ_AUTH__REDIS__PASSWORD="<REDACTED>" \
-e EMQ_AUTH__REDIS__PASSWORD_HASH="sha256" \
-e EMQ_LISTENER__WSS__EXTERNAL__CERTFILE="/etc/secret/tls.crt" \
-e EMQ_LISTENER__WSS__EXTERNAL__KEYFILE="/etc/secret/tls.key" \
my-emq

EMQ version

emqtt/emq-docker 4a0150f824e8fcf8193144864990bdaad00d48a6

the emq version declared in Dockerfile is v2.3-rc.2

Docker version

Which docker-engine version?

docker -v
Docker version 17.09.0-ce, build afdb6d4

How docker info?

docker info

Containers: 10
 Running: 0
 Paused: 0
 Stopped: 10
Images: 450
Server Version: 17.09.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 775
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: moby
ID: RNFR:5ACG:AEIM:DBO4:ZD3K:NGHK:I2L6:A5K7:SX74:BFNX:JZCJ:4ID5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 20
 Goroutines: 31
 System Time: 2017-10-25T23:47:44.634666174Z
 EventsListeners: 1
Username: akhy
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

System

Tried on both Kubernetes cluster (GCP) and my Mac dev machine with native Docker

Hardware

GCP, reproduced on MBP

User should be able to govern the duration after which EMQ broker times out.

FEATURE REQUEST

Missing feature

User should be able to govern the duration after which EMQ broker times out.

Justification

In an environment shared across people or orgs, broker (emqttd foreground) can take variable amount of time to come up. Sometimes this is longer than 5s. Presently it is hard coded to 5 and user is given no option to alter it.

Workarounds

There are no workarounds available as of now as the value is hardcoded.

terminated with reason: no try clause matching ok in emqttd_client:

the docker run command straight from the readme doesnt work. i suppose there are more options needed?

docker run --rm -ti --name emq -p 18083:18083 -p 1883:1883 emq:latest
listener.ssl.external.acceptors=32                                                              
node.max_ets_tables=2097152
node.process_limit=2097152
listener.ws.external.acceptors=16
[email protected]
listener.tcp.external.max_clients=1000000
listener.tcp.external=1883
listener.ssl.external.max_clients=500000
node.max_ports=1048576
listener.tcp.external.acceptors=64
log.console=console
listener.ws.external.max_clients=250000
name=02158e0bbbe8
Node '[email protected]' not responding to pings.
Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.3.1/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/[email protected]" -config /opt/emqttd/data/configs/app.2017.12.28.12.13.32.config -args_file /opt/emqttd/data/configs/vm.2017.12.28.12.13.32.args -vm_args /opt/emqttd/data/configs/vm.2017.12.28.12.13.32.args -- foreground
Root: /opt/emqttd
['2017-12-28T12:13:33Z']:waiting emqttd
starting emqttd on node '[email protected]'
emqttd ctl is starting...[ok]
emqttd hook is starting...[ok]
emqttd router is starting...[ok]
emqttd pubsub is starting...[ok]
emqttd stats is starting...[ok]
emqttd metrics is starting...[ok]
emqttd pooler is starting...[ok]
emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
emqttd 2.3.1 is running now
['2017-12-28T12:13:34Z']:waiting emqttd
Load emq_mod_presence module successfully.
dashboard:http listen on 0.0.0.0:18083 with 2 acceptors.
mqtt:tcp listen on 127.0.0.1:11883 with 16 acceptors.
mqtt:tcp listen on 0.0.0.0:1883 with 64 acceptors.
mqtt:ws listen on 0.0.0.0:8083 with 16 acceptors.
mqtt:ssl listen on 0.0.0.0:8883 with 32 acceptors.
mqtt:wss listen on 0.0.0.0:8084 with 4 acceptors.
mqtt:api listen on 0.0.0.0:8080 with 4 acceptors.
['2017-12-28T12:13:35Z']:emqttd start
12:13:38.565 [error] gen_server <0.1548.0> terminated with reason: no try clause matching ok in emqttd_client:'-send_fun/2-fun-2-'/4 line 142
12:13:38.565 [error] CRASH REPORT Process <0.1548.0> with 0 neighbours exited with reason: no try clause matching ok in emqttd_client:'-send_fun/2-fun-2-'/4 line 142 in gen_server2:terminate/3 line 1157
12:13:38.565 [error] Supervisor 'esockd_connection_sup - <0.1403.0>' had child connection started with emqttd_client:start_link([{max_publish_rate,0},{client_idle_timeout,30000},{client_enable_stats,false},{max_clientid_len,...},...]) at <0.1548.0> exit with reason no try clause matching ok in emqttd_client:'-send_fun/2-fun-2-'/4 line 142 in context connection_crashed

Delete config entry via environment variables

I have configured the container to use SSL and verify client cert.
- EMQ_LISTENER__SSL__EXTERNAL__KEYFILE=/secrets/certs/mqttServer.key
- EMQ_LISTENER__SSL__EXTERNAL__CERTFILE=/secrets/certs/mqttServer.crt
- EMQ_LISTENER__SSL__EXTERNAL__CACERTFILE=/secrets/certs/ca.crt
- EMQ_LISTENER__SSL__EXTERNAL__VERIFY=verify_peer
- EMQ_LISTENER__SSL__EXTERNAL__FAIL_IF_NO_PEER_CERT=true

It works, but i can still connect over ws, wss, http... Now I want to disable ws, wss and http. Only SSL should be enabled.
In emqx/emqx#1155 post it is recommended to delete a listener from the etc/emq.conf.
How can I delete listeners with Environment variables? Is there a way?

EMQ_MQTT__MAX_PACKET_SIZE not in emq.conf

BUG REPORT

Expected behavior

Specifying
EMQ_MQTT__MAX_PACKET_SIZE=128KB should be reflected in the emq.conf in the docker container.

Actual behavior

When specifying EMQ_MQTT__MAX_PACKET_SIZE in both formats:
EMQ_MQTT__MAX_PACKET_SIZE
EMQ_MQTT_MAX_PACKET_SIZE

in docker-compose in the following variants:

environment:

  • EMQ_MQTT__MAX_PACKET_SIZE=128KB
  • EMQ_MQTT__MAX_PACKET_SIZE="128KB"
  • EMQ_MQTT_MAX_PACKET_SIZE=128KB
  • EMQ_MQTT_MAX_PACKET_SIZE="128KB"

it doesn´t get written into emq.conf into the container.

EMQ version

Newest master

Docker version

Which docker-engine version?

Docker version 17.03.0-ce, build 60ccb22

System

Linux docker01.b.fir.io 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Hardware

VM

ENV 3.0

Hi All,
what are the docker ENV vars that will work with beta3.0?
I tried:
-e EMQX_ADMIN_PASSWORD=xxxx
and that worked.
But i am not sure other env are working like:
-e EMQX_MQTT__ALLOW_ANONYMOUS=false
On the 2.9 it was working with:
-e EMQ_MQTT__ALLOW_ANONYMOUS=false

in docker, call GET /api/v3/routes , get error

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

call /api/v3/routes get routes status

Actual behavior

  • http request return 500 error

  • ./emqx_ctl routes list
    RPC to [email protected] error: badarg

2018-10-24 06:42:22.585 [error] <0.2812.0> GET /api/v3/routes error: badarg, stacktrace:
[{jsx_parser,value,4,[{file,"src/jsx_parser.erl"},{line,163}]},{minirest_handler,jsonify,4,[{file,"src/minirest_handler.erl"},{line,130}]},{minirest,handle_request,2,[{file,"src/minirest.erl"},{line,66}]},{minirest,init,2,[{file,"src/minirest.erl"},{line,51}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,37}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,274}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream_h.erl"},{line,252}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]
2018-10-24 06:43:14.813 [error] <0.2849.0> GET /api/v3/routes error: badarg, stacktrace:
[{jsx_parser,value,4,[{file,"src/jsx_parser.erl"},{line,163}]},{minirest_handler,jsonify,4,[{file,"src/minirest_handler.erl"},{line,130}]},{minirest,handle_request,2,[{file,"src/minirest.erl"},{line,66}]},{minirest,init,2,[{file,"src/minirest.erl"},{line,51}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,37}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,274}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream_h.erl"},{line,252}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]
2018-10-24 06:44:56.807 [error] <0.2909.0> GET /api/v3/routes error: badarg, stacktrace:
[{jsx_parser,value,4,[{file,"src/jsx_parser.erl"},{line,163}]},{minirest_handler,jsonify,4,[{file,"src/minirest_handler.erl"},{line,130}]},{minirest,handle_request,2,[{file,"src/minirest.erl"},{line,66}]},{minirest,init,2,[{file,"src/minirest.erl"},{line,51}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,37}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,274}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream_h.erl"},{line,252}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]

Test code

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

# add code here

EMQ version

Which branch are you on? If you know the Git revision then add it here as well.

Docker version

Which docker-engine version?

docker -v

How docker info?

docker info

System

What system do you use?

Hardware

How is the host machine?


FEATURE REQUEST

Missing feature

Justification

Tell us why you would like to see this feature added.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

When using auth plugin any credentials are accepted.

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

I started it using docker-compose. Then I enabled the plugin auth_username.

Expected behavior

I can login with the configured credentials.

Actual behavior

I can login with any credentials. I have to use credentials but every combination seems to work.

Test code

My docker-compose.yml:

version: '3'
services:
  emq:
    build: .
    ports:
     - "1883:1883"
     - "18083:18083"
    environment:
     - EMQ_LOADED_PLUGINS="emq_recon,emq_modules,emq_retainer,emq_dashboard,emq_auth_username"                      
     - EMQ_AUTH__USER__1__username = mqtt
     - EMQ_AUTH__USER__1__password = asdasd
     - EMQ_MQTT__ALLOW_ANONYMOUS = false 
> docker-compose up

EMQ version

I am using git hash 35e286f

Docker version

docker -v
Docker version 17.05.0-ce, build 89658be 

How docker info?

docker info
Containers: 295                                                                                                     │
 Running: 2                                                                                                         │
 Paused: 0                                                                                                          │
 Stopped: 293                                                                                                       │
Images: 26                                                                                                          │
Server Version: 17.05.0-ce                                                                                          │
Storage Driver: aufs                                                                                                │
 Root Dir: /var/lib/docker/aufs                                                                                     │
 Backing Filesystem: zfs                                                                                            │
 Dirs: 642                                                                                                          │
 Dirperm1 Supported: true                                                                                           │
Logging Driver: json-file                                                                                           │
Cgroup Driver: cgroupfs                                                                                             │
Plugins:                                                                                                            │
 Volume: local                                                                                                      │
 Network: bridge host macvlan null overlay                                                                          │
Swarm: inactive                                                                                                     │
Runtimes: runc                                                                                                      │
Default Runtime: runc                                                                                               │
Init Binary: docker-init                                                                                            │
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145                                                        │
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228                                                              │
init version: 949e6fa                                                                                               │
Security Options:                                                                                                   │
 apparmor                                                                                                           │
 seccomp                                                                                                            │
  Profile: default                                                                                                  │
Kernel Version: 4.4.0-104-generic                                                                                   │
Operating System: Ubuntu 16.04.3 LTS                                                                                │
OSType: linux                                                                                                       │
Architecture: x86_64                                                                                                │
CPUs: 4                                                                                                             │
Total Memory: 11.7GiB                                                                                               │
Name: LE-Nas                                                                                                        │
ID: 2TEF:AJNZ:R4KB:XOH6:U6CT:U7JA:KB4I:VDIX:YIAZ:4D7N:QN4U:QWF7                                                     │
Docker Root Dir: /var/lib/docker                                                                                    │
Debug Mode (client): false                                                                                          │
Debug Mode (server): false                                                                                          │
Registry: https://index.docker.io/v1/                                                                               │
Experimental: false                                                                                                 │
Insecure Registries:                                                                                                │
 127.0.0.0/8                                                                                                        │
Live Restore Enabled: false                                                                                         │
                                                                                                                    │
WARNING: No swap limit support    
``

Fail to use `EMQ_ADMIN_PASSWORD` to change admin password

I use rancher to run a emqtt cluster, and my emq image is v2.3.3 (using docker image from http://emqtt.io/downloads), and i just set some environments:

EMQ_CLUSTER__DISCOVERY=etcd
EMQ_CLUSTER__AUTOHEAL=on
EMQ_CLUSTER__AUTOCLEAN=1m
EMQ_CLUSTER__ETCD__SERVER = http:\/\/etcd:2379
EMQ_CLUSTER__ETCD__PREFIX=emqcl
EMQ_CLUSTER__ETCD__NODE_TTL=1m
EMQ_WAIT_TIME=30
EMQ_LOADED_PLUGINS=emq_recon,emq_modules,emq_retainer
EMQ_ADMIN_PASSWORD=2453tobW4nN

sometime i got a error, log file looks like this:

emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
emqttd 2.3.3 is running now
Load emq_mod_presence module successfully.
mqtt:tcp listen on 127.0.0.1:11883 with 4 acceptors.
mqtt:tcp listen on 0.0.0.0:1883 with 64 acceptors.
mqtt:ws listen on 0.0.0.0:8083 with 16 acceptors.
mqtt:ssl listen on 0.0.0.0:8883 with 32 acceptors.
mqtt:wss listen on 0.0.0.0:8084 with 4 acceptors.
mqtt:api listen on 0.0.0.0:8080 with 4 acceptors.
['2018-01-23T04:19:58Z']:waiting emqttd
['2018-01-23T04:19:58Z']:emqttd start
['2018-01-23T04:19:58Z']:admin password changed to 2453tobW4nN
Usage: emqttd_ctl
--------------------------------------------------------------------------------
status                                          # Show broker status
--------------------------------------------------------------------------------
broker                                          # Show broker version, uptime and description
broker pubsub                                   # Show process_info of pubsub
broker stats                                    # Show broker statistics of clients, topics, subscribers
broker metrics                                  # Show broker metrics
--------------------------------------------------------------------------------
cluster join <Node>                             # Join the cluster
cluster leave                                   # Leave the cluster
cluster force-leave <Node>                      # Force the node leave from cluster
cluster status                                  # Cluster status
--------------------------------------------------------------------------------
users list                                      # List users
users add <Username> <Password>                 # Add User
users del <Username>                            # Delete User
--------------------------------------------------------------------------------
acl reload                                      # reload etc/acl.conf
--------------------------------------------------------------------------------
clients list                                    # List all clients
clients show <ClientId>                         # Show a client
clients kick <ClientId>                         # Kick out a client
--------------------------------------------------------------------------------
sessions list                                   # List all sessions
sessions list persistent                        # List all persistent sessions
sessions list transient                         # List all transient sessions
sessions show <ClientId>                        # Show a session
--------------------------------------------------------------------------------
routes list                                     # List all routes
routes show <Topic>                             # Show a route
--------------------------------------------------------------------------------
topics list                                     # List all topics
topics show <Topic>                             # Show a topic
--------------------------------------------------------------------------------
subscriptions list                              # List all subscriptions
subscriptions show <ClientId>                   # Show subscriptions of a client
subscriptions add <ClientId> <Topic> <QoS>      # Add a static subscription manually
subscriptions del <ClientId> <Topic>            # Delete a static subscription manually
--------------------------------------------------------------------------------
plugins list                                    # Show loaded plugins
plugins load <Plugin>                           # Load plugin
plugins unload <Plugin>                         # Unload plugin
--------------------------------------------------------------------------------
bridges list                                    # List bridges
bridges options                                 # Bridge options
bridges start <Node> <Topic>                    # Start a bridge
bridges start <Node> <Topic> <Options>          # Start a bridge with options
bridges stop <Node> <Topic>                     # Stop a bridge
--------------------------------------------------------------------------------
vm all                                          # Show info of Erlang VM
vm load                                         # Show load of Erlang VM
vm memory                                       # Show memory of Erlang VM
vm process                                      # Show process of Erlang VM
vm io                                           # Show IO of Erlang VM
vm ports                                        # Show Ports of Erlang VM
--------------------------------------------------------------------------------
mnesia                                          # Mnesia system info
--------------------------------------------------------------------------------
trace list                                      # List all traces
trace client <ClientId> <LogFile>               # Trace a client
trace client <ClientId> off                     # Stop tracing a client
trace topic <Topic> <LogFile>                   # Trace a topic
trace topic <Topic> off                         # Stop tracing a Topic
--------------------------------------------------------------------------------
listeners                                       # List listeners
listeners restart <Proto> <Port>                # Restart a listener
listeners stop    <Proto> <Port>                # Stop a listener
--------------------------------------------------------------------------------
recon memory                                    # recon_alloc:memory/2
recon allocated                                 # recon_alloc:memory(allocated_types, current|max)
recon bin_leak                                  # recon:bin_leak(100)
recon node_stats                                # recon:node_stats(10, 1000)
recon remote_load Mod                           # recon:remote_load(Mod)
--------------------------------------------------------------------------------
retainer info                                   # Show the count of retained messages
retainer topics                                 # Show all topics of retained messages
retainer clean                                  # Clean all retained messages

And you can see emqttd_ctl does not have option admins which used in here

Setting `EMQ_ADMIN_PASSWORD` fails

Expected behavior

When specifying EMQ_ADMIN_PASSWORD=testpassword it is being used as specified. However the default password is still used (being 'public')

Actual behavior

The following appears in the logfile

emqtt_1 | ['2018-01-29T12:55:17Z']:admin password changed to testpassword emqtt_1 | Usage: emqttd_ctl emqtt_1 | -------------------------------------------------------------------------------- emqtt_1 | status # Show broker status emqtt_1 | -------------------------------------------------------------------------------- emqtt_1 | broker # Show broker version, uptime and description emqtt_1 | broker pubsub # Show process_info of pubsub emqtt_1 | broker stats # Show broker statistics of clients, topics, subscribers emqtt_1 | broker metrics # Show broker metrics emqtt_1 | -------------------------------------------------------------------------------- emqtt_1 | cluster join <Node> # Join the cluster emqtt_1 | cluster leave # Leave the cluster emqtt_1 | cluster force-leave <Node> # Force the node leave from cluster emqtt_1 | cluster status # Cluster status emqtt_1 | -------------------------------------------------------------------------------- emqtt_1 | users list # List users ....

Test code

docker-compose:

services:
  emqtt:
    build: .
    restart: "always"
    environment:
      - EMQ_LOADED_PLUGINS="emq_dashboard,emq_auth_http,emq_modules,emq_retainer"
      - EMQ_ADMIN_PASSWORD=testpassword
    ports:
      - "1883:1883"
      - "8883:8883"
      - "18083:18083" 

EMQ version

2.3.4

Docker version

Docker version 17.12.0-ce, build c97c6d6

Add Apache 2.0 License

  • FEATURE REQUEST

Missing feature

Apache 2.0 License

Justification

Please add the Apache 2.0 to this repository so that it is consistent with the emqx license and can be used without concern over it's licensing.

Workarounds

none

Clustering with AWS EKS

How do I use k8s cluster discovery with AWS EKS? Using k8s server API endpoint returns 403 as EKS requires authentication. Probably configuration should include a way to specify the server certificate and an admin token. Is there any way to enable clustering in an EKS environment?

I'm using emqx/emqx:latest image from the dockerhub.

Emqtt Version 3 Dockerfile

  • BUG REPORT
  • FEATURE REQUEST

FEATURE REQUEST

Missing feature

emqtt version 3 Dockerfile

Justification

Tell us why you would like to see this feature added.
Because it is the latest version of emqtt available.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

I have created a Dockerfile by myself, I want to see is there any chance of this getting merge or the fixes I have to apply in order to get it merged.

FROM erlang:21.1.1-alpine

RUN apk add build-base git wget

COPY . /emqttd
RUN cd /emqttd \
    && make \
    && mkdir -p /opt && mv /emqttd/_rel/emqttd /opt/emqttd \
    && cd / && rm -rf /emqttd \
    && mv /start.sh /opt/emqttd/start.sh \
    && chmod +x /opt/emqttd/start.sh \
    && ln -s /opt/emqttd/bin/* /usr/local/bin/ \
    # removing fetch deps and build deps
    && apk --purge del .build-deps .fetch-deps \
    && rm -rf /var/cache/apk/*

WORKDIR /opt/emqttd

# start emqttd and initial environments
CMD ["/opt/emqttd/start.sh"]

RUN adduser -D -u 1000 emqtt

RUN chgrp -Rf root /opt/emqttd && chmod -Rf g+w /opt/emqttd \
      && chown -Rf emqtt /opt/emqttd

USER emqtt

VOLUME ["/opt/emqttd/log", "/opt/emqttd/data", "/opt/emqttd/lib", "/opt/emqttd/etc"]

# emqttd will occupy these port:
# - 1883 port for MQTT
# - 8883 port for MQTT(SSL)
# - 8083 for WebSocket/HTTP
# - 8084 for WSS/HTTPS
# - 8080 for mgmt API
# - 18083 for dashboard
# - 4369 for port mapping
# - 6000-6999 for distributed node
EXPOSE 1883 8883 8083 8084 8080 18083 4369 6000-6999

Can't connect to EMQ after reboot

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Actual behavior

After computer reboot and running docker start emq the broker is not avaiable via MQTT (mqtt://localhost). However, ACP and HTTP API work well.

$docker start emq
emq

$ docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                                                                                                                                         NAMES
b89be51d69e4        emqttd-docker-v2.3.9   "/opt/emqttd/start.sh"   2 days ago          Up 26 seconds       4369/tcp, 0.0.0.0:1883->1883/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:8083-8084->8083-8084/tcp, 0.0.0.0:8883->8883/tcp, 0.0.0.0:18083->18083/tcp, 6000-6999/tcp   emq

EMQ version

2.3.9

Docker version

Docker version 18.03.1-ce, build 9ee9f40

How docker info?

$docker info
Containers: 2
 Running: 1
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 18.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: 64F2:K3S4:3DJX:5LHJ:ZW57:42AR:F4Z7:XHZM:G2BO:MTTI:6GWI:TTWR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 28
 Goroutines: 45
 System Time: 2018-06-07T07:35:17.506545253Z
 EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

System

macOS High Sierra

Hardware

MacBook Pro

Set timezone via environment variable

  • BUG REPORT
  • FEATURE REQUEST

Missing feature

The EMQ dashboard displays the current time in different locations. Therefore being able to set the timezone would be a nice feature.

Workarounds

I forked the repo and added the tzdata package. This allows the user to set the TZ environment flag (tested with docker-compose). Additional image size: 1.45MB

Changes made: David-Development@d1a2b00

unable to run with emqx_auth_mongo env variables

Hello,

I am unable to run emqx-docker-v3.0-beta.3:latest with environement variables using the auth_mongo plugin.

Everything works perfectly fine when I configure the plugin through the DASHBOARD.

run command:

docker run --rm -ti --name emqx
-p 1883:1883 -p 8083:8083 -p 18083:18083
-e EMQX_ALLOW_ANONYMOUS=false
-e EMQ_LOADED_PLUGINS=”emqx_auth_mongo”
-e EMQX_AUTH__MONGO__SERVER=”192.168.1.3:27017”
-e EMQX_AUTH__MONGO__LOGIN=”xxx”
-e EMQX_AUTH__MONGO__PASSWORD=”xxx”
-e EMQX_AUTH__MONGO__AUTH_SOURCE=”xxx”
-e EMQX_AUTH__MONGO__DATABASE=”xxx”
-e EMQX_AUTH__MONGO__AUTH_QUERY__PASSWORD_HASH=plain
emqx-docker-v3.0-beta.3:latest

error log:

run_erl[678]: Erlang closed the connection.
20:27:56.767 [error] /opt/emqx/data/configs/app.2018.10.23.20.27.52.conf: Error converting value on line #2078 to latin1

EMQ version

emqx-docker-v3.0-beta.3:latest

Docker version

17.05.0

Work around

AUTH_MONGO configuration works with EMQX DASHBOARD, but every time the container is restarted, the whole configuration needs to be done again.

Thank you.

Persistent retained messages in k8s deployment

Are there any recommended way how to make retained messages persistent between EMQ deployments?
For me it looks like there is no use for EMQ in Kubernetes because:

  1. by default kubernetes will mount /opt/emqttd/data/mnesia as root:root.
    That lead be to rather hacky attempt to solve this by:
      securityContext:
        runAsUser: 0
        fsGroup: 1000
      containers:
      - name: emqtt
        image: private.registry/emqttd-docker:v2.3.9
        command: ["/bin/sh", "-c"]
        args:
          - chown emqtt:emqtt /opt/emqttd/data/mnesia && su -l emqtt -p -c /opt/emqttd/start.sh
        ports:
  1. even with correct permissions for /opt/emqttd/data/mnesia EMQ will just start with new node nam e on each restart:

setting EMQ_NAME, EMQ_HOST or EMQ_NODE__NAME make no effect to use persistent mnesia path

docker start, get [waiting emqttd] then exit

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

  1. Exec docker-compose, and emq start success
  2. But sometime get this issue after docker-compose up
Node '[email protected]' not responding to pings.
['2018-03-04T05:18:56Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2018-03-04T05:18:58Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2018-03-04T05:18:59Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2018-03-04T05:19:00Z']:waiting emqttd
Node '[email protected]' not responding to pings.
['2018-03-04T05:19:02Z']:waiting emqttd
Node '[email protected]' not responding to pings.
  1. And i use docker run -it ... to access to container
  2. Then run ./bin/emqttd start, it is work and fine every time.
  3. But when i run sh start.sh, sometime will get the same issue.
  4. After i add sleep 5 after /opt/emqttd/bin/emqttd foreground & in start.sh, then i have not meet the same issue.
  5. So issue maybe is thread block?

EMQ version

v2.3.5, master branch

Docker version

17.12.0-ce

System

What system do you use?

  • osx

Hardware

How is the host machine?

  • localhost

Docker build fails /bin/sh: cc: not found

Happens on
commit c1c7e23 (Jan 20, 2017, latest)

steps
git clone -b master https://github.com/emqtt/emq_docker.git
cd emq_docker
docker build -t emq:latest .
...
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
make[2]: Leaving directory '/emqttd/.erlang.mk/rebar'
/emqttd/deps/emqttd
DEP lager
DEP esockd
DEP mochiweb
DEP lager_syslog
make[2]: Entering directory '/emqttd/deps/gproc'
DEPEND gproc.d
ERLC gproc.erl gproc_app.erl gproc_bcast.erl gproc_dist.erl gproc_info.erl gproc_init.erl gproc_lib.erl gproc_monitor.erl gproc_pool.erl gproc_ps.erl gproc_pt.erl gproc_sup.erl
src/gproc_dist.erl:23: Warning: behaviour gen_leader undefined
APP gproc.app.src
make[2]: Leaving directory '/emqttd/deps/gproc'
make[2]: Entering directory '/emqttd/deps/lager'
DEP goldrush
make[3]: Entering directory '/emqttd/deps/goldrush'
DEPEND goldrush.d
ERLC glc.erl glc_code.erl glc_lib.erl glc_ops.erl glc_run.erl gr_app.erl gr_context.erl gr_counter.erl gr_counter_sup.erl gr_manager.erl gr_manager_sup.erl gr_param.erl gr_param_sup.erl gr_sup.erl gre.erl
APP goldrush.app.src
make[3]: Leaving directory '/emqttd/deps/goldrush'
DEPEND lager.d
ERLC error_logger_lager_h.erl lager.erl lager_app.erl lager_backend_throttle.erl lager_common_test_backend.erl lager_config.erl lager_console_backend.erl lager_crash_log.erl lager_default_formatter.erl lager_file_backend.erl lager_format.erl lager_handler_watcher.erl lager_handler_watcher_sup.erl lager_manager_killer.erl lager_msg.erl lager_stdlib.erl lager_sup.erl lager_transform.erl lager_trunc_io.erl lager_util.erl
APP lager.app.src
make[2]: Leaving directory '/emqttd/deps/lager'
make[2]: Entering directory '/emqttd/deps/esockd'
DEP hexer_mk
DEP gen_logger
make[3]: Entering directory '/emqttd/deps/hexer_mk'
make[3]: Nothing to be done for 'noop'.
make[3]: Leaving directory '/emqttd/deps/hexer_mk'
make[3]: Entering directory '/emqttd/deps/gen_logger'
DEPEND gen_logger.d
ERLC console_logger.erl error_logger_logger.erl gen_logger.erl lager_logger.erl
APP gen_logger.app.src
make[3]: Leaving directory '/emqttd/deps/gen_logger'
DEPEND esockd.d
ERLC esockd.erl esockd_acceptor.erl esockd_acceptor_sup.erl esockd_access.erl esockd_app.erl esockd_cidr.erl esockd_connection.erl esockd_connection_sup.erl esockd_gen.erl esockd_keepalive.erl esockd_listener.erl esockd_listener_sup.erl esockd_net.erl esockd_ratelimit.erl esockd_server.erl esockd_sup.erl esockd_transport.erl esockd_udp.erl
APP esockd.app.src
GEN rebar.config
make[2]: Leaving directory '/emqttd/deps/esockd'
make[2]: Entering directory '/emqttd/deps/mochiweb'
DEPEND mochiweb.d
ERLC mochifmt.erl mochifmt_records.erl mochifmt_std.erl mochiglobal.erl mochihex.erl mochijson.erl mochijson2.erl mochilists.erl mochilogfile2.erl mochinum.erl mochitemp.erl mochiutf8.erl mochiweb.erl mochiweb_base64url.erl mochiweb_charref.erl mochiweb_cookies.erl mochiweb_cover.erl mochiweb_headers.erl mochiweb_html.erl mochiweb_http.erl mochiweb_io.erl mochiweb_mime.erl mochiweb_multipart.erl mochiweb_request.erl mochiweb_response.erl mochiweb_session.erl mochiweb_util.erl mochiweb_websocket.erl
APP mochiweb.app.src
make[2]: Leaving directory '/emqttd/deps/mochiweb'
make[2]: Entering directory '/emqttd/deps/lager_syslog'
DEP syslog
make[3]: Entering directory '/emqttd/deps/syslog'
make -f c_src/Makefile.erlang.mk
make[4]: Entering directory '/emqttd/deps/syslog'
cc -c -o c_src/syslog_drv.o c_src/syslog_drv.c -finline-functions -Wall -fPIC -I "/usr/lib/erlang/erts-7.3.1/include" -I "/usr/lib/erlang/lib/erl_interface-3.8.2/include" -fPIC
�[91m/bin/sh: cc: not found
�[0mc_src/Makefile.erlang.mk:8: recipe for target 'c_src/syslog_drv.o' failed
make[4]: Leaving directory '/emqttd/deps/syslog'
�[91mmake[4]: *** [c_src/syslog_drv.o] Error 127
�[0mMakefile:22: recipe for target 'pre-app' failed
make[3]: Leaving directory '/emqttd/deps/syslog'
�[91mmake[3]: *** [pre-app] Error 2
�[0m�[91mmake[2]: *** [deps] Error 2
�[0m../../erlang.mk:312: recipe for target 'deps' failed
make[2]: Leaving directory '/emqttd/deps/lager_syslog'
../../erlang.mk:312: recipe for target 'deps' failed
make[1]: Leaving directory '/emqttd/deps/emqttd'
�[91mmake[1]: *** [deps] Error 2
�[0m�[91mmake: *** [deps] Error 2
�[0merlang.mk:310: recipe for target 'deps' failed
...

通过环境变量加载证书错误

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

通过环境变量
EMQ_LISTENER__SSL__EXTERNAL__KEYFILE=mydomain.key
EMQ_LISTENER__SSL__EXTERNAL__CERTFILE=mydomain.crt
EMQ_LISTENER__WSS__EXTERNAL__KEYFILE=mydomain.key
EMQ_LISTENER__WSS__EXTERNAL__CERTFILE=mydomain.crt
设置EMQ的证书, 通过[工具-WebSocket]页面可以直接使用WebSocket/SSL连接.

Actual behavior

无法连接成功, 提示连接失败.

EMQ version

Which branch are you on? If you know the Git revision then add it here as well.
v2.2.0 v2.3.5 v2.3.6

Docker Version

18.03.0-ce

Debug

经过试错, 发现只要进入容器中, 将/opt/etc/emq.conf内对应的配置直接修改为环境变量配置的值, 重启容器即可正常使用.

初步推测: 通过环境变量设置的值, 并没有正确地在SSL初始化之前加载.

Can't create a Docker Swarm Cluster

  • Docker version 17.05.0-ce (for arm)
  • EMQ Version v2.2-rc.1

Hello,

I am running docker in swarm mode and want to deploy a MQTT cluster. I decided to create one master instance so that other replicated instances can join it. Here is the compose file I wrote for this goal:

version: "3"

services:
  emq-master:
    image: aksakalli/rpi-emq
    environment:
      - EMQ_HOST=emq-master
      - EMQ_NAME=master
      - EMQ_NODE__COOKIE=ef16498f66804df1cc6172f6996d5492
      - EMQ_NODE__NAME=master@emq-master
  emq-worker:
    image: aksakalli/rpi-emq
    depends_on: 
     - emq-master
    ports:
      - 18083:18083
      - 1883:1883
    deploy:
      replicas: 2
    environment:
      - EMQ_JOIN_CLUSTER=master@emq-master
      - EMQ_NODE__COOKIE=ef16498f66804df1cc6172f6996d5492

(I am using my own image for Raspberry Pi , it is basically the same as emqtt/emq-docker but compiled for arm)

When I deploy this stack, I am getting following log for emq-master container:

starting emqttd on node 'master@emq-master'
emqttd ctl is starting...[ok]
emqttd hook is starting...[ok]
emqttd router is starting...[ok]
emqttd pubsub is starting...[ok]
emqttd stats is starting...[ok]
emqttd metrics is starting...[ok]
emqttd pooler is starting...[ok]
emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
Load emq_mod_presence module successfully.
Load emq_mod_subscription module successfully.
dashboard:http listen on 0.0.0.0:18083 with 2 acceptors.
mqtt:tcp listen on 127.0.0.1:11883 with 16 acceptors.
mqtt:tcp listen on 0.0.0.0:1883 with 64 acceptors.
mqtt:ws listen on 0.0.0.0:8083 with 16 acceptors.
mqtt:ssl listen on 0.0.0.0:8883 with 32 acceptors.
mqtt:wss listen on 0.0.0.0:8084 with 4 acceptors.
mqtt:api listen on 127.0.0.1:8080 with 4 acceptors.
emqttd 2.2 is running now
Node 'master@emq-master' not responding to pings.
['2017-06-29T09:17:55Z']:waiting emqttd
['2017-06-29T09:17:55Z']:timeout error

Apparently, master@emq-master can not be resolved within the container when I set EMQ_HOST.

I also tried to leave it blank, emqttd can be created for the default ip address (as [email protected]). However, emq-worker containers can not join the cluster (even though emq-master host(FQDN) can be resolved by these containers.) The logs from one of emq-worker container:

emqttd 2.2 is running now
['2017-06-29T11:18:50Z']:emqttd start
['2017-06-29T11:18:50Z']:emqttd try join master@emq-master
11:18:58.790 [error] ** System running to use fully qualified hostnames **
** Hostname emq-master is illegal **
Failed to join the cluster: {node_not_running,'master@emq-master'}

I connected to one of the worker containers and tried to connect to the master with the hostname again:

root@9df3d2a3d36a:/opt/emqttd/bin# emqttd_ctl cluster join master@emq-master        
Failed to join the cluster: {node_not_running,'master@emq-master'}

And this time, using the ip address, it worked!

root@9df3d2a3d36a:/opt/emqttd# emqttd_ctl cluster join [email protected]  
Join the cluster successfully.
Cluster status: [{running_nodes,['[email protected]','[email protected]']}]

I was planning to set a static ip for my master node, however swarm's overlay network driver does not support it (see Static/Reserved IP addresses for swarm services · Issue #24170 · moby/moby).

How can I create a emq cluster deployment properly?

V2 To V3 Upgrade Guide

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

FEATURE REQUEST

Missing feature

V2 To V3 Upgrade Guide

Justification

It would be helpful to have an upgrade guide when migrating from V2 to V3. This will let consumers know of any breaking changes etc.

emqtt pings says unreachable node. later it starts fine

BUG REPORT

Expected behavior

EMQ should start after running docker container container

Actual behavior

EMQ does not start some of the times (say 5% of times) and start other times.

Test code

docker run -it -d -p 18083:18083 -p 8883:8883 -v /data1/ucp-emqtt-logs:/opt/emqttd/log -v /ucp/ssl/emqtt/ca.cert.pem:/opt/emqttd/etc/certs/cacert.pem -v /ucp/ssl/emqtt/emqtt.key:/opt/emqttd/etc/certs/key.pem -v /ucp/ssl/emqtt/emqtt.cert.pem:/opt/emqttd/etc/certs/cert.pem --name=ucp-dataplane-emqttserver <artifactory>/emqttd-docker-v2.1.2

EMQ version

OS: VMware Photon Linux 1.0, PHOTON_BUILD_NUMBER=13c08b6
Erlang/OTP: R19/8.1
EMQ: 2.1.2 (using docker image from http://emqtt.io/downloads)

Docker version

docker -v
Docker version 1.12.1, build 23cf638

How docker info?

docker info

Containers: 7
 Running: 7
 Paused: 0
 Stopped: 0
Images: 17
Server Version: 1.12.1
Storage Driver: overlay
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay null host bridge
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.26
Operating System: VMware Photon/Linux
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859 GiB
Name: <name_removed>
ID: S4P5:<id_removed>:TTSZ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

System

Photon OS from VMware
uname -a:
Linux sc-rdops-vm05-dhcp-130-190.eng.vmware.com 4.4.26 #1-photon SMP Mon Oct 24 19:43:03 UTC 2016 x86_64 GNU/Linux

Hardware

Virtual machine shared across different users on different orgs. 2 vCPU, 4GB RAM

Context

This issue was earlier reported at emqx/emqx#1195

Description

Looks like docker node was found unreachable after erlexec command was launched which resulted into lost pings. This is not very consistent but has been reported off and on. Could you shed some more idea into it. Our initial debugging tells that when we start docker container, it takes a tiny_time to acquire container-ip and emqtt fails for that reason - so if we use a mechanism to delay start.sh by this tiny_time (till the container ip has been acquired), we can be good - is that correct assessment and is there a command line option to make it happen or we need to modify emqtt scripts. We can be wrong, so pls suggest your inputs.

After failure is reported, developer logs in for root cause analysis (after an hour or so, sometime 2 days). It does not crib and 'docker start' peacefully starts the container.

Logs

docker logs tells this:

[case 1]

mqtt.listener.tcp.max_clients=1000000
node.max_ets_tables=2097152
node.process_limit=2097152
[email protected]
mqtt.listener.http.max_clients=250000
mqtt.listener.ssl.max_clients=500000
mqtt.listener.tcp.acceptors=64
node.max_ports=1048576
mqtt.listener.http.acceptors=16
mqtt.listener.ssl.acceptors=32
log.console=console
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-04T08:52:22Z']:waiting emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-04T08:52:23Z']:waiting emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.1.2/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/<removed_id>@172.17.0.8" -config /opt/emqttd/data/configs/app.2017.08.04.08.52.23.config -args_file /opt/emqttd/data/configs/vm.2017.08.04.08.52.23.args -vm_args /opt/emqttd/data/configs/vm.2017.08.04.08.52.23.args -- foreground
Root: /opt/emqttd
['2017-08-04T08:52:25Z']:waiting emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-04T08:52:27Z']:waiting emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-04T08:52:30Z']:waiting emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-04T08:52:32Z']:waiting emqttd
['2017-08-04T08:52:32Z']:timeout error


[case 2]

mqtt.listener.tcp.max_clients=1000000
node.max_ets_tables=2097152
node.process_limit=2097152
[email protected]
mqtt.listener.http.max_clients=250000
mqtt.listener.ssl.max_clients=500000
mqtt.listener.tcp.acceptors=64
node.max_ports=1048576
mqtt.listener.http.acceptors=16
mqtt.listener.ssl.acceptors=32
log.console=console
Node '<removed_id>@172.17.0.6' not responding to pings.
['2017-08-04T10:33:40Z']:waiting emqttd
Node '<removed_id>@172.17.0.6' not responding to pings.
['2017-08-04T10:33:41Z']:waiting emqttd
Node '<removed_id>@172.17.0.6' not responding to pings.
Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.1.2/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/<removed_id>@172.17.0.6" -config /opt/emqttd/data/configs/app.2017.08.04.10.33.40.config -args_file /opt/emqttd/data/configs/vm.2017.08.04.10.33.40.args -vm_args /opt/emqttd/data/configs/vm.2017.08.04.10.33.40.args -- foreground
Root: /opt/emqttd
['2017-08-04T10:33:43Z']:waiting emqttd
Node '<removed_id>@172.17.0.6' not responding to pings.
['2017-08-04T10:33:45Z']:waiting emqttd
Node '<removed_id>@172.17.0.6' not responding to pings.
['2017-08-04T10:33:46Z']:waiting emqttd
Node '<removed_id>@172.17.0.6' not responding to pings.
['2017-08-04T10:33:48Z']:waiting emqttd
['2017-08-04T10:33:48Z']:timeout error


[case 3]

2017-08-09T07:19:55.090416065Z mqtt.listener.tcp.max_clients=1000000
2017-08-09T07:19:55.119077056Z node.max_ets_tables=2097152
2017-08-09T07:19:55.140541438Z node.process_limit=2097152
2017-08-09T07:19:55.161802897Z node.name=<removed_id>@172.17.0.6
2017-08-09T07:19:55.172058122Z mqtt.listener.http.max_clients=250000
2017-08-09T07:19:55.180687513Z mqtt.listener.ssl.max_clients=500000
2017-08-09T07:19:55.187679711Z mqtt.listener.tcp.acceptors=64
2017-08-09T07:19:55.209356292Z node.max_ports=1048576
2017-08-09T07:19:55.223772112Z mqtt.listener.http.acceptors=16
2017-08-09T07:19:55.234806815Z mqtt.listener.ssl.acceptors=32
2017-08-09T07:19:55.246186517Z log.console=console
2017-08-09T07:19:58.398976947Z Node '<removed_id>@172.17.0.6' not responding to pings.
2017-08-09T07:19:59.450973271Z ['2017-08-09T07:19:59Z']:waiting emqttd
2017-08-09T07:20:00.588396270Z Node '[email protected]' not responding to pings.
2017-08-09T07:20:01.851912495Z ['2017-08-09T07:20:01Z']:waiting emqttd
2017-08-09T07:20:03.755740693Z Node '[email protected]' not responding to pings.
2017-08-09T07:20:03.957874564Z Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.1.2/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/<removed_id>@172.17.0.6" -config /opt/emqttd/data/configs/app.2017.08.09.07.20.00.config -args_file /opt/emqttd/data/configs/vm.2017.08.09.07.20.00.args -vm_args /opt/emqttd/data/configs/vm.2017.08.09.07.20.00.args -- foreground
2017-08-09T07:20:03.957905985Z Root: /opt/emqttd
2017-08-09T07:20:04.842647277Z ['2017-08-09T07:20:04Z']:waiting emqttd
2017-08-09T07:20:06.315019617Z Node '[email protected]' not responding to pings.
2017-08-09T07:20:06.364415004Z
2017-08-09T07:20:06.364436531Z =INFO REPORT==== 9-Aug-2017::07:20:06 ===
2017-08-09T07:20:06.364440175Z alarm_handler: {set,{system_memory_high_watermark,[]}}
2017-08-09T07:20:06.424014306Z starting emqttd on node '[email protected]'
2017-08-09T07:20:07.331717579Z ['2017-08-09T07:20:07Z']:waiting emqttd
2017-08-09T07:20:09.209180213Z ['2017-08-09T07:20:09Z']:waiting emqttd
2017-08-09T07:20:11.266640976Z ['2017-08-09T07:20:11Z']:waiting emqttd
2017-08-09T07:20:11.404889009Z ['2017-08-09T07:20:11Z']:timeout error
2017-08-09T09:41:33.129061929Z mqtt.listener.tcp.max_clients=1000000
2017-08-09T09:41:33.150939857Z node.max_ets_tables=2097152
2017-08-09T09:41:33.158646914Z node.process_limit=2097152
2017-08-09T09:41:33.167425159Z node.name=<removed_id>@172.17.0.8
2017-08-09T09:41:33.173971699Z mqtt.listener.http.max_clients=250000
2017-08-09T09:41:33.180952712Z mqtt.listener.ssl.max_clients=500000
2017-08-09T09:41:33.189514317Z mqtt.listener.tcp.acceptors=64
2017-08-09T09:41:33.208717553Z node.max_ports=1048576
2017-08-09T09:41:33.220267545Z mqtt.listener.http.acceptors=16
2017-08-09T09:41:33.228830010Z mqtt.listener.ssl.acceptors=32
2017-08-09T09:41:33.235712598Z log.console=console
2017-08-09T09:41:34.283814733Z Node '<removed_id>@172.17.0.8' not responding to pings.
2017-08-09T09:41:35.294268604Z ['2017-08-09T09:41:35Z']:waiting emqttd
2017-08-09T09:41:35.559936803Z Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.1.2/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/<removed_id>@172.17.0.8" -config /opt/emqttd/data/configs/app.2017.08.09.09.41.34.config -args_file /opt/emqttd/data/configs/vm.2017.08.09.09.41.34.args -vm_args /opt/emqttd/data/configs/vm.2017.08.09.09.41.34.args -- foreground
2017-08-09T09:41:35.559963047Z Root: /opt/emqttd
2017-08-09T09:41:36.059586971Z Node '<removed_id>@172.17.0.8' not responding to pings.
2017-08-09T09:41:36.514041144Z starting emqttd on node '<removed_id>@172.17.0.8'
2017-08-09T09:41:36.638138975Z emqttd ctl is starting...[ok]
2017-08-09T09:41:36.638443350Z emqttd hook is starting...[ok]
2017-08-09T09:41:36.638764228Z emqttd router is starting...[ok]
2017-08-09T09:41:36.642051899Z emqttd pubsub is starting...[ok]
2017-08-09T09:41:36.642479183Z emqttd stats is starting...[ok]
2017-08-09T09:41:36.643020844Z emqttd metrics is starting...[ok]
2017-08-09T09:41:36.643723552Z emqttd pooler is starting...[ok]
2017-08-09T09:41:36.644169643Z emqttd trace is starting...[ok]
2017-08-09T09:41:36.645111268Z emqttd client manager is starting...[ok]
2017-08-09T09:41:36.646040380Z emqttd session manager is starting...[ok]
2017-08-09T09:41:36.646420283Z emqttd session supervisor is starting...[ok]
2017-08-09T09:41:36.646847570Z emqttd wsclient supervisor is starting...[ok]
2017-08-09T09:41:36.647368408Z emqttd broker is starting...[ok]
2017-08-09T09:41:36.647648299Z emqttd alarm is starting...[ok]
2017-08-09T09:41:36.647771379Z emqttd mod supervisor is starting...[ok]
2017-08-09T09:41:36.648003335Z emqttd bridge supervisor is starting...[ok]
2017-08-09T09:41:36.648319268Z emqttd access control is starting...[ok]
2017-08-09T09:41:36.648725912Z emqttd system monitor is starting...[ok]
2017-08-09T09:41:36.655021164Z Load emq_mod_presence module successfully.
2017-08-09T09:41:36.655146218Z Load emq_mod_subscription module successfully.
2017-08-09T09:41:36.686422603Z dashboard:http listen on 0.0.0.0:18083 with 2 acceptors.
2017-08-09T09:41:36.688935583Z mqtt:tcp listen on 0.0.0.0:1883 with 64 acceptors.
2017-08-09T09:41:36.690445904Z mqtt:ssl listen on 0.0.0.0:8883 with 32 acceptors.
2017-08-09T09:41:36.691772449Z mqtt:ws listen on 0.0.0.0:8083 with 16 acceptors.
2017-08-09T09:41:36.692911549Z mqtt:wss listen on 0.0.0.0:8084 with 4 acceptors.
2017-08-09T09:41:36.692922387Z emqttd 2.1.2 is running now


[for successful attempts]

mqtt.listener.http.max_clients=250000
mqtt.listener.ssl.max_clients=500000
mqtt.listener.tcp.acceptors=64
node.max_ports=1048576
mqtt.listener.http.acceptors=16
mqtt.listener.ssl.acceptors=32
log.console=console
Node '<removed_id>@172.17.0.8' not responding to pings.
['2017-08-03T10:47:57Z']:waiting emqttd
Exec: /opt/emqttd/erts-8.1/bin/erlexec -noshell -noinput +Bd -boot /opt/emqttd/releases/2.1.2/emqttd -mode embedded -boot_var ERTS_LIB_DIR /opt/emqttd/erts-8.1/../lib -mnesia dir "/opt/emqttd/data/mnesia/<removed_id>@172.17.0.8" -config /opt/emqttd/data/configs/app.2017.08.03.10.47.56.config -args_file /opt/emqttd/data/configs/vm.2017.08.03.10.47.56.args -vm_args /opt/emqttd/data/configs/vm.2017.08.03.10.47.56.args -- foreground
Root: /opt/emqttd
Node '<removed_id>@172.17.0.8' not responding to pings.
starting emqttd on node '<removed_id>@172.17.0.8'
emqttd ctl is starting...[ok]
emqttd hook is starting...[ok]
emqttd router is starting...[ok]
emqttd pubsub is starting...[ok]
emqttd stats is starting...[ok]
emqttd metrics is starting...[ok]
emqttd pooler is starting...[ok]
emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
Load emq_mod_presence module successfully.
Load emq_mod_subscription module successfully.
dashboard:http listen on 0.0.0.0:18083 with 2 acceptors.
mqtt:tcp listen on 0.0.0.0:1883 with 64 acceptors.
mqtt:ssl listen on 0.0.0.0:8883 with 4 acceptors.
mqtt:ws listen on 0.0.0.0:8083 with 16 acceptors.
mqtt:wss listen on 0.0.0.0:8084 with 4 acceptors.
emqttd 2.1.2 is running now
['2017-08-03T10:47:59Z']:waiting emqttd
['2017-08-03T10:47:59Z']:emqttd start

Environment variable to configure container failed when value include "http://" like

when I use docker-compose yml configure container like this:

version: '2.0'

services:
    mongo:
        image: emqttd:master
        hostname: emqttd
        ports:
            - "18083:18083"
            - "1883:1883"
            - "8083:8083" 
            - "8883:8883"
        environment:
            - EMQ_CLUSTER__DISCOVERY=k8s
            - EMQ_CLUSTER__K8S__APISERVER=http://172.16.1.225:8080
            - EMQ_CLUSTER__K8S__SERVICE_NAME=ekka
            - EMQ_CLUSTER__K8S__ADDRESS_TYPE=ip
            - EMQ_CLUSTER__K8S__APP_NAME=ekka

It cause set option error, the error line in start.sh is:

sed -r -i "s/(^#*\s*)($VAR_NAME)\s*=\s*(.*)/\2 = $(eval echo \$$VAR_FULL_NAME)/g" $CONFIG

it replaced as

sed -r -i "s/(^#*\s*)(cluster.k8s.apiserver)\s*=\s*(.*)/\2 = http://172.16.1.225:8080/g"

The format is wrong in sed, “http://“ must be "http:\/\/",so can not use $eval directly.
It works when I modified start.sh like this:

if [[ ! -z "$(cat $CONFIG |grep -E "^(^|^#*|^#*\s*)$VAR_NAME")" ]]; then
            echo "emq.conf: $VAR_NAME=$(eval echo \$$VAR_FULL_NAME)"
            VAR_VALUE=$(eval echo \$$VAR_FULL_NAME)
            VAR_VALUE_R=${VAR_VALUE//\//\\\/}
            sed -r -i "s/(^#*\s*)($VAR_NAME)\s*=\s*(.*)/\2 = $VAR_VALUE_R/g" $CONFIG

Changes must be done in all the lines include sed with eval.

using multiple RUN command in order to improve image caching

  • BUG REPORT
  • FEATURE REQUEST

Missing feature

Justification

Docker caches each RUN in dockerfile into a separate image. Having multiple RUNs help speeding up image building process because if a RUN command finish successfully, it will be cached docker and will use it in next builds instead of rerunning that section again.

In your situation, you can have RUN for apt installs and another RUN for cloning and building the emqtt.

Workarounds

Are there any workarounds you currently have in place because the feature is missing? No :) docker will create image based on just one RUN and won't cache apt installs

can not set auth.http.auth_req.params with docker environments

run EMQ by docker with following command:

docker run --rm -ti --name emq -p 192.168.128.30:18083:18083 -p 8883:8883 -p 8084:8084 \
-e EMQ_NODE__PROCESS_LIMIT=2097152 \
-e EMQ_NODE__MAX_PORTS=1048576 \
-e EMQ_MQTT__ALLOW_ANONYMOUS=false \
-e EMQ_MQTT__CACHE_ACL=false \
-e EMQ_MQTT__MQUEUE__MAX_LENGTH=8 \
-e EMQ_LISTENER__TCP__EXTERNAL__ACCEPTORS=64 \
-e EMQ_LISTENER__TCP__EXTERNAL__MAX_CLIENTS=1024000 \
-e EMQ_LISTENER__SSL__EXTERNAL__MAX_CLIENTS=1024000 \
-e EMQ_LISTENER__WS__EXTERNAL__MAX_CLIENTS=1024000 \
-e EMQ_LISTENER__WSS__EXTERNAL__MAX_CLIENTS=1024000 \
-e EMQ_SYSMON__LARGE_HEAP=64MB \
-e EMQ_LOADED_PLUGINS="emq_recon,emq_modules,emq_retainer,emq_dashboard,emq_auth_http" \
-e EMQ_AUTH__HTTP__AUTH_REQ="http:\/\/192.168.128.30:12101\/mqtt\/auth" \
-e EMQ_AUTH__HTTP__AUTH_REQ__PARAMS="clientid=%c,username=%u,password=%P,ipaddr=%a" \
-e EMQ_AUTH__HTTP__SUPER_REQ="http:\/\/192.168.128.30:12101\/mqtt\/superuser" \
-e EMQ_AUTH__HTTP__ACL_REQ="http:\/\/192.168.128.30:12101\/mqtt\/acl" \
emq:2.2

alll evnironments take effect within docker except auth.http.auth_req.params failed to be set.

The EMQ broker needs to run as a user


FEATURE REQUEST

Missing feature

The emqtt user needs to run as a well defined docker user

Justification

Since the emqtt bootstrap script calls whoami during the startup process, we need to specify a docker runtime user, without that the whoami call with fail in kubernetes distributions such as openshift which will start with a random userid every time the pod is run.

Workarounds

No workaround works for openshift apart from setting the user as in the pull request

Building image in Windows fails due to line endings in start script

Expected behavior

Building the Docker image in Windows should result in an image that runs successfully.

Actual behavior

Building the Docker image in Windows results in an image that fails to run in Docker for Windows with the following error message:

standard_init_linux.go:178: exec user process caused "no such file or directory"

Test code

Running on Windows with Docker for Windows installed, running with Linux containers:

docker build -t emq:latest .
docker run --rm -it emq:latest

EMQ version

master branch, commit 6cacf266c11fa15f46eb92d1db2b1f0b63b04230

Docker version

Which docker-engine version?

C:\> docker -v
Docker version 17.03.1-ce, build c6d412e

How docker info?

C:\> docker info
Containers: 17
 Running: 1
 Paused: 0
 Stopped: 16
Images: 253
Server Version: 17.03.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 304
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.27-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934 GiB
Name: moby
ID: VHJ6:AJYU:VXUQ:7CCH:JKOU:GQKH:CKZ4:OHVY:XPJ5:DYTC:DCB6:FD5U
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

System

What system do you use? Windows 10

Hardware

How is the host machine? Lenovo T460P

can't sub some $SYS topic

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

  1. use docker image to run emq, I can't sub $SYS/brokers/${node}/clients/ topic.
  2. some result run in k8s
  3. I use rpm package to install and run emq, I can sub $SYS/brokers/${node}/clients/ topic
  4. The acl permission issue has been excluded

Actual behavior

use docker to run
image
use rpm package install
image

Test code

in two terminal., run bash

 mosquitto_sub -h 127.0.0.1  -p 1883 -t \$SYS/brokers/#

EMQ version

2.3.4 2.3.11

Docker version

Docker version 18.06.1-ce, build e68fc7a

System

CentOS Linux release 7.5.1804 (Core)

Docker version tags

  • [ x] FEATURE REQUEST

FEATURE REQUEST

Missing feature

When you release new versions of the latest image, could you also upload a version tagged image.

Justification

Having version locked images creates trust in the software. You can have implementations that use emqx and not worry too much that something gets changed which breaks the emqx docker container in your environment or breaks an implementation of emqx built on top of the emqx docker image.

emqx won't start with emqx_auth_username module enabled

Steps to reproduce

Download the recent docker image from https://www.emqx.io/downloads/broker/v3.0-rc.5/emqx-docker-v3.0-rc.5.zip, unzip it and run it in docker.

emqx will be unable to load the emqx_auth_module and will not be started properly. Loading the module once emqx is running is possible, however restarting the container will not work due to the same reason.

Run

docker run -ti --name emq30 \
    -e EMQX_LOADED_PLUGINS=emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_username \
    -e EMQX_AUTH__USER__1__USERNAME=foo \
    -e EMQX_AUTH__USER__1__PASSWORD=bar \
    -e EMQX_LOG__LEVEL=debug \
    -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 8080:8080 -p 18083:18083 \
    emqx-docker-v3.0-rc.5

Output

node.max_ports=1048576
listener.tcp.external.acceptors=64
log.level=debug
auth.user.1.username=foo
listener.ssl.external.acceptors=32
node.process_limit=2097152
node.max_ets_tables=2097152
listener.ws.external.acceptors=16
[email protected]
auth.user.1.password=bar
EMQX_LOADED_PLUGINS=emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_username
emqx 3.0 is started successfully!

=====
===== LOGGING STARTED Sat Dec  8 06:46:21 UTC 2018
=====
Exec: /opt/emqx/erts-10.0.6/bin/erlexec -boot /opt/emqx/releases/3.0/emqx -mode embedded -boot_var ERTS_LIB_DIR /opt/emqx/erts-10.0.6/../lib -mnesia dir "/opt/emqx/data/mnesia/[email protected]" -config /opt/emqx/data/configs/app.2018.12.08.06.46.23.config -args_file /opt/emqx/data/configs/vm.2018.12.08.06.46.23.args -vm_args /opt/emqx/data/configs/vm.2018.12.08.06.46.23.args -- console
Root: /opt/emqx
/opt/emqx
Erlang/OTP 21 [erts-10.0.6] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:32] [hipe]

Starting emqx on node [email protected]
2018-12-08 06:46:29.912 [info] Load emqx_mod_presence module successfully.
2018-12-08 06:46:29.933 [info] Started Apps: [recon,emqx_recon]
2018-12-08 06:46:29.934 [info] Load plugin emqx_recon successfully
2018-12-08 06:46:29.965 [info] Started Apps: [emqx_retainer]
2018-12-08 06:46:29.965 [info] Load plugin emqx_retainer successfully
Start http:management listener on 8080 successfully.
2018-12-08 06:46:30.538 [info] Started Apps: [minirest,emqx_management]
2018-12-08 06:46:30.539 [info] Load plugin emqx_management successfully
Start http:dashboard listener on 18083 successfully.
2018-12-08 06:46:30.766 [info] Started Apps: [emqx_dashboard]
2018-12-08 06:46:30.766 [info] Load plugin emqx_dashboard successfully
['2018-12-08T06:46:31Z']:waiting emqx
['2018-12-08T06:46:33Z']:waiting emqx
['2018-12-08T06:46:35Z']:waiting emqx
['2018-12-08T06:46:37Z']:waiting emqx
['2018-12-08T06:46:39Z']:waiting emqx
['2018-12-08T06:46:41Z']:waiting emqx
['2018-12-08T06:46:41Z']:timeout error

Docker version

Docker version 18.09.0-ce, build 4d60db472b
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 229
Server Version: 18.09.0-ce
Storage Driver: zfs
 Zpool: root
 Zpool Health: ONLINE
 Parent Dataset: root/docker
 Space Used By Parent: 356352
 Space Available: 16027885568
 Parent Quota: no
 Compression: off
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b.m
runc version: 079817cc26ec5292ac375bb9f47f373d33574949
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.14.85-1-lts
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 23.53GiB
Name: axis
ID: 7LZK:W2PZ:CN4J:KJM4:PNIX:IYVE:U7CL:KNFZ:F3SW:AVDD:XHBR:EL66
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker run fails with error

git clone -b master https://github.com/emqtt/emq_docker.git
cd emq_docker
docker build -t emq:latest . 

Error

❯ docker run --rm -ti --name emq -e "EMQ_TCP_PORT=1883" -p 18083:18083 -p 1883:1883 545280fda955
EMQ_NAME=b23c0f6370a7
EMQ_HOST=172.17.0.2
[email protected]
EMQ_NODE_COOKIE=emq_dist_cookie
EMQ_PROCESS_LIMIT=2097152
EMQ_MAX_PORTS=1048576
EMQ_LOG_CONSOLE=file
EMQ_LOG_LEVEL=error
EMQ_ALLOW_ANONYMOUS=true
EMQ_TCP_ACCEPTORS=64
EMQ_TCP_MAX_CLIENTS=1000000
EMQ_SSL_PORT=8883
EMQ_SSL_ACCEPTORS=32
EMQ_SSL_MAX_CLIENTS=500000
EMQ_HTTP_PORT=8083
EMQ_HTTP_ACCEPTORS=64
EMQ_HTTP_MAX_CLIENTS=1000000
EMQ_HTTPS_PORT=8084
EMQ_HTTPS_ACCEPTORS=32
EMQ_HTTPS_MAX_CLIENTS=1000000
EMQ_MAX_PACKET_SIZE=64KB
EMQ_LOADED_PLUGINS=emq_recon,emq_dashboard,emq_mod_presence,emq_mod_retainer,emq_mod_subscription
run_erl[97]: Erlang closed the connection.
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:08Z]:waiting emqttd
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:10Z]:waiting emqttd
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:11Z]:waiting emqttd
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:13Z]:waiting emqttd
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:15Z]:waiting emqttd
Node '[email protected]' not responding to pings.
[2017-01-18T04:54:16Z]:waiting emqttd
[2017-01-18T04:54:16Z]:timeout error

However the docker release download works fine.

@turtleDeng

TODO: Add cluster feature when scale the docker image under stack or service

  • EMQ configured by docker ENV settings
  • Plugins load by docker ENV settings
  • Plugins configured by docker ENV settings
  • Service discovery under stack or service(e.g. docker-compose case)
  • Cluster feature when change scale container number up, automatically join cluster
  • Automatically leave cluster when scale down container number

ACL rules through env variables

  • [ x] FEATURE REQUEST

FEATURE REQUEST

Missing feature

It does not seem to be possible to define ACL rules through env variables passed to the docker container.

Justification

It would be convenient if you could define ACL rules through env variable(s).

Not working on arm64

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT

BUG REPORT

Expected behavior

To start

Actual behavior

Crash

Test code

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

node.max_ports=1048576
listener.tcp.external.acceptors=64
listener.ssl.external.acceptors=32
node.process_limit=2097152
node.max_ets_tables=2097152
listener.ws.external.acceptors=16
node.name="emqx"@"crown.fritz.box"
=====
===== LOGGING STARTED Mon Jan  7 07:18:49 UTC 2019
=====

=====
===== LOGGING STARTED Mon Jan  7 09:02:28 UTC 2019
=====
init terminating in do_boot ({load_failed,[proc_lib,lists,logger_simple_h,logger_config,logger_backend,logger_server,logger_filters,logger,kernel,heart,gen_server,gen_event,gen,file_io_server,file_ser

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ({load_failed,[application_master,code_server,supervisor,proc_lib,lists,logger_simple_h,logger_config,logger_backend,logger_server,heart,logger_filters,logger,kernel,gen_se

Crash dump is being written to: erl_crash.dump...done
['2019-01-07T09:02:49Z']:waiting emqx
init terminating in do_boot ({load_failed,[proc_lib,erl_eval,supervisor,lists,error_handler,logger_simple_h,logger_config,logger_backend,logger_server,logger_filters,logger,kernel,heart,gen_server,gen

Crash dump is being written to: erl_crash.dump...done
['2019-01-07T09:02:52Z']:waiting emqx
init terminating in do_boot ({load_failed,[proc_lib,code_server,supervisor,application,logger_simple_h,lists,logger_config,logger_server,kernel,gen_server,gen,file_io_server,file_server,filename,file,

Crash dump is being written to: erl_crash.dump...done

EMQ version

Which branch are you on? If you know the Git revision then add it here as well.
v3.0.0-arm64v8

Docker version

Which docker-engine version?

➜ docker -v
Docker version 18.09.0, build 4d60db4

How docker info?

➜ docker info                                                                                 
Containers: 15                                                                                
 Running: 14                                                                                  
 Paused: 0                                                                                    
 Stopped: 1                                                                                   
Images: 29                                                                                    
Server Version: 18.09.0                                                                       
Storage Driver: overlay                                                                       
 Backing Filesystem: extfs                                                                    
 Supports d_type: true                                                                        
Logging Driver: json-file                                                                     
Cgroup Driver: cgroupfs                                                                       
Plugins:                                                                                      
 Volume: local                                                                                
 Network: bridge host macvlan null overlay                                                    
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog          
Swarm: inactive                                                                               
Runtimes: runc                                                                                
Default Runtime: runc                                                                         
Init Binary: docker-init                                                                      
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39                                  
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871                                        
init version: fec3683                                                                         
Security Options:                                                                             
 seccomp                                                                                      
  Profile: default                                                                            
Kernel Version: 4.4.77-rockchip-ayufan-136                                                    
Operating System: Debian GNU/Linux 9 (stretch)                                                
OSType: linux                                                                                 
Architecture: aarch64                                                                         
CPUs: 4                                                                                       
Total Memory: 3.833GiB                                                                        
Name: crown                                                                                   
ID: C3XT:ADCL:YBAN:VYWH:2K6H:MJIX:EM4A:EMJK:QYUC:DTFO:LF5G:WEZP                               
Docker Root Dir: /mnt/342eea89-df7f-4af7-813f-e97ccb446ada/dietpi_userdata/docker/data        
Debug Mode (client): false                                                                    
Debug Mode (server): false                                                                    
Registry: https://index.docker.io/v1/                                                         
Labels:                                                                                       
Experimental: false                                                                           
Insecure Registries:                                                                          
 127.0.0.0/8                                                                                  
Live Restore Enabled: false                                                                   
Product License: Community Engine                                                             

System

What system do you use? DietPi

Hardware

How is the host machine? Rock64

Can't get this to work on OpenShift

I'm trying to build this image and make it work on OpenShift, however the problem is that OpenShift runs containers with a special user id (like 100010000) and the user is in root group.

The problem can be locally reproduced with the following command:

docker run --rm -ti --name emqttd -e EMQ_WAIT_TIME=1000 -p 18083:18083 -p 1883:1883 -u 10001000:0 emqttd:latest

I made some changes to the start.sh to solve some problems (Mostly from this guide: OpenShift Guidelines) but seems like emqttd fails to start and there's not even a single log message. All I get is "waiting emqttd" and then it timeouts.

However, if I shell into this container, then I can succesfully run emqttd start and looks like it starts. However, the container still timeouts.

Quite stuck right now.

Not Clear What is Current Production-Ready Version

Make sure you read and understand http://emqtt.io/docs/v2/index.html.
Use one of the two templates below and delete the rest.

  • BUG REPORT
  • FEATURE REQUEST

FEATURE REQUEST

Missing feature

Documentation

Justification

Tell us why you would like to see this feature added.

It would be useful to know which branch in the Repo is considered production-ready. Right now there are multiple branches related to different versions.

Also because the master branch is without a license it makes it unclear if we should be using that one. So I'm requesting that we add the Apache license to the master branch if that is indeed the production ready branch.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

Volumes in Kuberenetes

Hello,

Dockerfile define docker local volumes
`` VOLUME ["/opt/emqx/log", "/opt/emqx/data", "/opt/emqx/lib", "/opt/emqx/etc"] ```

In K8s, those volumes are on host and pod might change to another host ..
so it would be better to define K8s volumes ..

There are two issues :

  • first make a custom image without docker local volumes
  • manage user rights ..

Do you have any docker image for K8s and deployment yaml file with volumes ?

which directories should i persist in emqx


Question

which directories should i persist in emqx ?

Description

I need to persist each application credential i create in emqx in case of backup or something goes wrong.if s.th goes worng with my docker container, my software could still be available and therefore i don't have to create another app id and app secret.
i already tried to persist like below :

  • ./data/emqx/data:/opt/emqx/data/

but unfortunately it does not work as it expected. when i docker down and docker up again my app credentials will be lost but i believe the logs and data are there.
overall which directories should i persist ? especially if i need to activate emqx_retainer and save messages to disk

EMQX 3.0-rc.4 for ARM32v6, ARM64v8 and AMD64 images available

Hai all,

I just succeeded to build ARM32v6, ARM64v8 and AMD64 images for EMQX 3.0-rc.4. These images are based on Alpine 3.8 and Erlang 21.1.3.

Note: there is no need to tag the image, since the images are manifest listed, which means, docker detect the architecture and pulls corresponding image automatically.

Please feel free to test them from docker hub.

Find below an example of a docker compose file I use to deployed with docker stack:

################################################################################
# MQTT Stack
################################################################################
#$ docker stack deploy mqtt --compose-file docker-compose-mqtt.yml
################################################################################
version: "3.6"

services:
  emqx-master:
    image: raymondmm/emqx
    hostname: emqx-master
    environment:
      - "EMQX_NAME=emq"
      - "EMQX_HOST=master.mq.tt"
      - "EMQX_NODE__COOKIE=ef16498f66804df1cc6172f6996d5492"
      - "EMQX_WAIT_TIME=60"
    networks:
      emqx-net:
        aliases:
          - master.mq.tt
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/TZ:ro
    deploy:
      placement:
        constraints: [node.role == manager]

  emqx-worker:
    image: raymondmm/emqx
    hostname: emqx-worker
    environment:
      - "[email protected]"
      - "EMQX_NODE__COOKIE=ef16498f66804df1cc6172f6996d5492"
      - "EMQX_WAIT_TIME=60"
    depends_on:
     - emqx-master
    networks:
      - emqx-net
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/TZ:ro
    deploy:
      placement:
        constraints: [node.role == worker]
      
networks:
  emqx-net:
    external: false

Best regards,
Raymond

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.