Commit graph

53 commits

Author SHA1 Message Date
Micke Nordin d353069660 Make a standard about which params a script gets.
project="${1}"
mirror="${2}"
bucket="${3}"
customer="${4}"
environment="${5}"
2024-06-27 09:31:37 +02:00
Micke Nordin 4cf8cf3adb Add backup script for hb 2024-06-26 12:48:50 +02:00
Micke Nordin 7f7d38c87e Switch logic 2024-06-26 10:19:53 +02:00
Micke Nordin bac25d27c8 Fix bug in script 2024-06-26 09:58:18 +02:00
Micke Nordin 42831948e1 Fix syntax error 2024-06-26 09:40:36 +02:00
Micke Nordin db92a5d255 Clean up logic 2024-06-26 09:14:59 +02:00
Micke Nordin 4d6e6f67af Use correect variable 2024-06-25 11:19:53 +02:00
Micke Nordin a836417db2 Fix rclone cert issue 2024-06-19 09:09:59 +02:00
Micke Nordin a76397aafd Use correct variable 2024-06-19 08:59:05 +02:00
Micke Nordin ea51f0b56b Trigger extra backup jobs if they exist 2024-06-12 10:55:11 +02:00
Micke Nordin 6c8a4f430b See if we can get the jobs out 2024-06-12 09:47:05 +02:00
Micke Nordin 51a695ed9e Don't fail on problems with downtime for db either 2024-05-07 10:53:44 +02:00
Micke Nordin cb16f03710 Don't fail on problems with downtime 2024-05-07 10:50:55 +02:00
Micke Nordin 7dc9667bec Fix typo 2023-11-22 12:12:57 +01:00
Micke Nordin 6265472396 Make it possible to delete announcement with just subject 2023-11-22 11:52:58 +01:00
Micke Nordin 300e877b3a Make curl silent 2023-11-22 11:01:52 +01:00
Micke Nordin a08f473954 remove subscript of type 2023-11-07 14:01:12 +01:00
Micke Nordin 9e4879d9c8 python3.9 -> python3 2023-11-01 15:20:23 +01:00
Magnus Andersson 059bd041e6
backup-all-buckets: Add comment about safeguard 2023-10-12 09:21:57 +02:00
Magnus Andersson 5df8dba25c
backup-all-buckets: Safeguard backup runs if a backup process on that bucket is already in progress. 2023-10-12 09:03:48 +02:00
Micke Nordin d2ced8d1cd
Backups: This script does not seem used and is confusing 2023-09-25 09:34:19 +02:00
Magnus Andersson b9e35dcf92 Give multinode a sixmonts backup policy. 2023-09-20 10:26:01 +02:00
Micke Nordin b5f8abf934
Allow source missmatch after changing bucket name 2023-09-12 16:50:48 +02:00
Micke Nordin 6d33b53a92
Fix backup directory for multinode script as well 2023-09-12 16:37:36 +02:00
Micke Nordin 631f3616c6
Create bespoe directory, and clean up afterwards 2023-09-12 16:35:52 +02:00
Micke Nordin 174c72eb70
BACKUPDB: Fix bug that put backup in a file instead of a directory
We found a bug that moved the backups to a file, but we want that to be
a directory, meaning that all the files were overwritten one by one, and
we were not taking the backups as we though.
2023-09-12 16:19:17 +02:00
Micke Nordin 22f5dfac62
Allways backup before restarting 2023-09-02 12:50:08 +02:00
Micke Nordin 7207ef2bbf
Allways backup the db 2023-09-02 12:30:16 +02:00
Micke Nordin c7bd0fa965
Try again 2023-09-02 12:19:33 +02:00
Micke Nordin d540c90afa
Try again 2023-09-02 12:15:54 +02:00
Micke Nordin b927716aad
Fix comment 2023-09-02 12:12:59 +02:00
Micke Nordin ac6430df51
Add announce script to script servers 2023-09-02 12:08:17 +02:00
Micke Nordin 598be8c2f1
Add full support for common infra 2023-07-20 11:23:48 +02:00
Micke Nordin e0139b0765
BAckups: Fix db backups
DB backup dir clashed with statistics script storage location, and also
some permission errors.

