bmartin5692 / bumper

A standalone and self-hosted implementation of the central server used by Ecovacs vacuum robots.
GNU General Public License v3.0
273 stars 48 forks source link

Docker Swarm + HAProxy not functional #106

Open zombielinux opened 3 years ago

zombielinux commented 3 years ago

Describe the bug Using the following docker compose in a docker swarm load balanced by haproxy:

version: '3.3'
services:
  bumper:
    image: bmartin5692/bumper:latest
    ports:
     - 8007:8007
     - 8883:8883
     - 5223:5223
    environment:
      BUMPER_ANNOUNCE_IP: 172.19.2.51
      BUMPER_DEBUG: "TRUE"
      BUMPER_LISTEN: 172.19.2.51
    networks:
     - default
     - traefik_proxy
    volumes:
     - bumper-data:/bumper/data
     - bumper-certs:/bumper/certs
     - bumper-logs:/bumper/logs
    deploy:
      labels:
        traefik.http.routers.bumper-insecure.entrypoints: web
        traefik.http.routers.bumper.entrypoints: websecure
        traefik.http.routers.bumper-insecure.rule: HostRegexp(`{subdomain:[a-z0-9._-]+}.ecovacs.net`, `{subdomain:[a-z0-9._-]+}.ecovacs.com`, `{subdomain:[a-z0-9._-]+}.ecouser.net`)
        traefik.http.services.bumper.loadbalancer.server.port: '80'
        traefik.http.routers.bumper-insecure.middlewares: bumper-https@docker
        traefik.http.routers.bumper.tls.certresolver: dns-cloudflare
        traefik.http.routers.bumper.tls: 'true'
        traefik.http.routers.bumper.tls.domains[0].main: 'ecovacs.net'
        traefik.http.routers.bumper.tls.domains[0].sans: '*.ecovacs.net'
        traefik.http.routers.bumper.rule: HostRegexp(`{subdomain:[a-z0-9._-]+}.ecovacs.net`, `{subdomain:[a-z0-9._-]+}.ecovacs.com`, `{subdomain:[a-z0-9._-]+}.ecouser.net`)
        traefik.http.middlewares.bumper-https.redirectscheme.scheme: https
        traefik.enable: 'true'
      placement:
        constraints:
         - node.role==worker

networks:
  default:
    driver: overlay
  traefik_proxy:
    external: true   

volumes:
  bumper-data:
    driver: local
    driver_opts:
      device: :/DockerDisks/Bumper/data
      o: addr={$NAS_HOST},rw,vers=4
      type: nfs
  bumper-certs:
    driver: local
    driver_opts:
      device: :/DockerDisks/Bumper/certs
      o: addr={$NAS_HOST},rw,vers=4
      type: nfs
  bumper-logs:
    driver: local
    driver_opts:
      device: :/DockerDisks/Bumper/logs
      o: addr={$NAS_HOST},rw,vers=4
      type: nfs

This error occurs.

[2020-10-15 09:03:55,840] :: ERROR :: mqttserver :: mqttserver :: broker_coro :: 159 :: Broker instance can't be started: [Errno 99] error while attempting to bind on address ('172.19.2.51', 8883): address not available

To Reproduce Steps to reproduce the behavior:

  1. Run docker-compose above in swarm environment
  2. Attempt to access via ingress IP
  3. See error

Expected behavior The container should advertize the local loadbalancer as its IP and the loadbalancer and swarm infrastructure should reroute the data back.

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Vacuum (please complete the following information):

Additional context Have a log file!

