add better backup instructions
This commit is contained in:
parent
886be66dcd
commit
bcbbe79e1d
@ -1,8 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
||||||
GLOB_DIR=$SCRIPT_DIR/..
|
GLOB_DIR=$SCRIPT_DIR/..
|
||||||
|
|
||||||
|
|
||||||
SERVICES=( gitea notes recipes )
|
SERVICES=( notes recipes gitea )
|
||||||
|
|
||||||
for service in "${SERVICES[@]}"
|
for service in "${SERVICES[@]}"
|
||||||
do
|
do
|
||||||
|
|||||||
44
adminscripts/first_setup.sh
Normal file
44
adminscripts/first_setup.sh
Normal 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 :]
|
||||||
|
|
||||||
@ -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";
|
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;
|
cd $SCRIPT_DIR;
|
||||||
mv gitea_data/git/gitea-dump* gitea_backup.zip;
|
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;
|
rm -f gitea_backup.zip;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
||||||
|
|
||||||
cd $SCRIPT_DIR;
|
cd $SCRIPT_DIR;
|
||||||
rclone copy standardfile.db Gdrive:backups/;
|
rclone copy standardfile.db Gdrive:/;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
|
|||||||
|
|
||||||
cd $SCRIPT_DIR;
|
cd $SCRIPT_DIR;
|
||||||
zip -r -9 mealie.zip mealie;
|
zip -r -9 mealie.zip mealie;
|
||||||
rclone copy mealie.zip Gdrive:backups/;
|
rclone copy mealie.zip Gdrive:/;
|
||||||
rm mealie.zip
|
rm mealie.zip
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user