diff --git a/templates/script/backupdb.erb.sh b/templates/script/backupdb.erb.sh
index b35acbc..1eb7992 100644
--- a/templates/script/backupdb.erb.sh
+++ b/templates/script/backupdb.erb.sh
@@ -6,11 +6,16 @@ sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk
 number_of_full_to_keep="<%= @full_backup_retention %>"

 backup="${1}"
+if [[ -z ${backup} ]]; then
+  backup="backup1.$(hostname -d)"
+fi
 if ! [[ ${backup} =~ backup1.*sunet.se$ ]]; then
 	echo "Usage: ${0} <fqdn of backup server>"
 	echo "Example: ${0} backup1.sunet.drive.sunet.se"
 fi
 backup_dir="/opt/backups"
+backup_dir_long="${backup_dir}/backups"
+mkdir -p ${backup_dir}
 bucket="db-backups"
 mirror="<%= @customer %>-<%= @environment %>-mirror"
 if [[ ${mirror} =~ common-(test|prod)-mirror ]]; then
@@ -23,11 +28,8 @@ ssh ${backup} "sudo /home/script/bin/backup_db.sh"
 echo "Cleaning up old backups for ${backup}"
 ssh ${backup} "sudo /home/script/bin/purge_backups.sh /opt/mariadb_backup/backups/"
 echo "Copying backups here"
-mkdir -p ${backup_dir}
-scp script@${backup}:/opt/mariadb_backup/backups/$(date +%Y/%m/%d)/*.gz ${backup_dir}
+scp script@${backup}:/opt/mariadb_backup/backups/$(date +%Y/%m/%d)/*.gz ${backup_dir_long}
 echo "Copying backups to remote bucket"
 rclone mkdir ${mirror}:${bucket}
 duplicity --full-if-older-than 1M --tempdir /mnt --archive-dir /mnt --no-encryption ${backup_dir} rclone://${mirror}:/${bucket}
 duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt --force rclone://${mirror}:/${bucket}
-echo "cleaning up"
-rm -r ${backup_dir}
diff --git a/templates/scriptreceiver/backup_db.erb.sh b/templates/scriptreceiver/backup_db.erb.sh
index 025a338..3e15f25 100644
--- a/templates/scriptreceiver/backup_db.erb.sh
+++ b/templates/scriptreceiver/backup_db.erb.sh
@@ -11,5 +11,7 @@ else
 fi

 docker exec ${container} /do_backup.sh ${customer}
+chown root:script /opt/mariadb_backup/
+chmod 750 /opt/mariadb_backup/
 chmod 755 ${backupdir}
 chown -R script:root ${backupdir}
2023-06-13 12:15:19 +02:00
Micke Nordin 75f75732e7
Fix repair command 2023-04-26 11:22:25 +02:00
Micke Nordin 8ca66c10ad
Add more repair commands and use tty for occ 2023-04-26 09:26:46 +02:00
Micke Nordin 7d10d168bd
Fix nc_upgrade_command 2023-04-25 17:48:13 +02:00
Micke Nordin d93cce4fc0
Handle mau 2023-04-03 14:11:28 +02:00
Micke Nordin 4963afd5f6
Handle clean up in a different way 2023-03-13 16:33:51 +01:00
Micke Nordin 18578817f1
Correct dir for backups 2023-03-13 16:27:36 +01:00
Micke Nordin 3fb6164501
Typo 2023-03-13 16:23:51 +01:00
Micke Nordin 392e83188b
Fix backups for new multionode dbs 2023-03-13 16:20:03 +01:00
Micke Nordin abd56622e7
Fix typo 2023-03-13 12:49:03 +01:00
Micke Nordin e9e70c5b29
Add in support for fullnode customers to folders in userbuckets 2023-03-13 12:41:23 +01:00
Micke Nordin 00256a7259
Use python 3.9 2023-02-28 14:24:11 +01:00
Micke Nordin 9dd730fcea
New format for multinode container names 2023-02-28 09:52:56 +01:00
Micke Nordin 1588d5869b
Remove underscore for user name 2023-02-27 15:18:14 +01:00
Micke Nordin 430521d96d
Update scripts to use rclone -c to use checksums instead of mtime 2023-02-24 10:18:40 +01:00
Micke Nordin d378b5f2da
Skip over statistics 2023-02-23 16:07:01 +01:00
Micke Nordin 3712e6228c
Redis sentinel no longer used 2023-02-23 15:44:55 +01:00