Commit graph

582 commits

Author SHA1 Message Date
Micke Nordin b15bc5ad03
Merge branch 'main' into testing 2023-06-15 19:24:58 +02:00
Micke Nordin befc3207d9
Fix conficting bashrc declarations 2023-06-15 19:24:31 +02:00
Micke Nordin b166a683a6
Merge branch 'main' into stable 2023-06-15 18:32:53 +02:00
Micke Nordin bffb06333d
Merge branch 'main' into testing 2023-06-15 12:01:19 +02:00
Micke Nordin bc329be450
Add back safer_reboot 2023-06-15 12:00:47 +02:00
Micke Nordin 1e23d134f1
Add fqdn to PS1 2023-06-13 14:15:53 +02:00
Micke Nordin 50dcefdb3d
Merge branch 'main' into stable 2023-06-13 12:17:46 +02:00
Micke Nordin ff3a5c143c
Pass on vaiables 2023-06-13 12:16:55 +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 fa93c01846
Fix permissions 2023-06-13 12:09:13 +02:00
Micke Nordin a9fdb43bf6
Add a default for backup 2023-06-13 11:59:19 +02:00
Micke Nordin 95030efba2
Run backup on same dir as before 2023-06-13 11:52:15 +02:00
Micke Nordin 2119f71008
Backup dir overwritten by data script 2023-06-13 11:46:25 +02:00
Micke Nordin 08243f555d
Add back index 2023-06-12 11:42:00 +02:00
Micke Nordin 61c56fd2f2
Pass on variable 2023-06-12 11:29:51 +02:00
Micke Nordin b7a26db915
Fix fact 2023-06-12 10:01:03 +02:00
Micke Nordin b225e8d364
Update legacy fact name 2023-06-12 09:32:10 +02:00
Micke Nordin 0f8f27773b
Add support for replicating from multinode dbs 2023-06-12 09:31:41 +02:00
Micke Nordin f4ff3fea76
Add nordu.net 2023-06-08 16:43:20 +02:00
Micke Nordin e7ffd6fac3
Add nordu.net 2023-06-08 16:43:05 +02:00
Micke Nordin 8f3becd914
Add nordu.net 2023-06-08 16:33:04 +02:00
Micke Nordin 3531be828e
Add nordu.net 2023-06-08 16:32:43 +02:00
Micke Nordin 24b0b1eedc
Revert "Use nce image"
This reverts commit 20471ebaa8.
2023-06-01 11:47:16 +02:00
Micke Nordin 20471ebaa8
Use nce image 2023-06-01 11:44:50 +02:00
Micke Nordin 6c22905a04
Merge branch 'stable' 2023-05-22 10:14:53 +02:00
Micke Nordin 149ae70210
Add dns 2023-05-12 16:27:31 +02:00
Micke Nordin 402b6e1c4b
Add dns 2023-05-12 16:23:22 +02:00
Micke Nordin 8593d0bb00
Fix regex in mappingfile-test 2023-05-09 10:56:25 +02:00
Fredrik Kjellman 3dab127050 Merge branch 'main' into stable 2023-05-08 09:15:12 +02:00
Fredrik Kjellman fc4b51b4ac update mapping file to fix problems for shh.se 2023-05-08 09:14:00 +02:00
Fredrik Kjellman a14a71f5d6 Merge branch 'main' into stable 2023-05-03 15:32:38 +02:00
Fredrik Kjellman 52c11917ce modify mappingfile for GSS to help SHH to login. 2023-05-03 15:00:24 +02:00
Micke Nordin ca2cf7e3f2
Allow file locks to be debug logged for sunet test 2023-04-27 16:44:06 +02:00
Micke Nordin ef7c470244
If at first you don succeed... 2023-04-26 16:28:40 +02:00
Micke Nordin 5be9aedc56
Fix so cron job only runns in common 2023-04-26 16:25:29 +02:00
Micke Nordin 422ebd7ace
Fix backups of multinode in prod 2023-04-26 16:09: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 036dcf010c
Add gss 2023-04-24 16:39:09 +02:00
Micke Nordin 3b5d14a189
Try again 2023-04-24 16:34:37 +02:00
Micke Nordin e840903eae
Can I force string 2023-04-24 16:30:12 +02:00
Micke Nordin db516e3b72
New name 2023-04-24 16:27:21 +02:00
Micke Nordin a9695aeee1
Two passes 2023-04-24 16:25:37 +02:00
Micke Nordin 713f12e1d4
Terminate regex 2023-04-24 16:23:01 +02:00
Micke Nordin 568cb87ad6
Trim version 2023-04-24 16:21:22 +02:00
Micke Nordin 709d2165ac
Gsub 2023-04-24 16:13:11 +02:00
Micke Nordin 37e419cf75
Try regsubst 2023-04-24 16:06:55 +02:00
Micke Nordin 54868e8518
Yet another try 2023-04-24 15:59:47 +02:00
Micke Nordin 20d1558866
Yet another try 2023-04-24 15:56:22 +02:00