[2020-10-15 13:48:05,734] :: INFO :: bumper :: __init__ :: start :: 194 :: Starting Bumper,
[2020-10-15 13:48:05,735] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 61 :: Loading plugins for namespace hbmqtt.broker.plugins,
[2020-10-15 13:48:05,735] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin bumper = bumper.mqttserver:BumperMQTTServer_Plugin,
[2020-10-15 13:48:05,736] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin bumper = bumper.mqttserver:BumperMQTTServer_Plugin,
[2020-10-15 13:48:05,736] :: DEBUG :: hbmqtt.broker.plugins.bumper :: mqttserver :: _read_password_file :: 318 :: Reading user database from /bumper/data/passwd,
[2020-10-15 13:48:05,736] :: DEBUG :: hbmqtt.broker.plugins.bumper :: mqttserver :: _read_password_file :: 326 :: 0 user(s) read from file /bumper/data/passwd,
[2020-10-15 13:48:05,736] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin bumper ready,
[2020-10-15 13:48:05,739] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin auth_anonymous = hbmqtt.plugins.authentication:AnonymousAuthPlugin,
[2020-10-15 13:48:05,757] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin auth_anonymous = hbmqtt.plugins.authentication:AnonymousAuthPlugin,
[2020-10-15 13:48:05,758] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin auth_anonymous ready,
[2020-10-15 13:48:05,758] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin auth_file = hbmqtt.plugins.authentication:FileAuthPlugin,
[2020-10-15 13:48:05,758] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin auth_file = hbmqtt.plugins.authentication:FileAuthPlugin,
[2020-10-15 13:48:05,759] :: DEBUG :: hbmqtt.broker.plugins.auth_file :: authentication :: _read_password_file :: 63 :: Reading user database from /bumper/data/passwd,
[2020-10-15 13:48:05,759] :: DEBUG :: hbmqtt.broker.plugins.auth_file :: authentication :: _read_password_file :: 71 :: 0 user(s) read from file /bumper/data/passwd,
[2020-10-15 13:48:05,759] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin auth_file ready,
[2020-10-15 13:48:05,759] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin broker_sys = hbmqtt.plugins.sys.broker:BrokerSysPlugin,
[2020-10-15 13:48:05,760] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin broker_sys = hbmqtt.plugins.sys.broker:BrokerSysPlugin,
[2020-10-15 13:48:05,760] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin broker_sys ready,
[2020-10-15 13:48:05,760] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin packet_logger_plugin = hbmqtt.plugins.logging:PacketLoggerPlugin,
[2020-10-15 13:48:05,761] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin packet_logger_plugin = hbmqtt.plugins.logging:PacketLoggerPlugin,
[2020-10-15 13:48:05,761] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin packet_logger_plugin ready,
[2020-10-15 13:48:05,761] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin topic_taboo = hbmqtt.plugins.topic_checking:TopicTabooPlugin,
[2020-10-15 13:48:05,762] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin topic_taboo = hbmqtt.plugins.topic_checking:TopicTabooPlugin,
[2020-10-15 13:48:05,762] :: DEBUG :: hbmqtt.broker.plugins :: manager :: _load_plugins :: 65 ::  Plugin topic_taboo ready,
[2020-10-15 13:48:05,764] :: INFO :: mqttserver :: mqttserver :: broker_coro :: 152 :: Starting MQTT Server at 172.19.2.51:8883,
[2020-10-15 13:48:05,765] :: DEBUG :: hbmqtt.broker :: broker :: start :: 218 :: Broker starting,
[2020-10-15 13:48:05,765] :: DEBUG :: hbmqtt.broker :: broker :: start :: 231 :: Listener configuration 'default' is not bound,
[2020-10-15 13:48:05,768] :: DEBUG :: hbmqtt.client.plugins :: manager :: _load_plugins :: 61 :: Loading plugins for namespace hbmqtt.client.plugins,
[2020-10-15 13:48:05,768] :: DEBUG :: hbmqtt.client.plugins :: manager :: _load_plugin :: 69 ::  Loading plugin packet_logger_plugin = hbmqtt.plugins.logging:PacketLoggerPlugin,
[2020-10-15 13:48:05,768] :: DEBUG :: hbmqtt.client.plugins :: manager :: _load_plugin :: 71 ::  Initializing plugin packet_logger_plugin = hbmqtt.plugins.logging:PacketLoggerPlugin,
[2020-10-15 13:48:05,768] :: DEBUG :: hbmqtt.client.plugins :: manager :: _load_plugins :: 65 ::  Plugin packet_logger_plugin ready,
[2020-10-15 13:48:05,769] :: DEBUG :: hbmqtt.client :: client :: connect :: 140 :: Connect to: mqtts://172.19.2.51:8883/,
[2020-10-15 13:48:05,771] :: INFO :: xmppserver :: xmppserver :: start_async_server :: 30 :: Starting XMPP Server at 172.19.2.51:5223,
[2020-10-15 13:48:05,772] :: ERROR :: hbmqtt.broker :: broker :: start :: 295 :: Broker startup failed: [Errno 99] error while attempting to bind on address ('172.19.2.51', 8883): address not available,
[2020-10-15 13:48:05,773] :: ERROR :: mqttserver :: mqttserver :: broker_coro :: 159 :: Broker instance can't be started: [Errno 99] error while attempting to bind on address ('172.19.2.51', 8883): address not available,
Traceback (most recent call last):,
  File "/usr/local/lib/python3.7/site-packages/hbmqtt/broker.py", line 276, in start,
    loop=self._loop),
  File "/usr/local/lib/python3.7/asyncio/streams.py", line 114, in start_server,
    return await loop.create_server(factory, host, port, **kwds),
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1385, in create_server,
    % (sa, err.strerror.lower())) from None,
