Skip to content

Teslamate 2.0 failed to connect to mosquitto #4725

@slavag

Description

@slavag

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

I have docker installation of teslamate. This is the yml :

services:
  teslamate:
    image: teslamate/teslamate:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=****
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - MQTT_HOST=mosquitto
      - ENCRYPTION_KEY=*****
    ports:
      - 4000:4000
    volumes:
      - ./import:/opt/app/import
    cap_drop:
      - all

  database:
    image: postgres:17
    restart: always
    environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=****
      - POSTGRES_DB=teslamate
    volumes:
      - teslamate-db:/var/lib/postgresql/data

  grafana:
    image: teslamate/grafana:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=*****
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
    ports:
      - 3000:3000
    volumes:
      - teslamate-grafana-data:/var/lib/grafana

  mosquitto:
    image: eclipse-mosquitto:2
    restart: always
    ports:
      - 1883:1883
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

volumes:
  teslamate-db:
  teslamate-grafana-data:
  mosquitto-conf:
  mosquitto-data:

mosquitto is running without any issue, but teslamate failed to connect :

1746566201: mosquitto version 2.0.21 starting,
1746566201: Config loaded from /mosquitto/config/mosquitto.conf.,
1746566201: Starting in local only mode. Connections will only be possible from clients running on this machine.,
1746566201: Create a configuration file which defines a listener to allow remote access.,
1746566201: For more details see https://mosquitto.org/documentation/authentication-methods/,
1746566201: Opening ipv4 listen socket on port 1883.,
1746566201: Opening ipv6 listen socket on port 1883.,
1746566201: mosquitto version 2.0.21 running,
1746566227: mosquitto version 2.0.21 terminating,
1746566525: mosquitto version 2.0.21 starting,
1746566525: Config loaded from /mosquitto/config/mosquitto.conf.,
1746566525: Starting in local only mode. Connections will only be possible from clients running on this machine.,
1746566525: Create a configuration file which defines a listener to allow remote access.,
1746566525: For more details see https://mosquitto.org/documentation/authentication-methods/,
1746566525: Opening ipv4 listen socket on port 1883.,
1746566525: Opening ipv6 listen socket on port 1883.,
1746566525: mosquitto version 2.0.21 running,
1746566751: mosquitto version 2.0.21 starting,
1746566751: Config loaded from /mosquitto/config/mosquitto.conf.,
1746566751: Starting in local only mode. Connections will only be possible from clients running on this machine.,
1746566751: Create a configuration file which defines a listener to allow remote access.,
1746566751: For more details see https://mosquitto.org/documentation/authentication-methods/,
1746566751: Opening ipv4 listen socket on port 1883.,
1746566751: Opening ipv6 listen socket on port 1883.,
1746566751: mosquitto version 2.0.21 running,
1746566834: mosquitto version 2.0.21 terminating,
1746567110: mosquitto version 2.0.21 starting,
1746567110: Config loaded from /mosquitto/config/mosquitto.conf.,
1746567110: Starting in local only mode. Connections will only be possible from clients running on this machine.,
1746567110: Create a configuration file which defines a listener to allow remote access.,
1746567110: For more details see https://mosquitto.org/documentation/authentication-methods/,
1746567110: Opening ipv4 listen socket on port 1883.,
1746567110: Opening ipv6 listen socket on port 1883.,
1746567110: mosquitto version 2.0.21 running

While trying to connect via telnet to port 1883 , I'm getting, seems that it's running :

telnet localhost 1883
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

And yet Teslamate failed to connect, and failed to start

Expected Behavior

No response

Steps To Reproduce

No special steps

Relevant log output

ubuntu-teslamate-1  | waiting for postgres at database:5432
ubuntu-teslamate-1  | 2025-05-06 21:16:44.084 [info] Migrations already up
ubuntu-teslamate-1  | 2025-05-06 21:16:47.532 [info] No tzdata release files found in custom data dir. Copying release file from tzdata priv dir.
ubuntu-teslamate-1  | 2025-05-06 21:16:47.834 [info] System Info: Erlang/OTP 26 (emu)
ubuntu-teslamate-1  | 2025-05-06 21:16:47.835 [info] Version: 2.0.0
ubuntu-teslamate-1  | PostgreSQL version 17.4 is compatible (17.x series).
ubuntu-teslamate-1  | 2025-05-06 21:16:50.406 [info] POST https://auth.tesla.com/oauth2/v3/token -> 200 (2230.748 ms)
ubuntu-teslamate-1  | 2025-05-06 21:16:50.406 [info] Refreshed api tokens
ubuntu-teslamate-1  | 2025-05-06 21:16:50.418 [info] Scheduling token refresh in 6 h
ubuntu-teslamate-1  | 2025-05-06 21:16:50.438 [info] Running TeslaMateWeb.Endpoint with cowboy 2.13.0 at :::4000 (http)
ubuntu-teslamate-1  | 2025-05-06 21:16:50.441 [info] Access TeslaMateWeb.Endpoint at http://localhost
ubuntu-teslamate-1  | 2025-05-06 21:16:50.910 [info] Starting logger for 'Black Cat'
ubuntu-teslamate-1  | 2025-05-06 21:16:50.924 [info] Starting logger for 'Teslorean'
ubuntu-teslamate-1  | 2025-05-06 21:16:50.999 [info] tzdata release in place is from a file last modified Thu, 05 Sep 2024 18:47:42 GMT. Release file on server was last modified Sat, 22 Mar 2025 21:45:31 GMT.
ubuntu-teslamate-1  | 2025-05-06 21:16:51.091 car_id=2 [info] Start / :offline
ubuntu-teslamate-1  | 2025-05-06 21:16:51.330 car_id=1 [info] Start / :offline
ubuntu-teslamate-1  | 2025-05-06 21:16:51.603 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 100 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:51.707 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 200 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:51.909 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 400 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:52.313 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 800 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:53.120 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 1600 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:54.724 [warning] [Tortoise311] Connection failed: {:connection_refused, ~c"mosquitto", 1883}, %{port: 1883, status: :down, protocol: "MQTT", host: ~c"mosquitto", protocol_version: 4, keep_alive: 60, transport: Tortoise311.Transport.Tcp, clean_session: true, client_id: "TESLAMATE_302E3033343", subscriptions: %Tortoise311.Package.Subscribe{__META__: %Tortoise311.Package.Meta{opcode: 8, flags: 2}, identifier: nil, topics: []}}. Retrying in 3200 msecs.
ubuntu-teslamate-1  | 2025-05-06 21:16:55.063 [info] Tzdata has updated the release from 2024b to 2025b
ubuntu-teslamate-1  | 2025-05-06 21:16:56.102 [warning] MQTT publishing failed: :timeout
ubuntu-teslamate-1  | 2025-05-06 21:16:56.102 [warning] MQTT publishing failed: :timeout
ubuntu-teslamate-1  | 2025-05-06 21:16:56.103 [warning] MQTT publishing failed: :timeout
error from daemon in stream: Error grabbing logs: invalid character '\x00' looking for beginning of value

Screenshots

No response

Additional data

No response

Type of installation

Docker

Version

v2.0.0

PostgreSQL version

v17.4

Are you running latest major supported PostgreSQL version?

  • I run the latest major supported PostgreSQL version

Metadata

Metadata

Assignees

No one assigned

    Labels

    undeterminedNot sure if this is considered a real bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions