Keep only the last 3 deploy dumps on the server
They are the way back from a deploy, not backups: those go off-site (3c). Every file people keep is in each dump, so fewer dumps leave room for more files (decided 2026-10-02). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
7b933b2951
commit
53b5d56e79
1 changed files with 5 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
# - as a fast-forward of the deployed commit,
|
||||
# - if every new commit is signed by a key in deploy/allowed-signers, as the deployed
|
||||
# checkout lists them (so no commit can add its own key),
|
||||
# dumps the database first (the last 10 dumps stay in ~/backups), applies the migrations
|
||||
# dumps the database first (the last 3 dumps stay in ~/backups), applies the migrations
|
||||
# before switching to the new server, and fails unless that server answers afterwards. A failure leaves the checkout at the deployed commit, so
|
||||
# running the CI job again retries. By hand, with your own key:
|
||||
#
|
||||
|
|
@ -82,9 +82,11 @@ dump() {
|
|||
docker compose exec -T postgres pg_dump -U halkyon_learn -Fc halkyon_learn >"$file"
|
||||
)
|
||||
echo "Database dumped to $file ($(du -h "$file" | cut -f1))."
|
||||
# Only the newest 10. (ls is safe here: the names are ours, letters, digits and dashes.)
|
||||
# Only the newest 3 (decided 2026-10-02): they are the deploys' way back, not backups;
|
||||
# those go off-site. Every file people keep is in each of them, so fewer leave room.
|
||||
# (ls is safe here: the names are ours, letters, digits and dashes.)
|
||||
# shellcheck disable=SC2012
|
||||
ls -1t "$HOME"/backups/halkyon_learn-*.dump | tail -n +11 | xargs -r rm --
|
||||
ls -1t "$HOME"/backups/halkyon_learn-*.dump | tail -n +4 | xargs -r rm --
|
||||
}
|
||||
|
||||
# Waits up to a minute for the new server to answer inside the stack's network.
|
||||
|
|
|
|||
Loading…
Reference in a new issue