add better backup instructions

This commit is contained in:
Hurlu 2023-01-29 22:20:27 +01:00
parent 886be66dcd
commit bcbbe79e1d
5 changed files with 50 additions and 4 deletions

View File

@ -1,8 +1,10 @@
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
GLOB_DIR=$SCRIPT_DIR/..
SERVICES=( gitea notes recipes )
SERVICES=( notes recipes gitea )
for service in "${SERVICES[@]}"
do

View File

@ -0,0 +1,44 @@
#!bin/bash
#let me inside of [gitrepo]/adminscripts plz :)
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
GLOB_DIR=$SCRIPT_DIR/..
if [ $(id -u) -ne 0 ]
then echo "Run me as root! trust me :]"
exit
fi
apt update;
apt upgrade;
apt install -y docker docker-compose python3 curl nmap emacs-nox unzip zip htop postfix;
curl https://rclone.org/install.sh | sudo bash
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update;
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin;
mkdir ~/Downloads;
git remote add myserv git.hugowillaume.com/Hurlu/ServerContainers;
# setup my rclone remote named "Gdrive" with advanced option root folder 1Vtw9u>
rclone config
# reinstall my backup data
cd ~/Downloads;
rclone copy Gdrive: .;
cp standardfile.db $GLOB_DIR/notes/.;
cp mealie.zip $GLOB_DIR/recipes/.;
cp gitea_backup.zip $GLOB_DIR/gitea/.;
rm ~/Downloads/*
cd $GLOB_DIR/recipes
unzip -o mealie.zip
cd $GLOB_DIR/gitea
# restore gitea: https://docs.gitea.io/en-us/backup-and-restore/#restore-command-restore
# update crontab to call backup_to_gdrive every 8 hours: (crontab -e, no need for sudo)
#* */8 * * * /home/hurlu/ServerContainers/adminscripts/backup_to_gdrive.sh
# manually go to my sample files in each container folder to write actual secrets
# run server containers
# profit :]

View File

@ -3,7 +3,7 @@ SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
docker exec -u git -w "/data/git" $(docker ps -qf "name=^/gitea$") bash -c "/app/gitea/gitea dump -c /data/gitea/conf/app.ini";
cd $SCRIPT_DIR;
mv gitea_data/git/gitea-dump* gitea_backup.zip;
rclone copy gitea_backup.zip Gdrive:backups/;
rclone copy gitea_backup.zip Gdrive:/;
rm -f gitea_backup.zip;

View File

@ -1,6 +1,6 @@
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
cd $SCRIPT_DIR;
rclone copy standardfile.db Gdrive:backups/;
rclone copy standardfile.db Gdrive:/;

View File

@ -2,7 +2,7 @@ SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
cd $SCRIPT_DIR;
zip -r -9 mealie.zip mealie;
rclone copy mealie.zip Gdrive:backups/;
rclone copy mealie.zip Gdrive:/;
rm mealie.zip