Verified Commit 4bc877e6 authored by Evangelos Foutras's avatar Evangelos Foutras 🐱
Browse files

Create snapshot with current db and gitlab backups



The helper scripts that create mysql/postgres database dumps as well as
the script running gitlab-backup were executed after the btrfs snapshot
was taken. This resulted in stale db and gitlab backups (from last run).

Move execution of these helper scripts further up so their outputs get
included in the btrfs snapshot.
Reported-by: Kristian Klausen's avatarKristian Klausen <kristian@klausen.dk>
parent e1ad24fa
Pipeline #9115 passed with stage
in 46 seconds
......@@ -39,6 +39,17 @@ cleanup() {
trap cleanup EXIT
# Dump databases to /root/backup-{postgres,mysql} before taking a btrfs snapshot
systemctl is-active postgresql && /usr/local/bin/backup-postgres.sh || true
if systemctl is-active mysqld || systemctl is-active mariadb; then
/usr/local/bin/backup-mysql.sh || true
fi
{% if inventory_hostname == "gitlab.archlinux.org" %}
# Create tarball backups of various GitLab directories using the official backup tool
systemctl is-active docker && /usr/local/bin/backup-gitlab.sh
{% endif %}
if is_btrfs "$src"; then
# List all btrfs submounts we want to backup, e.g. homedir.archlinux.org with "/ /home"
list_of_btrfs_submounts=$(findmnt -Rl -o target,fstype,options / | grep btrfs | grep -v docker | grep -v "subvol=\/[[:alnum:]]" | cut -d ' ' -f1)
......@@ -62,15 +73,6 @@ else
backup_mountdir="$src"
fi
systemctl is-active postgresql && /usr/local/bin/backup-postgres.sh || true
if systemctl is-active mysqld || systemctl is-active mariadb; then
/usr/local/bin/backup-mysql.sh || true
fi
{% if inventory_hostname == "gitlab.archlinux.org" %}
systemctl is-active docker && /usr/local/bin/backup-gitlab.sh
{% endif %}
borg create -v --stats -C zstd \
-e /proc \
-e /sys \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment