Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

TeslaMate [megathread]

This site may earn commission on affiliate links.
You can use the code option to preserve formatting
So you can, here it is properly as I can't edit my post any longer.

Name Command State Ports --------------------------------------------------------------------------------------------------------- myusername_database_1 docker-entrypoint.sh postgres Up 5432/tcp myusername_grafana_1 /run.sh Up 3000/tcp myusername_mosquitto_1 /docker-entrypoint.sh mosq ... Up 127.0.0.1:1883->1883/tcp myusername_proxy_1 /entrypoint.sh --global.se ... Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp myusername_teslamate_1 tini -- /bin/sh /entrypoin ... Up 4000/tcp
Have you tried logging onto the database?
If by this you mean going to mydomain.com/grafana, then yes, I get a 404 error. If you mean I should try something via SSH, then I can give it a go? I'm quite happy to wipe it though and start afresh, I just want to try a last-ditch effort to extract my data, if it is still there.
 
So you can, here it is properly as I can't edit my post any longer.

Name Command State Ports --------------------------------------------------------------------------------------------------------- myusername_database_1 docker-entrypoint.sh postgres Up 5432/tcp myusername_grafana_1 /run.sh Up 3000/tcp myusername_mosquitto_1 /docker-entrypoint.sh mosq ... Up 127.0.0.1:1883->1883/tcp myusername_proxy_1 /entrypoint.sh --global.se ... Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp myusername_teslamate_1 tini -- /bin/sh /entrypoin ... Up 4000/tcp

If by this you mean going to mydomain.com/grafana, then yes, I get a 404 error. If you mean I should try something via SSH, then I can give it a go? I'm quite happy to wipe it though and start afresh, I just want to try a last-ditch effort to extract my data, if it is still there.
Try
Code:
docker-compose exec database psql teslamate teslamate
Database might be DB and the username / password (Teslamate / Teslamate) might be different. But from there, run
Code:
select * from drives;
and see what the output is.
 
Try
Code:
docker-compose exec database psql teslamate teslamate
Database might be DB and the username / password (Teslamate / Teslamate) might be different. But from there, run
Code:
select * from drives;
and see what the output is.
This looks to successfully give me an output of my data, line by line, thank you. The dates are all in the right period. Here's the header, I won't post a shot of the data in case the position IDs can be reverse-engineered somehow.

Screenshot 2022-06-05 101519.png


Do you know how I can pull this as a CSV or something that I can then re-import?
 
This looks to successfully give me an output of my data, line by line, thank you. The dates are all in the right period. Here's the header, I won't post a shot of the data in case the position IDs can be reverse-engineered somehow.

View attachment 812882

Do you know how I can pull this as a CSV or something that I can then re-import?
The standard backup process should work. Is that what you used previously?

edit: Backup and Restore | TeslaMate
 
  • Like
Reactions: otherslackjaw
The standard backup process should work. Is that what you used previously?

edit: Backup and Restore | TeslaMate
Yeah that would make sense but it doesn't seem to. I've tried before but here it is written down:

Here is what I've tried and what I get as an output:
Code:
root@teslamate:~# docker-compose exec -T database pg_dump -U teslamate teslamate > /home/pi/tmbackup/teslamateA.bck
Error response from daemon: Container a655f2d356158910301c77a3ce8e8a3feaecfe67aeb9dc3e5f015ebba54fd464 is restarting, wait until the container is running

So I tried this:
Code:
sudo docker-compose up -d
This gives me a whole load of warnings and errors including various 'cannot start service'. Running the backup command again gives the same 'wait until the container is running' error. So, no joy there.

Then I changed directory to the whereis docker-compose location and ran the backup command again and it takes a second, looks like it completes successfully, but if I check the contents of my backup folder with ls -l I have only produced another 38kb file:
Code:
-rw-r--r-- 1 root root 38601 Jun  5 12:56 teslamateA.bck

I can use rcloud to get that file off the VM and open it in notepad. It looks as I would expect but just doesn't contain any of my data. I think it's effectively a database backup of an empty database.
Obviously I have no idea what I'm doing , but I think what I have is a functioning database, but none of the stuff above/around it to get the data out properly? I'm worried if I try and reinstall teslamate I'll end up wiping the data. Not sure what else to try..
 
The docker-compose up should be run from where your yml file is.
Good catch, I've now done this but it's not made a difference to the backup via the normal pg_dump command. EDIT to say I should double check this in the morning just in case.
What are you seeing in the error logs?
Here is the output on pastebin as it was too big for the forum.

