Skip to content

Commit

Permalink
zstd compress for 10x size reduction of backups
Browse files Browse the repository at this point in the history
  • Loading branch information
swiffer committed Oct 16, 2024
1 parent f6ba2b0 commit 191bf3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website/docs/maintenance/backup_restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ If you are using `docker-compose`, you are using Docker Compose v1, which has be

## Backup

Create backup file `teslamate.bck`:
Create backup file `teslamate.bck.zstd`:

```bash
docker compose exec -T database pg_dump -U teslamate teslamate > ./teslamate.bck
docker compose exec -T database pg_dump -U teslamate teslamate --format=custom --compress=zstd > /media/data/backups/teslamate.bck.zstd
```

:::note
`-T` is important if you add this line a crontab or the backup will not work because docker will generate this error `the input device is not a TTY`
:::

:::note
Be absolutely certain to move the `teslamate.bck` file to another safe location, as you may lose that backup file if you use a docker-compose GUI to upgrade your teslamate configuration. Some GUIs delete the folder that holds the `docker-compose.yml` when updating.
Be absolutely certain to move the `teslamate.bck.zstd` file to another safe location, as you may lose that backup file if you use a docker-compose GUI to upgrade your teslamate configuration. Some GUIs delete the folder that holds the `docker-compose.yml` when updating.
:::

:::note
Expand Down Expand Up @@ -49,7 +49,7 @@ CREATE EXTENSION earthdistance WITH SCHEMA public;
.

# Restore
docker compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
docker compose exec -T database psql -U teslamate -d teslamate < teslamate.bck.zstd

# Restart the teslamate container
docker compose start teslamate
Expand Down

0 comments on commit 191bf3e

Please sign in to comment.