jurriaan / meshstellar

✨ Monitor your Meshtastic constellation
MIT License
17 stars 0 forks source link

MQTT connection refused #3

Closed bartagergely closed 2 weeks ago

bartagergely commented 2 weeks ago

Hi,

I am trying to get this application running, but so far I did not have luck. The changes I made in the docker-compose.yml:

Changed host to: MESHSTELLAR_MQTT_HOST: 'meshstellar-mqtt' Added: container_name: meshstellar-mqtt to mqtt container Attached the containers to the same bridged network Exposed port 1883 on the mqtt container (And added some labels to the web container to have it working together with the reverse proxy)

What I see, that the Matt container is restarting in a loop, and the logs in every second the following:

meshstellar-mqtt    | 2024-06-21T22:17:31.373158Z  INFO meshstellar: Meshstellar v0.1.27-1-g81b8a46 (81b8a465511db91144fd59c61ab433d99069233f 2024-06-15T10:59:43.062323778Z)
meshstellar-mqtt    | 2024-06-21T22:17:31.375203Z  INFO meshstellar::mqtt_processor: Starting MQTT processor
meshstellar-mqtt    | 2024-06-21T22:17:31.375262Z  INFO meshstellar::util: MQTT (meshstellar-mqtt:1883) connecting..
meshstellar-mqtt    | 2024-06-21T22:17:31.376425Z ERROR meshstellar: An error occurred: I/O: Connection refused (os error 111)
meshstellar-mqtt    |
meshstellar-mqtt    | Caused by:
meshstellar-mqtt    |     Connection refused (os error 111)

Here is my compose file (if the above description is to messy):

x-common-envs: &common-envs
  MESHSTELLAR_DATABASE_URL: 'sqlite:///home/meshstellar/meshstellar.db?mode=rwc'
  MESHSTELLAR_HTTP_ADDR: 0.0.0.0:3000
  MESHSTELLAR_MAP_GLYPHS_URL: 'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf'
  MESHSTELLAR_MQTT_AUTH: 'true'
  MESHSTELLAR_MQTT_CLIENT_ID: 'meshstellar'
  MESHSTELLAR_MQTT_HOST: 'meshstellar-mqtt'
  MESHSTELLAR_MQTT_KEEP_ALIVE: '15'
  MESHSTELLAR_MQTT_PASSWORD: 'password'
  MESHSTELLAR_MQTT_PORT: '1883'
  MESHSTELLAR_MQTT_TOPIC: "meshtastic/#"
  MESHSTELLAR_MQTT_USERNAME: 'username'
  MESHSTELLAR_OPEN_BROWSER: 'false'
  MESHSTELLAR_HIDE_PRIVATE_MESSAGES: 'false'
services:
  mqtt:
    image: ghcr.io/jurriaan/meshstellar:latest
    container_name: meshstellar-mqtt
    user: '65532:65532'
    environment: *common-envs
    restart: on-failure
    expose:
      - 1883
    volumes:
      - meshstellar_data:/home/meshstellar:z
    command:
      - /usr/local/bin/meshstellar
      - mqtt
    networks:
      traefik-network:

  web:
    image: ghcr.io/jurriaan/meshstellar:latest
    container_name: meshstellar-web
    user: '65532:65532'
    expose:
      - 3000
    environment: *common-envs
    restart: on-failure
    volumes:
      - meshstellar_data:/home/meshstellar:z
    command:
      - /usr/local/bin/meshstellar
      - web
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.meshstellar.loadbalancer.server.port=3000"
      - "traefik.http.routers.meshstellar.rule=Host(`some.domain.name`)"
      - "traefik.http.routers.meshstellar.entrypoints=websecure"
      - "traefik.http.routers.meshstellar.tls.certresolver=letsencrypt"
    networks:
      traefik-network:

  import:
    image: ghcr.io/jurriaan/meshstellar:latest
    container_name: meshstellar-import
    user: '65532:65532'
    environment: *common-envs
    restart: on-failure
    volumes:
      - meshstellar_data:/home/meshstellar:z
    command:
      - /usr/local/bin/meshstellar
      - import
    networks:
      traefik-network:

volumes:
  meshstellar_data:

networks:
  traefik-network:
    external: true

What could be the issue here? For me it seems that something from the mqtt container tries to connect back to itself. But they why does it get refused?

The network in the docker seems to work, when I open the application in a browser, then I get the world map.

Thanks!

bartagergely commented 2 weeks ago

Never mind... First I thought the mqtt container is a bundled mitt-broker, but later I figured out that I needed to run my own broker. Sorry for the noise.

jurriaan commented 2 weeks ago

Might be good to better document that, thanks!