Oh, and just for completeness, when you ran @cwanja 's command to access the database directly, did you use the command :

Code:
docker-compose exec database psql teslamate teslamate

or did you have to substitute database for db?
I just used 'database', not 'db'.
 
Those logs are strange. All from the 3rd of June. Nothing recent. What were you doing then?

I'd restart the server just to clear everything out and then check the status of docker-compose ps. Although you have 'upped' the containers, I don't see any reference to downing them first. So they may appear to be up, but in a non-working state. The reboot will down them and bring them back up.

After that get the logs for teslamate and database e.g.
docker-compose logs teslamate
docker-compose logs database
 
Those logs are strange. All from the 3rd of June. Nothing recent. What were you doing then?
Messing around with it and trying to get the backup script to run. I kept getting this error (below) and my docker-compose file seemed to not have an extension so I think I ended up duplicating it to docker-compose.yml. Unhelpfully I don't remember what I did. If I'd been taking snapshots of the VM i'd have just rolled back, but too late now!
Code:
ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml
restart the server just to clear everything out
Done
check the status of docker-compose ps
This is the output:
Code:
root@teslamate:/usr/local/bin# docker-compose ps
     Name                    Command                State      Ports 
----------------------------------------------------------------------
bin_database_1    docker-entrypoint.sh postgres    Up         5432/tcp
bin_grafana_1     /run.sh                          Up         3000/tcp
bin_mosquitto_1   /docker-entrypoint.sh mosq ...   Exit 128           
bin_proxy_1       /entrypoint.sh --global.se ...   Exit 128           
bin_teslamate_1   tini -- /bin/sh /entrypoin ...   Up         4000/tcp

After that get the logs for teslamate and database e.g.
docker-compose logs teslamate
On pastebin here.

docker-compose logs database
Also done, located here.
 
Those logs are strange. All from the 3rd of June. Nothing recent. What were you doing then?
This jogged a memory and I ran the below to see what docker-compose files I've got where.
Code:
root@teslamate:/usr/local/bin# whereis docker-compose
docker-compose: /usr/local/bin/docker-compose /usr/local/bin/docker-compose.yml

root@teslamate:/usr/local/bin# ls -l
total 11980
-rwxr-xr-x 1 root staff 12255808 Mar 18 19:38 docker-compose
-rw-r--r-- 1 root staff     3912 Jun  3 21:12 docker-compose.yml
drwxr-sr-x 2 root root      4096 Jun  3 21:12 import

March 18th will be when I originally set it up, June 3rd was when I was unintentionally breaking everything whilst fumbling around in the dark trying to make a backup file.
Should I be deleting the newer .yml file and creating new logs? I'm not sure why my original docker-compose file doesn't have an extension.
 
That first docker-compose is not a yml file, it's the docker-compose binary. The yml file is usually stored in your home directory.

What does your docker-compose.yml look like?
Good news! I managed to get a manual backup to work by running it from the correct .yml directory thanks to the comment above. I now have a 138mb backup with all my data. And I managed to get my teslamate instance back up and running again. I'll have another play around with the automated google drive backup when I get the time, but I'm now reasonably confident I'll be able to get it going this time around, thanks to all I've learnt [been taught] over the last few days. I appreciate the help.
 
Hi.

In preparation for when my Tesla arrives I have managed to install TeslaMate on my RPi4, using version 1.25. (the latest version didn't run and rolling back to this version seems to have fixed the issue).

However, I'm yet to actually get my car, so wasn't sure what I should see in the TeslaMate GUI? At the moment I just get a blank page on the landing page (with navbar at the top). Is this expected of your car hasn't yet arrived?

Thanks
 
Hi.

In preparation for when my Tesla arrives I have managed to install TeslaMate on my RPi4, using version 1.25. (the latest version didn't run and rolling back to this version seems to have fixed the issue).

However, I'm yet to actually get my car, so wasn't sure what I should see in the TeslaMate GUI? At the moment I just get a blank page on the landing page (with navbar at the top). Is this expected of your car hasn't yet arrived?

Thanks
1.25 is an old version and has quite a few bugs. It's worth the effort to upgrade. Plenty of posts in this thread on how to fix. IIRC there's mention of it only a couple of pages back.

WRT not having the car, you won't have any data in your database at the moment so you won't see anything worthwhile at all.

Edit: follow this link: Raspberry Pi: clock_gettime(CLOCK_MONOTONIC, _) failed: Operation not permitted (1) · Issue #2302 · adriankumpf/teslamate
 
  • Like
Reactions: cwanja