I was worried about some of my data, so I wanted to be sure I had a backup of my Teslamate system. This post covers the config I’d added and how I backed things up.
This is part of a series that covers my experience with a Tesla Model Y.
The Backup Volume
In my Teslamate docker-compose file, I had added a backup volume some time ago. My config section looks like this:
For this database container, I’d added the volumes for data and explicitly set a location that maps from a folder on my e: drive to a folder called backup in the postgresql location inside the container.
This ensures I can easily find my PostgreSQL backup file if I need it, which I hope I never do, but you never know.
Once this is set up, you can restart your container and the folder is mapped.
Running the Backup
There are instructions on the Teslamate Docs site, but I kept getting errors. I think some of those were because I was on docker compose v1, but I didn’t want to update without a backup.
So.
I used this code to connect to the container.
docker exec -ti teslamate_database_1 /bin/bash
Next, I ran this to backup the database.
pg_dump -U teslamate teslamate > backup/teslamate_20231219.bck
As you can see, it worked.
And I had a backup file in my folder.
Now to upgrade things.