2025년 4월 26일 Teslsmate v.2.0.0이 공개되었다 (https://github.com/teslamate-org/teslamate/releases).
2025년 6월 15일 Teslamate 버전 1.3.2에서 2.0.0으로 업데이트를 시도하면서 남기는 기록.
This update requires postgreSQL version 16.7, 17.3 or higher.
1. Check current version
pi@raspberrypi:~/teslamate $ docker compose exec database postgres –version
WARN[0000] /home/pi/teslamate/docker-compose.yml:versionis obsolete
postgres (PostgreSQL) 16.6 (Debian 16.6-1.pgdg120+1)
2. Create database backup
docker compose exec -T database pg_dump -U teslamate teslamate > ./teslamate_2025-06-15.bck

3. Stop the running containers

4. Update the ‘docker-compose.yml’
Open the ‘docker-compose.yml’ file and update the image version.
services:
database:
image: postgres:17
...

5. (Error) Run the ‘database’ container
pi@raspberrypi:~/teslamate $ docker compose up -d database
WARN[0000] /home/pi/teslamate/docker-compose.yml:versionis obsolete
[+] Running 0/0
⠋ database Pulling 0.1s
error getting credentials – err: exit status 1, out:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files

5-1. Try Manual Pull
pi@raspberrypi:~/teslamate $ docker pull postgres:17
17: Pulling from library/postgres
6aafc35ac588: Pull complete
1f678460491e: Pull complete
ab1541c2cc21: Pull complete
2a1dd2cd14ae: Pull complete
bb6197ced2d4: Pull complete
3e751019b3b3: Pull complete
533b1db07902: Pull complete
436d3b49bcef: Pull complete
b28acd88fcff: Pull complete
019b2c634abf: Pull complete
b1dbcb6d4226: Pull complete
6f04b6d20f78: Pull complete
209fb6f4de59: Pull complete
18c843985750: Pull complete
Digest: sha256:6cf6142afacfa89fb28b894d6391c7dcbf6523c33178bdc33e782b3b533a9342
Status: Downloaded newer image for postgres:17
docker.io/library/postgres:17
5-2. Run the ‘database’ container again
pi@raspberrypi:~/teslamate $ docker compose up -d database
[+] Running 3/3
✔ Network teslamate_default Created 0.2s
✔ Volume “teslamate_teslamate-db” Created 0.0s
✔ Container teslamate-database-1 Started
Not sure the manual pull cleared the error away or re-trying it did the job, it runs now.
6. Check postgres version
pi@raspberrypi:~/teslamate $ docker compose exec database postgres –version
postgres (PostgreSQL) 17.5 (Debian 17.5-1.pgdg120+1)
Now pulled 17.5 version is pulled.
7. (Error) Pull all docker containers
pi@raspberrypi:~/teslamate $ docker compose pull
[+] Pulling 0/0
⠋ grafana Pulling 0.0s
⠋ teslamate Pulling 0.0s
⠋ database Pulling 0.0s
⠋ mosquitto Pulling 0.0s
error getting credentials – err: exit status 1, out:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
This means Docker is trying to access stored credentials (e.g., from a keyring or secret manager), but my environment doesn’t have a running secret service (like GNOME Keyring or similar).
7-1. Install the secret service
pi@raspberrypi:~/teslamate $ sudo apt install gnome-keyring
7-2. Pull docker images
pi@raspberrypi:~/teslamate $ docker compose pull
[+] Pulling 31/31
✔ teslamate Pulled 27.7s
✔ addc1be20d09 Pull complete 10.5s
✔ 5128e741d0c8 Pull complete 10.7s
✔ 294835a1471d Pull complete 11.4s
✔ 795155113141 Pull complete 11.9s
✔ 7518e5dcc2e3 Pull complete 23.5s
✔ 289188b73aff Pull complete 23.9s
✔ mosquitto Pulled 19.0s
✔ 76099982f066 Pull complete 10.1s
✔ 59fdea63e2e9 Pull complete 14.0s
✔ bc41ff03e4bf Pull complete 15.2s
✔ database Pulled 2.4s
✔ grafana Pulled 60.6s
✔ 85f3b18f9f5a Pull complete 11.1s
✔ 2c6d01fffec5 Pull complete 11.2s
✔ c42de6df1517 Pull complete 15.6s
✔ 5fb4475f3ee1 Pull complete 16.3s
✔ 384236ac3b65 Pull complete 16.5s
✔ 7c2c04a8572b Pull complete 16.8s
✔ d60f34454bb3 Pull complete 36.3s
✔ 6c1703403c0b Pull complete 54.9s
✔ 8e9b79f51b66 Pull complete 55.9s
✔ 55e463089067 Pull complete 56.0s
✔ b8bfedf2304b Pull complete 56.1s
✔ 2f1c786ddd98 Pull complete 56.2s
✔ 58f4ca4f08ce Pull complete 56.3s
✔ 3f9dea0119cc Pull complete 56.3s
✔ b4e23da631a9 Pull complete 56.4s
✔ 495928fed2e7 Pull complete 56.5s
✔ bf99d1f7e253 Pull complete 56.6s
✔ 201936771044 Pull complete
Now no error while pulling the images.
8. Restore data from the backup
It was advised in the documentation that:
# Stop the teslamate container to avoid write conflicts
docker compose stop teslamate
# Drop existing data and reinitialize (Don’t forget to replace first teslamate if using different TM_DB_USER)
# Connects to the teslamate database as user teslamate.
#Completely drops the public schema, which deletes all tables and #data.
#Recreates the public schema.
# Adds extensions cube and earthdistance, which are used by TeslaMate for geographic calculations.
docker compose exec -T database psql -U teslamate teslamate << .
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
CREATE EXTENSION cube WITH SCHEMA public;
CREATE EXTENSION earthdistance WITH SCHEMA public;
.
# Restore
docker compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
# Restart the teslamate container
docker compose start teslamate
But it didn’t go easy as it seems.
8-1. (Error) Dropping existing data and reinitilize
pi@raspberrypi:~/teslamate $ docker compose exec -T database psql -U teslamate teslamate << .
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
CREATE EXTENSION cube WITH SCHEMA public;
CREATE EXTENSION earthdistance WITH SCHEMA public;
.
service “database” is not running
The error service “database” is not running means ‘Docker Compose’ cannot find a running container named database as defined in your docker-compose.yml file. The ‘yml’ file should define the name “database” as
services:
database:
image: postgres:17
...
But with the name properly defined I still got an error when I try to run the database container
pi@raspberrypi:~/teslamate $ docker compose up -d database
[+] Running 1/2
✔ Network teslamate_default Created 0.4s
⠙ Container teslamate-database-1 Starting 1.1s
Error response from daemon: network 25966f0aefa97e371018f3acea4d80d5572bb6b179dfeac2745afe621f5f84f3 not found

Teslamate docs has a note that says:
If you get the error
No such service: database, update your docker-compose.yml or usedbinstead ofdatabasein the above command.
It doesn’t clearly state to which name should the ‘docker-compose.yml’ be updated, but let us try changing ‘database’ into ‘db’.
services:
db:
image: postgres:17
...
And run the container with the new name.
pi@raspberrypi:~/teslamate $ docker compose up -d db
WARN[0000] Found orphan containers ([teslamate-database-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the –remove-orphans flag to clean it up.
[+] Running 1/1
✔ Container teslamate-db-1 Started

Since the database name has been defined as ‘db’, the line ‘DATABASE_HOST = database’ should be updated as well. If not, we’ll see error logs like:
pi@raspberrypi:~/teslamate $ docker logs teslamate-teslamate-1
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432
waiting for postgres at database:5432

Now the database container ‘db’ is running. We’ll try again to re-initialize the database
pi@raspberrypi:~/teslamate $ docker compose exec -T db psql -U teslamate teslamate << .
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
CREATE EXTENSION cube WITH SCHEMA public;
CREATE EXTENSION earthdistance WITH SCHEMA public;
.
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL: database “teslamate” does not exist

It means that inside your database container, the teslamate database is missing.
Now I need to check check existing databases in the container
So I checked the list of databases
docker compose exec database psql -U teslamate -c “\l”

There is no database named ‘teslamate’, so I tried to create the database, and got an error like:
docker compose exec -T db psql -U teslamate -c “CREATE DATABASE teslamate;”
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL: database “teslamate” does not exist

This is because The psql command, if no database is specified, tries to connect to a database named after the user (teslamate here). But we did not specify the database to connect to for this command. So it tries to connect to teslamate(default DB matching the user) which doesn’t exist.
So we should try instead:
docker compose exec -T db psql -U teslamate -d postgres -c “CREATE DATABASE teslamate;”
Tried initializing the database again
pi@raspberrypi:~/teslamate $ docker compose exec -T db psql -U teslamate teslamate << .
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
CREATE EXTENSION cube WITH SCHEMA public;
CREATE EXTENSION earthdistance WITH SCHEMA public;
.
DROP SCHEMA
CREATE SCHEMA
CREATE EXTENSION
CREATE EXTENSION

Now the database has been successfully initialized, we can try restore data from the back up.
docker compose exec -T db psql -U teslamate -d teslamate < teslamate_2025-06-15.bck

It will take a wile to get finished.
9. Run all the docker containers
pi@raspberrypi:~/teslamate $ docker compose up -d
[+] Running 5/5
✔ Network teslamate_default Created 0.2s
✔ Container teslamate-mosquitto-1 Started 2.0s
✔ Container teslamate-teslamate-1 Started 2.3s
✔ Container teslamate-grafana-1 Started 2.2s
✔ Container teslamate-db-1 Started

And check the logs if there’s no error.
pi@raspberrypi:~/teslamate $ docker logs teslamate-teslamate-1
2025-06-15 04:58:34.406 [info] == Running 20250407155134 TeslaMate.Repo.Migrations.UpgradeEarthdistance.change/0 forward
2025-06-15 04:58:34.416 [info] execute “ALTER EXTENSION earthdistance UPDATE”
2025-06-15 04:58:34.419 [info] version “1.2” of extension “earthdistance” is already installed

10. Open Web UI and check Grafana Dashboard.
The web interface is accessible, meaning that the containers are talking properly.

Grafana reads its data from TeslaMate’s PostgreSQL. So if
- TeslaMate restored data properly,
- Time range in Grafana dashboard is correct (e.g., Last 7 days),
- And the dashboards are configured correctly,
It should display the data as it did before the update.

Although the web UI is accessible, the data is not being displayed at all. It should be checked if the data restoration has finished successfully.
10-1. Inspect Database Contents Manually
Run this to inspect the tables inside the teslamate database:
docker compose exec -T db psql -U teslamate -d teslamate -c “\dt”
Then we’ll see
pi@raspberrypi:~/teslamate $ docker compose exec -T db psql -U teslamate -d teslamate -c “\dt”
List of relations
Schema | Name | Type | Owner
——–+——————–+——-+———–
public | addresses | table | teslamate
public | car_settings | table | teslamate
public | cars | table | teslamate
public | charges | table | teslamate
public | charging_processes | table | teslamate
public | drives | table | teslamate
public | geofences | table | teslamate
public | positions | table | teslamate
public | schema_migrations | table | teslamate
public | settings | table | teslamate
public | states | table | teslamate
public | tokens | table | teslamate
public | updates | table | teslamate
(13 rows)

If it failed it would have showed errors:
ERROR: relation already exists
permission denied
or anything else
And to see the actual data inside the tables:
docker compose exec -T db psql -U teslamate -d teslamate -c “SELECT * FROM updates LIMIT 5;”
Which will show if no errors:
pi@raspberrypi:~/teslamate $ docker compose exec -T db psql -U teslamate -d teslamate -c “SELECT * FROM updates LIMIT 5;”
id | start_date | end_date | version | car_id
—-+————————-+————————-+—————————-+——–
1 | 2024-07-24 11:54:35.495 | 2024-07-24 11:54:35.495 | 2024.14.200.2 ee4474339aad | 1
2 | 2024-08-06 03:42:29.455 | 2024-08-06 04:20:20.112 | 2024.20.100 f3e392c63402 | 1
34 | 2024-10-06 04:24:01.071 | 2024-10-06 04:43:54.189 | 2024.26.8 7c528851cb24 | 1
35 | 2024-12-22 06:01:52.393 | 2024-12-22 06:12:04.811 | 2024.44.25.3 b26d46a49cbf | 1
36 | 2025-01-28 10:32:54.168 | 2025-01-28 10:32:54.168 | 2024.45.32 26bf7521c499 | 1
(5 rows)
The fact that the we can read data from the tables means the data restoration was successful. Now the issue is likely due to the service renaiming, ‘database’ into ‘db’.
10-2. Check docker-compose.yml
Open the ‘docker-compose.yml’ file and find lines with the DATABASE_HOST in it.
environment:
- DATABASE_HOST=database
If it sill contains old name, this should be renamed as ‘db’, so update it to:
environment:
- DATABASE_HOST=db
Then save and restart the stack
docker compose down
docker compose up -d
10-3. Check Grafana Configuration
Grafana connects to PostgreSQL independently. If Grafana started before the DB or before TeslaMate had inserted any data, the data source may be misconfigured or empty.
To check:
- Go to Grafana at
http://<your_pi_ip>:3101 - Login (default is usually
admin/admin) - Go to ⚙️ “Configuration” → “Data Sources”
- Click the
PostgreSQLdata source (should be namedTeslaMate) - Click Save & Test
If it fails, it might show database "teslamate" does not exist — this could happen if the DB wasn’t ready when Grafana started.
The host URL was configured as ‘database:5432’.

which should be ‘db:5432’. Update it and hit the ‘Save & Test’ again.

11. Check if it works!