OSError: [Errno 99] error while attempting to bind on address ('172.19.2.51', 8883): address not available,
,
During handling of the above exception, another exception occurred:,
,
Traceback (most recent call last):,
  File "/bumper/bumper/mqttserver.py", line 156, in broker_coro,
    await self.broker.start(),
  File "/usr/local/lib/python3.7/site-packages/hbmqtt/broker.py", line 297, in start,
    raise BrokerException("Broker instance can't be started: %s" % e),
hbmqtt.broker.BrokerException: Broker instance can't be started: [Errno 99] error while attempting to bind on address ('172.19.2.51', 8883): address not available,
[2020-10-15 13:48:05,773] :: ERROR :: xmppserver :: xmppserver :: start_async_server :: 50 :: [Errno 99] error while attempting to bind on address ('172.19.2.51', 5223): address not available,
Traceback (most recent call last):,
  File "/bumper/bumper/xmppserver.py", line 36, in start_async_server,
    self.xmpp_protocol, host=self.address[0], port=self.address[1],
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1385, in create_server,
    % (sa, err.strerror.lower())) from None,
OSError: [Errno 99] error while attempting to bind on address ('172.19.2.51', 5223): address not available,
[2020-10-15 13:48:05,774] :: INFO :: bumper :: __init__ :: shutdown :: 239 :: Shutting down,
[2020-10-15 13:48:05,774] :: ERROR :: confserver :: confserver :: stop_server :: 174 :: 'NoneType' object has no attribute 'shutdown',
Traceback (most recent call last):,
  File "/bumper/bumper/confserver.py", line 171, in stop_server,
    await self.runner.shutdown(),
AttributeError: 'NoneType' object has no attribute 'shutdown',
[2020-10-15 13:48:05,775] :: ERROR :: confserver :: confserver :: stop_server :: 174 :: 'NoneType' object has no attribute 'shutdown',
Traceback (most recent call last):,
  File "/bumper/bumper/confserver.py", line 171, in stop_server,
    await self.runner.shutdown(),
AttributeError: 'NoneType' object has no attribute 'shutdown',
[2020-10-15 13:48:05,775] :: INFO :: bumper :: __init__ :: shutdown :: 265 :: Shutdown complete,
[2020-10-15 13:48:05,775] :: WARNING :: hbmqtt.client :: client :: _connect_coro :: 426 :: MQTT connection failed: ConnectionResetError(),
[2020-10-15 13:48:05,775] :: WARNING :: hbmqtt.client :: client :: connect :: 145 :: Connection failed: ConnectException(ConnectionResetError()),
[2020-10-15 13:48:05,776] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 193 :: Reconnecting with session parameters: Session(clientId=helperbot@bumper/helperbot, state=disconnected),
[2020-10-15 13:48:06,776] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 200 :: Reconnect attempt 1 ...,
[2020-10-15 13:48:06,778] :: WARNING :: hbmqtt.client :: client :: _connect_coro :: 426 :: MQTT connection failed: ConnectionResetError(),
[2020-10-15 13:48:06,778] :: WARNING :: hbmqtt.client :: client :: reconnect :: 203 :: Reconnection attempt failed: ConnectException(ConnectionResetError()),
[2020-10-15 13:48:06,778] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 209 :: Waiting 2 second before next attempt,
[2020-10-15 13:48:08,780] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 200 :: Reconnect attempt 2 ...,
[2020-10-15 13:48:08,782] :: WARNING :: hbmqtt.client :: client :: _connect_coro :: 426 :: MQTT connection failed: ConnectionResetError(),
[2020-10-15 13:48:08,782] :: WARNING :: hbmqtt.client :: client :: reconnect :: 203 :: Reconnection attempt failed: ConnectException(ConnectionResetError()),
[2020-10-15 13:48:08,782] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 209 :: Waiting 4 second before next attempt,
[2020-10-15 13:48:12,783] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 200 :: Reconnect attempt 3 ...,
[2020-10-15 13:48:12,785] :: WARNING :: hbmqtt.client :: client :: _connect_coro :: 426 :: MQTT connection failed: ConnectionResetError(),
[2020-10-15 13:48:12,785] :: WARNING :: hbmqtt.client :: client :: reconnect :: 203 :: Reconnection attempt failed: ConnectException(ConnectionResetError()),
[2020-10-15 13:48:12,785] :: DEBUG :: hbmqtt.client :: client :: reconnect :: 209 :: Waiting 8 second before next attempt,