this post was submitted on 23 Jun 2023
6 points (80.0% liked)

Lemmy

12575 readers
1 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 4 years ago
MODERATORS
 

Hi, Do you have any suggestions on how to backup the database or any other suggestions before upgrading Lemmy?

you are viewing a single comment's thread
view the rest of the comments
[–] fuser@quex.cc 1 points 1 year ago

you can run something like this on the host - make sure you use the correct container name

#!/bin/bash
# check the container name with docker ps first
container_name="instance_name_postgres_1"

echo "dumping pgsql"
# Backup command
docker exec -t "${container_name}" pg_dumpall -c -U lemmy > lemmy_dump.sql

suggest you not leave unencrypted backup on the host system but copy it somewhere else, preferably after encrypting it with gpg.