diff --git a/keys/ssh/keys.txt b/keys/ssh/keys.txt index ecd24de7..3d744b55 100644 --- a/keys/ssh/keys.txt +++ b/keys/ssh/keys.txt @@ -20,9 +20,6 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBui9k0ByK4ldcfJCTaEyoQoltcZ3w07B/5WBxvz7Nzd # (Thu Nov 14 04:04:00 PM CET 2024) Work Laptop ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGcgRIUeWEEashZNAXlGi113PGNAl4kNJVw6I9MWSpg7 adxu\e21137815@EG7104721 -# (Thu Dec 28 19:55:09 AM UTC 2023) root@nuc-docker01 -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHjYe++b4XbN1XOZU+Cm9iNby3Goq66EA48D7gh9AnDE root@nuc-docker01 - ################# # Nix Infrastructure ################# diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh b/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh index 2f93aee4..ddb3bb4c 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh @@ -41,17 +41,17 @@ if [[ $count -ge 4 ]] ; then fi # Check if the Synology is mounted -check=$(ssh root@nuc-docker01 df -h | grep 100.64.0.2 | wc -l) +check=$(ssh root@nuc-server df -h | grep 100.64.0.2 | wc -l) if [[ $check != 1 ]] ; then - echo "Synology is not mounted on nuc-docker01: check returned $check" + echo "Synology is not mounted on nuc-server: check returned $check" payload="{\"message\": \"Backup stopped. Synology isn't mounted\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Stopped\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" exit fi echo -e "======= Time started : `date`" -echo -e "rsync -avr --delete --exclude=Downloads/ --exclude='Docker/sysctl.io' root@nuc-docker01:/Storage/Data/ /mnt/$drivea/Data/" -rsync -avr --delete --exclude=Downloads/ --exclude='Docker/sysctl.io' root@nuc-docker01:/Storage/Data/ /mnt/$drivea/Data/ +echo -e "rsync -avr --delete --exclude=Downloads/ --exclude='Docker/sysctl.io' root@nuc-server:/Storage/Data/ /mnt/$drivea/Data/" +rsync -avr --delete --exclude=Downloads/ --exclude='Docker/sysctl.io' root@nuc-server:/Storage/Data/ /mnt/$drivea/Data/ echo -e "======= Time complete: `date`" echo "Sending completion message" diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-media.sh b/nixos/hosts/backups-rpi4/scripts/rsync-media.sh index 2b9c304f..451ca2b2 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-media.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-media.sh @@ -41,9 +41,9 @@ if [[ $count -ge 4 ]] ; then fi # Check if the Synology is mounted -check=$(ssh root@nuc-docker01 df -h | grep \/volume1\/Storage | wc -l) +check=$(ssh root@nuc-server df -h | grep \/volume1\/Storage | wc -l) if [[ $check != 1 ]] ; then - echo "Synology is not mounted on nuc-docker01: check returned $check" + echo "Synology is not mounted on nuc-server: check returned $check" payload="{\"message\": \"Backup stopped. Synology isn't mounted\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Stopped\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" exit @@ -51,55 +51,55 @@ fi echo -e "======= Time started : `date`" echo -e "rsync -avr --delete --exclude=luks.img /Storage/Backups/Manual/Computers/ /mnt/$drivea/Backups/Manual/Computers/" -rsync -avr --delete --exclude=luks.img root@nuc-docker01:/Storage/Backups/Manual/Computers/ /mnt/$drivea/Backups/Manual/Computers/ +rsync -avr --delete --exclude=luks.img root@nuc-server:/Storage/Backups/Manual/Computers/ /mnt/$drivea/Backups/Manual/Computers/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Backups/Backblaze/ /mnt/$drivea/Backups/Backblaze/" -rsync -avr --delete root@nuc-docker01:/Storage/Backups/Backblaze/ /mnt/$drivea/Backups/Backblaze/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Backups/Backblaze/ /mnt/$drivea/Backups/Backblaze/" +rsync -avr --delete root@nuc-server:/Storage/Backups/Backblaze/ /mnt/$drivea/Backups/Backblaze/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Backups/Logs/ /mnt/$drivea/Backups/Logs/" -rsync -avr --delete root@nuc-docker01:/Storage/Backups/Logs/ /mnt/$drivea/Backups/Logs/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Backups/Logs/ /mnt/$drivea/Backups/Logs/" +rsync -avr --delete root@nuc-server:/Storage/Backups/Logs/ /mnt/$drivea/Backups/Logs/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Backups/Docker/ /mnt/$drivea/Backups/Docker/" -rsync -avr --delete root@nuc-docker01:/Storage/Backups/Docker/ /mnt/$drivea/Backups/Docker/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Backups/Docker/ /mnt/$drivea/Backups/Docker/" +rsync -avr --delete root@nuc-server:/Storage/Backups/Docker/ /mnt/$drivea/Backups/Docker/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Pictures/ /mnt/$driveb/Pictures/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/Pictures/ /mnt/$driveb/Pictures/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/Pictures/ /mnt/$driveb/Pictures/" +rsync -avr --delete root@nuc-server:/Storage/Media/Pictures/ /mnt/$driveb/Pictures/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Books/ /mnt/$driveb/Books/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/Books/ /mnt/$driveb/Books/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/Books/ /mnt/$driveb/Books/" +rsync -avr --delete root@nuc-server:/Storage/Media/Books/ /mnt/$driveb/Books/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Music/ /mnt/$drivea/Music/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/Music/ /mnt/$drivea/Music/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/Music/ /mnt/$drivea/Music/" +rsync -avr --delete root@nuc-server:/Storage/Media/Music/ /mnt/$drivea/Music/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Movies/ /mnt/$driveb/Movies/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/Movies/ /mnt/$driveb/Movies/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/Movies/ /mnt/$driveb/Movies/" +rsync -avr --delete root@nuc-server:/Storage/Media/Movies/ /mnt/$driveb/Movies/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[0-9]* /mnt/$driveb/TV_Shows/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[0-9]* /mnt/$driveb/TV_Shows/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[0-9]* /mnt/$driveb/TV_Shows/" +rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[0-9]* /mnt/$driveb/TV_Shows/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[A-K]* /mnt/$driveb/TV_Shows/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[A-E]* /mnt/$driveb/TV_Shows/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[A-K]* /mnt/$driveb/TV_Shows/" +rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[A-E]* /mnt/$driveb/TV_Shows/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[L-R]* /mnt/$drivea/TV_Shows/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[F-R]* /mnt/$drivea/TV_Shows/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[L-R]* /mnt/$drivea/TV_Shows/" +rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[F-R]* /mnt/$drivea/TV_Shows/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drivec/TV_Shows/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drivec/TV_Shows/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drivec/TV_Shows/" +rsync -avr --delete root@nuc-server:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drivec/TV_Shows/ echo -e "======= Time: `date`" -echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/YouTube /mnt/$drivec/YouTube/" -rsync -avr --delete root@nuc-docker01:/Storage/Media/YouTube/ /mnt/$drivec/YouTube/ +echo -e "rsync -avr --delete root@nuc-server:/Storage/Media/YouTube /mnt/$drivec/YouTube/" +rsync -avr --delete root@nuc-server:/Storage/Media/YouTube/ /mnt/$drivec/YouTube/ echo -e "======= Time complete: `date`" echo "Sending completion message" diff --git a/nixos/hosts/framework-server/cron.nix b/nixos/hosts/framework-server/cron.nix index 2fe37da8..2a390b10 100644 --- a/nixos/hosts/framework-server/cron.nix +++ b/nixos/hosts/framework-server/cron.nix @@ -2,12 +2,12 @@ services.cron = { enable = true; systemCronJobs = [ - # Backups to nuc-docker01 - ''0 0 * * * root rsync --delete -avr /Storage/Data/Docker/sysctl.io/ root@nuc-docker01:/Storage/Data/Docker/sysctl.io/'' - ''0 3 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/InstantUpload/ root@nuc-docker01:/Storage/Media/Pictures/InstantUpload/'' - ''0 5 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/Wallpapers/ root@nuc-docker01:/Storage/Media/Pictures/Wallpapers'' + # Backups to nuc-server + ''0 0 * * * root rsync --delete -avr /Storage/Data/Docker/sysctl.io/ root@nuc-server:/Storage/Data/Docker/sysctl.io/'' + ''0 3 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/InstantUpload/ root@nuc-server:/Storage/Media/Pictures/InstantUpload/'' + ''0 5 * * * root rsync -avr /Storage/Data/Docker/sysctl.io/nextcloud/html/data/albert/files/Wallpapers/ root@nuc-server:/Storage/Media/Pictures/Wallpapers'' # Back up the docker containers monthly: - ''@monthly root ssh nuc-docker01 "rm -rf /Storage/Backups/Docker/sysctl.io/*"; for i in $(docker ps --format '{{.Names}}'); do docker export $i | gzip -cf | ssh root@nuc-docker01 "cat > /Storage/Backups/Docker/sysctl.io/$i.tar.gz"; done'' + ''@monthly root ssh nuc-server "rm -rf /Storage/Backups/Docker/sysctl.io/*"; for i in $(docker ps --format '{{.Names}}'); do docker export $i | gzip -cf | ssh root@nuc-server "cat > /Storage/Backups/Docker/sysctl.io/$i.tar.gz"; done'' # Run the ClamAV scan ''@monthly root /Storage/Data/docker-compose/sysctl.io/scripts/clamscan-cron.sh'' # Archive Loki logs monthly diff --git a/nixos/hosts/nuc-server/default.nix b/nixos/hosts/nuc-server/default.nix index d8a82540..ac8595ec 100644 --- a/nixos/hosts/nuc-server/default.nix +++ b/nixos/hosts/nuc-server/default.nix @@ -11,9 +11,16 @@ ./cron.nix ]; - environment.systemPackages = [ - inputs.deploy-rs.packages.${system}.deploy-rs - ]; + environment.systemPackages = [ + inputs.deploy-rs.packages.${system}.deploy-rs + ]; + + # backups-rpi4: Backups + # warsaw-ovh-01: Backups + users.users.root.openssh.authorizedKeys.keys = [ + ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKp2wgqFcr0LGaUXbom88/zK2631pysePUWIaCMljT0K root@backups-rpi4'' + ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIcGPkzFaSGd1q/oy/uP5zEoOuPNr1h17ifu7oj4DaYO root@warsaw-ovh-01'' + ]; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "sd_mod" "uas" ]; boot.initrd.kernelModules = [ "r8152" ];