emqxarchive / emqx-docker

This repository is no longer maintained, please go to https://github.com/emqx/emqx-rel/tree/master/deploy/docker
Apache License 2.0
235 stars 162 forks source link

docker-compose: mount log folder of EMQ X server #110

Closed Huong-nt closed 5 years ago

Huong-nt commented 5 years ago

BUG REPORT

Expected behavior

docker-compose: mount log folder of EMQ X server

Actual behavior

Exit with code 1

ubuntu@ubuntu-HP-Pavilion-Desktop-PC-570-p0xx:~/EMQX$ docker-compose up
WARNING: Some services (emqtt-master) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
Recreating emqx_emqtt-master_1 ... done
Attaching to emqx_emqtt-master_1
emqtt-master_1  | node.max_ports=1048576
emqtt-master_1  | listener.tcp.external.acceptors=64
emqtt-master_1  | auth.http.auth_req.method=get
emqtt-master_1  | auth.http.super_req=http://127.0.0.1:5000/api/v1/mqtt/superuser
emqtt-master_1  | auth.http.acl_req=http://127.0.0.1:5000/api/v1/mqtt/acl
emqtt-master_1  | allow_anonymous=false
emqtt-master_1  | listener.ssl.external.acceptors=32
emqtt-master_1  | node.process_limit=2097152
emqtt-master_1  | node.max_ets_tables=2097152
emqtt-master_1  | listener.ws.external.acceptors=16
emqtt-master_1  | auth.http.super_req.method=get
emqtt-master_1  | node.name=emqtt-master@172.18.0.2
emqtt-master_1  | auth.http.acl_req.method=get
emqtt-master_1  | auth.http.auth_req=http://127.0.0.1:5000/api/v1/mqtt/auth
emqtt-master_1  | EMQX_LOADED_PLUGINS="emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_http"
emqx_emqtt-master_1 exited with code 1

Test code

Docker-compose file:

version: '3.7'

services:
  emqtt-master: 
    image: emqx/emqx:latest
    hostname: emqtt-master
    environment:
      - "EMQ_NAME=emqx"
      - "EMQ_HOST=master.mq.tt"
      - "EMQX_ALLOW_ANONYMOUS=false"
      - "EMQX_LOADED_PLUGINS=\"emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_http\""

      - "EMQX_AUTH__HTTP__AUTH_REQ=http://127.0.0.1:5000/api/v1/mqtt/auth"
      - "EMQX_AUTH__HTTP__AUTH_REQ__METHOD=get"
      - "EMQX_AUTH__HTTP__SUPER_REQ=http://127.0.0.1:5000/api/v1/mqtt/superuser"
      - "EMQX_AUTH__HTTP__SUPER_REQ__METHOD=get"
      - "EMQX_AUTH__HTTP__ACL_REQ=http://127.0.0.1:5000/api/v1/mqtt/acl"
      - "EMQX_AUTH__HTTP__ACL_REQ__METHOD=get"

    ports:
      - "1883:1883"
      - "8883:8883"
      - "18083:18083"

    volumes:
      # - ./etc:/opt/emqx/etc:rw
      - ./log:/opt/emqx/log:rw
    networks:
      emqtt-net:
        aliases:
          - master.mq.tt
    deploy:
      replicas: 1

networks:
  emqtt-net:
    external: true
docker network create emqtt-net
docker-compose up

EMQ version

3.1.0

Docker version

docker -v
Docker version 18.09.6, build 481bc77

How docker info?

ubuntu@ubuntu-HP-Pavilion-Desktop-PC-570-p0xx:~/EMQX$ docker info
Containers: 2
 Running: 0
 Paused: 0
 Stopped: 2
Images: 4
Server Version: 18.09.6
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 local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-20-generic
Operating System: Ubuntu 18.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.72GiB
Name: ubuntu-HP-Pavilion-Desktop-PC-570-p0xx
ID: A5ZC:223R:SI6U:GK2T:O2SV:CPQZ:NSX2:YNPK:UXE3:KZG4:55SO:AKKF
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
Product License: Community Engine

WARNING: No swap limit support

System

Linux ubuntu-HP-Pavilion-Desktop-PC-570-p0xx 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Hardware

HP-Pavilion-Desktop-PC-570

Rory-Z commented 5 years ago

We fixed this issue, now you can try to redeploy it

Huong-nt commented 5 years ago

I pull lasted version from https://hub.docker.com/r/emqx/emqx, but still got the same error.

Rory-Z commented 5 years ago

Sorry to reply so lately, you can give permission to the log directory 777, and then redeploy

$ sudo chmod 777 log
$ sudo docker-compose up
WARNING: Some services (emqtt-master) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
Recreating issue_emqtt-master_1 ... done
Attaching to issue_emqtt-master_1
emqtt-master_1  | node.max_ports=1048576
emqtt-master_1  | listener.tcp.external.acceptors=64
emqtt-master_1  | auth.http.auth_req.method=get
emqtt-master_1  | auth.http.super_req=http://127.0.0.1:5000/api/v1/mqtt/superuser
emqtt-master_1  | auth.http.acl_req=http://127.0.0.1:5000/api/v1/mqtt/acl
emqtt-master_1  | allow_anonymous=false
emqtt-master_1  | listener.ssl.external.acceptors=32
emqtt-master_1  | node.process_limit=2097152
emqtt-master_1  | node.max_ets_tables=2097152
emqtt-master_1  | listener.ws.external.acceptors=16
emqtt-master_1  | auth.http.super_req.method=get
emqtt-master_1  | node.name=emqtt-master@172.18.0.2
emqtt-master_1  | auth.http.acl_req.method=get
emqtt-master_1  | auth.http.auth_req=http://127.0.0.1:5000/api/v1/mqtt/auth
emqtt-master_1  | EMQX_LOADED_PLUGINS="emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_http"
emqtt-master_1  | emqx 3.1.1 is started successfully!
emqtt-master_1  | ['2019-05-13T02:59:40Z']:emqx start
Huong-nt commented 5 years ago

@zhanghongtong Thanks you! it works 👍

Rory-Z commented 5 years ago

You are welcome :)