Teslamate -> Node-Red -> Postgres database issues

Hi all,

this is not a real Node-Red problem but I do not know where else to put it and I know that the know-how around node-red, docker, postgres, etc. is really high in this forum.

And: I am willing to pay real money :money_mouth_face: for useful support, because I am really stuck as I simply do not have the necessary know-how around this topic.

In the past I had Teslamate (a tool to track your Tesla in every small detail over time) on a local Raspberry Pi in a docker container with a postgres database and grafana - I installed everything based on a very good instruction and it worked really well.

Afterwards I sent a lot of data via MQTT to my local Node-Red service and did some pushover messaging and some other fancy stuff :smiley:

Three weeks ago the whole setup went down and collapsed. I assume it was because of using a microSD card that simply got damaged by a lot of database transactions over time.
No backup ... I know .... let's not discuss this part of the issue :roll_eyes:

I somehow managed to extract and restore the postgres database (2GB) from the microSD card and set up a new teslamate installation (for the future) on my Synology NAS with portainer and automated backup. But this one holds data from 10.08 onwards ... all history data is gone of course.

Now the task is to extract the data from the old database and inject it to the new one. Teslamate has some import/export functionality, but to be able to extract data from the old database I have to do a fresh setup of teslamate on a raspberry with the old database first of all.

Basically I managed to set up teslamate on a raspberry with old postgres version 13, then I copied the old database to the folder where teslamate is expecting it and tried to harmonize the database user/password and the compose.yml files user/password but although I am struggling and trying for two weeks now, I am not able to bring the database up and running.

This is how I changed the old database user/password:
image

This is how I configured the YML file:

environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_DB=teslamate
    volumes:
      - teslamate-db:/var/lib/postgresql/data

And this is the latest outcome when I try to start the container:


xxx@rasptest:~/teslamate $ docker compose logs -f
mosquitto-1  | 1724104066: mosquitto version 2.0.18 starting
teslamate-1  | 2024-08-19 21:47:54.753 [error] Postgrex.Protocol (#PID<0.172.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "teslamate"
teslamate-1  | 2024-08-19 21:47:54.753 [error] Postgrex.Protocol (#PID<0.173.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "teslamate"
teslamate-1  | 2024-08-19 21:47:56.677 [error] Postgrex.Protocol (#PID<0.172.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "teslamate"
teslamate-1  | 2024-08-19 21:47:57.367 [error] Postgrex.Protocol (#PID<0.173.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "teslamate"
teslamate-1  | 2024-08-19 21:47:57.621 [error] Could not create schema migrations table. This error usually happens due to the following:
teslamate-1  |
teslamate-1  |   * The database does not exist
teslamate-1  |   * The "schema_migrations" table, which Ecto uses for managing
teslamate-1  |     migrations, was defined by another library
teslamate-1  |   * There is a deadlock while migrating (such as using concurrent
teslamate-1  |     indexes with a migration_lock)
teslamate-1  |
teslamate-1  | To fix the first issue, run "mix ecto.create" for the desired MIX_ENV.
teslamate-1  |
teslamate-1  | To address the second, you can run "mix ecto.drop" followed by
teslamate-1  | "mix ecto.create", both for the desired MIX_ENV. Alternatively you may
teslamate-1  | configure Ecto to use another table and/or repository for managing
teslamate-1  | migrations:
teslamate-1  |
teslamate-1  |     config :teslamate, TeslaMate.Repo,
teslamate-1  |       migration_source: "some_other_table_for_schema_migrations",
teslamate-1  |       migration_repo: AnotherRepoForSchemaMigrations
teslamate-1  |
error from daemon in stream: Error grabbing logs: invalid character '\x00' looking for beginning of value

If the specialists in this forum see any chance to help me ... please ! As mentioned already, I will pay if I will get this thing up and running again

BR
Gawan