Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested backup script is somewhat dangerous #262

Closed
SorteKanin opened this issue Aug 5, 2023 · 3 comments
Closed

Suggested backup script is somewhat dangerous #262

SorteKanin opened this issue Aug 5, 2023 · 3 comments

Comments

@SorteKanin
Copy link

SorteKanin commented Aug 5, 2023

The suggested script pipes into gzip, potentially ignoring any errors. If the docker exec fails for whatever reason, gzip just ignores the error and returns 0.

Perhaps something like this should be used instead:

set -euo pipefail
file_name=lemmy_dump_$(date +%Y-%m-%d"T"%H_%M_%S).sql
docker-compose exec postgres pg_dumpall --clean -U lemmy > ${file_name}
gzip ${file_name}
@dessalines
Copy link
Member

You mean if pg_dumpall had errors? I can't see why that would occur, or if someone wouldn't notice that their output takes up only a few kb.

@SorteKanin
Copy link
Author

Well it could happen for instance if you run out of disk space. It happened in my case as well when my docker container's name changed. In any case, it can fail.

someone wouldn't notice that their output takes up only a few kb.

You're unlikely to check this manually if you've set up automatic backups.

@dessalines
Copy link
Member

I'm open to PRs to change it, but the script does currently work as-is.

@dessalines dessalines closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants