Last active
October 25, 2020 16:43
-
-
Save oldcai/24b54b0f94de0c960cf0e4ba0d47efd5 to your computer and use it in GitHub Desktop.
Revisions
-
oldcai revised this gist
Oct 25, 2020 . 3 changed files with 16 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/bash version='stable' #version='latest' mkdir -p /var/backups/rancher cd /var/backups/rancher container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash # ./restore_rancher.sh backups/rancher/rancher-data-backup-latest-20201025.tar.gz version='stable' #version='latest' container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') echo original: $container_id docker stop $container_id today=$(date +%Y%m%d) docker run --volumes-from $container_id -v $PWD:/backup \ busybox sh -c "rm /var/lib/rancher/* -rf && \ tar pzxvf /backup/$1" docker start $container_id This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/bash version='stable' #version='latest' mkdir -p /var/backups/rancher cd /var/backups/rancher container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') -
oldcai revised this gist
Aug 2, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,9 @@ echo $container_id docker stop $container_id today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:${version} docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-rollback-${version}-${today}.tar.gz /var/lib/rancher >> /dev/null docker pull rancher/rancher:${version} docker run -d --volumes-from rancher-data-$today --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:${version} docker container ls -a|grep data ls -lah|grep backup- docker container rm rancher-data-$today -
oldcai revised this gist
Aug 2, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:${version} docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-backup-${version}-${today}.tar.gz /var/lib/rancher >> /dev/null docker pull rancher/rancher:${version} docker run -d --volumes-from rancher-data --restart=unless-stopped -p 443:443 rancher/rancher:${version} docker container ls -a|grep data ls -lah|grep backup- docker container rm rancher-data-$today -
oldcai revised this gist
Aug 2, 2019 . 2 changed files with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,6 @@ cd /var/backups/rancher container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') echo $container_id docker stop $container_id today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:${version} docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-backup-${version}-${today}.tar.gz /var/lib/rancher >> /dev/null This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash #version='stable' version='latest' mkdir -p /var/backups/rancher cd /var/backups/rancher container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') echo $container_id docker stop $container_id today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:${version} docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-backup-${version}-${today}.tar.gz /var/lib/rancher >> /dev/null docker pull rancher/rancher:${version} docker run -d --volumes-from rancher-data --restart=unless-stopped -p 4443:443 rancher/rancher:${version} docker container ls -a|grep data ls -lah|grep backup- docker container rm rancher-data-$today -
oldcai revised this gist
Aug 2, 2019 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,15 @@ #!/bin/bash #version='stable' version='latest' mkdir -p /var/backups/rancher cd /var/backups/rancher container_id=$(docker ps|grep rancher:${version}|awk '{ print $1 }') echo $container_id docker stop $container_id docker start $container_id today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:${version} docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-backup-${version}-${today}.tar.gz /var/lib/rancher >> /dev/null docker start $container_id docker container ls -a|grep data ls -lah|grep backup- -
oldcai revised this gist
Aug 2, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/bin/bash mkdir -p /var/backups/rancher cd /var/backups/rancher container_id=$(docker ps|grep rancher:latest|awk '{ print $1 }') echo $container_id -
oldcai revised this gist
Jul 29, 2019 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash cd /var/backups/rancher container_id=$(docker ps|grep rancher:latest|awk '{ print $1 }') echo $container_id docker stop $container_id @@ -10,4 +10,5 @@ docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf docker start $container_id docker container ls -a|grep data ls -lah|grep backup- docker container rm rancher-data-$today find /var/backups/rancher -mtime +30 -delete -
oldcai revised this gist
Jul 29, 2019 . No changes.There are no files selected for viewing
-
oldcai created this gist
Jul 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/bin/bash cd /root/backups/rancher container_id=$(docker ps|grep rancher:latest|awk '{ print $1 }') echo $container_id docker stop $container_id docker start $container_id today=$(date +%Y%m%d) docker create --volumes-from $container_id --name rancher-data-$today rancher/rancher:latest docker run --volumes-from rancher-data-$today -v $PWD:/backup:z alpine tar zcvf /backup/rancher-data-backup-latest-${today}.tar.gz /var/lib/rancher >> /dev/null docker start $container_id docker container ls -a|grep data ls -lah|grep backup- docker container rm rancher-data-$today