This is the one I use right now, then I move it to an offsite location. I’ve developed a script for this.
#create postgres dump echo "dumping postgres DB" sudo -Hu postgres pg_dumpall | gzip > /tmp/pleroma_dump.gzI imagine you can use sudo -Hu postgres pg_dump -d pleroma | gzip > /[dir]/[filename].gz but I found it easiest just to dump everything.