Open renatomotorline opened 4 years ago
Hi, @renatomotorline, sorry for late reply there
I suggest you change the health check address to http://127.0.0.1:8081/status
and try again
@zhanghongtong the problem persists. Even if I put the healthcheck command equal to exit 0.
@renatomotorline Can you share the contents of log/emqx.log.*
and log/erlang.log.*
after the health check failed?
The fail is before the health check I think because the health check has an interval of 2 minutes and the container fails after approximately 40 seconds. If I run the container works fine.
docker run emqx-backend:1.0.0
If I deploy in the docker swarm the problem happens.
docker stack deploy --with-registry-auth -c docker-compose.yml emqx-backend
The /opt/emqx/log/emqx.log.* only give �
/opt/emqx/log/erlang.log.*
cat /var/lib/docker/volumes/emqx-backend_emqx-backend01-logs/_data/erlang.log.*
=====
===== LOGGING STARTED Tue May 12 09:46:43 UTC 2020
=====
Exec: /opt/emqx/erts-10.5.6/bin/erlexec -boot /opt/emqx/releases/v4.0.5/emqx -mode embedded -boot_var ERTS_LIB_DIR /opt/emqx/erts-10.5.6/../lib -mnesia dir "/opt/emqx/data/mnesia/emqx@emqx.backend01" -config /opt/emqx/data/configs/app.2020.05.12.09.46.45.config -args_file /opt/emqx/data/configs/vm.2020.05.12.09.46.45.args -vm_args /opt/emqx/data/configs/vm.2020.05.12.09.46.45.args -start_epmd false -epmd_module ekka_epmd -proto_dist ekka -- console
Root: /opt/emqx
/opt/emqx
Starting emqx on node emqx@emqx.backend01
Start http:management listener on 8081 successfully.
Start http:dashboard listener on 18083 successfully.
Start mqtt:tcp listener on 127.0.0.1:11883 successfully.
Start mqtt:tcp listener on 0.0.0.0:1883 successfully.
Start mqtt:ws listener on 0.0.0.0:8083 successfully.
Start mqtt:ssl listener on 0.0.0.0:8883 successfully.
Start mqtt:wss listener on 0.0.0.0:8084 successfully.
EMQ X Broker 4.0.5 is running now!
Eshell V10.5.6 (abort with ^G)
docker-compose.yml
version: "3.3"
services:
emqx-backend01:
image: emqx-backend:1.0.0
environment:
- "EMQX_LOADED_PLUGINS=\"emqx_management,emqx_auth_http,emqx_recon,emqx_retainer,emqx_dashboard\""
- "EMQX_NAME=emqx"
- "EMQX_HOST=emqx.backend01"
- "EMQX_CLUSTER__DISCOVERY=static"
- "EMQX_CLUSTER__STATIC__SEEDS=emqx@emqx.backend01, emqx@emqx.backend02, emqx@emqx.backend03"
volumes:
- emqx-backend01-logs:/opt/emqx/log
deploy:
replicas: 1
placement:
constraints:
# - node.role == worker
- node.labels.worker == 1
restart_policy:
condition: none
labels:
- "traefik.enable=true"
- "traefik.docker.network=local-network"
# http with redirection
- "traefik.http.routers.emqx-backend-dashboard.entrypoints=web"
- "traefik.http.routers.emqx-backend-dashboard.rule=Host(`<HOSTNAME>`)"
- "traefik.http.middlewares.redirect-middleware.redirectscheme.scheme=https"
- "traefik.http.routers.emqx-backend-dashboard.middlewares=redirect-middleware"
# https
- "traefik.http.routers.emqx-backend-dashboard-secure.rule=Host(`<HOSTNAME>`)"
- "traefik.http.routers.emqx-backend-dashboard-secure.entrypoints=websecure"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls=true"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls.certresolver=myresolver"
- "traefik.http.routers.emqx-backend-dashboard-secure.service=service-emqx-backend-dashboard"
- "traefik.http.services.service-emqx-backend-dashboard.loadbalancer.server.port=18083"
# mqtts
- "traefik.tcp.routers.emqx-backend-mqtts.entrypoints=mqtts-backend"
- "traefik.tcp.routers.emqx-backend-mqtts.rule=HostSNI(`<HOSTNAME>`)"
- "traefik.tcp.routers.emqx-backend-mqtts.tls=true"
- "traefik.tcp.routers.emqx-backend-mqtts.tls.certresolver=myresolver"
- "traefik.tcp.routers.emqx-backend-mqtts.service=service-mqtts-backend"
- "traefik.tcp.services.service-mqtts-backend.loadbalancer.server.port=1883"
networks:
local-network:
aliases:
- emqx.backend01
- emqx.backend
emqx-backend02:
image: emqx-backend:1.0.0
environment:
- "EMQX_LOADED_PLUGINS=\"emqx_management,emqx_auth_http,emqx_recon,emqx_retainer,emqx_dashboard\""
- "EMQX_NAME=emqx"
- "EMQX_HOST=emqx.backend02"
- "EMQX_CLUSTER__DISCOVERY=static"
- "EMQX_CLUSTER__STATIC__SEEDS=emqx@emqx.backend01, emqx@emqx.backend02, emqx@emqx.backend03"
deploy:
replicas: 1
placement:
constraints:
# - node.role == worker
- node.labels.worker == 2
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.docker.network=local-network"
# http with redirection
- "traefik.http.routers.emqx-backend-dashboard.entrypoints=web"
- "traefik.http.routers.emqx-backend-dashboard.rule=Host(`<HOSTNAME>`)"
- "traefik.http.middlewares.redirect-middleware.redirectscheme.scheme=https"
- "traefik.http.routers.emqx-backend-dashboard.middlewares=redirect-middleware"
# https
- "traefik.http.routers.emqx-backend-dashboard-secure.rule=Host(`<HOSTNAME>`)"
- "traefik.http.routers.emqx-backend-dashboard-secure.entrypoints=websecure"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls=true"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls.certresolver=myresolver"
- "traefik.http.routers.emqx-backend-dashboard-secure.service=service-emqx-backend-dashboard"
- "traefik.http.services.service-emqx-backend-dashboard.loadbalancer.server.port=18083"
# mqtts
- "traefik.tcp.routers.emqx-backend-mqtts.entrypoints=mqtts-backend"
- "traefik.tcp.routers.emqx-backend-mqtts.rule=HostSNI(`<HOSTNAME>`)"
- "traefik.tcp.routers.emqx-backend-mqtts.tls=true"
- "traefik.tcp.routers.emqx-backend-mqtts.tls.certresolver=myresolver"
- "traefik.tcp.routers.emqx-backend-mqtts.service=service-mqtts-backend"
- "traefik.tcp.services.service-mqtts-backend.loadbalancer.server.port=1883"
networks:
local-network:
aliases:
- emqx.backend02
- emqx.backend
emqx-backend03:
image: emqx-backend:1.0.0
environment:
- "EMQX_LOADED_PLUGINS=\"emqx_management,emqx_auth_http,emqx_recon,emqx_retainer,emqx_dashboard\""
- "EMQX_NAME=emqx"
- "EMQX_HOST=emqx.backend03"
- "EMQX_CLUSTER__DISCOVERY=static"
- "EMQX_CLUSTER__STATIC__SEEDS=emqx@emqx.backend01, emqx@emqx.backend02, emqx@emqx.backend03"
deploy:
replicas: 1
placement:
constraints:
# - node.role == worker
# - node.labels.mongo.replica == 3
- node.labels.worker == 3
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.docker.network=local-network"
# http with redirection
- "traefik.http.routers.emqx-backend-dashboard.entrypoints=web"
- "traefik.http.routers.emqx-backend-dashboard.rule=Host(`<HOSTNAME>`)"
- "traefik.http.middlewares.redirect-middleware.redirectscheme.scheme=https"
- "traefik.http.routers.emqx-backend-dashboard.middlewares=redirect-middleware"
# https
- "traefik.http.routers.emqx-backend-dashboard-secure.rule=Host(`<HOSTNAME>`)"
- "traefik.http.routers.emqx-backend-dashboard-secure.entrypoints=websecure"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls=true"
- "traefik.http.routers.emqx-backend-dashboard-secure.tls.certresolver=myresolver"
- "traefik.http.routers.emqx-backend-dashboard-secure.service=service-emqx-backend-dashboard"
- "traefik.http.services.service-emqx-backend-dashboard.loadbalancer.server.port=18083"
# mqtts
- "traefik.tcp.routers.emqx-backend-mqtts.entrypoints=mqtts-backend"
- "traefik.tcp.routers.emqx-backend-mqtts.rule=HostSNI(`<HOSTNAME>`)"
- "traefik.tcp.routers.emqx-backend-mqtts.tls=true"
- "traefik.tcp.routers.emqx-backend-mqtts.tls.certresolver=myresolver"
- "traefik.tcp.routers.emqx-backend-mqtts.service=service-mqtts-backend"
- "traefik.tcp.services.service-mqtts-backend.loadbalancer.server.port=1883"
networks:
local-network:
aliases:
- emqx.backend03
- emqx.backend
networks:
local-network:
external: true
volumes:
emqx-backend01-logs:
@renatomotorline Sorry, I don't have a docker swarm cluster, so I can't test the docker-compose.yaml
file you gave me, but I deleted deploy
from the docker-compose.yaml
file and set the network to driver: bridge
, then it is possible to successfully deploy the docker-compose cluster, and the health check is also passed, so it is recommended that you review your own docker swarm deployment
Expected behavior
The container execute the healthcheck and don't exit.
Actual behavior
Container exits abnormally approximately 40 seconds after start. The healthcheck is 2m. If I remove the healthcheck all works ok.
Docker logs
Test Dockerfile
EMQ version
emqx/emqx:v4.0.5
Docker version
Which docker-engine version?
How docker info?
System
What system do you use? CentOS Linux release 8.1.1911 (Core)