From 624b660f3b6c4039e6346b80185ecc2e80034db8 Mon Sep 17 00:00:00 2001 From: Mentor Palokaj Date: Thu, 16 Dec 2021 11:16:46 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20offline=20backup=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-functions.yml | 14 -------------- .gitignore | 1 + package.json | 3 ++- scripts/backup-images.zsh | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 scripts/backup-images.zsh diff --git a/.github/workflows/deploy-functions.yml b/.github/workflows/deploy-functions.yml index 36d6e77..158996c 100644 --- a/.github/workflows/deploy-functions.yml +++ b/.github/workflows/deploy-functions.yml @@ -49,20 +49,6 @@ jobs: gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }} echo "Project is now set to ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }}" gcloud firestore export ${{ secrets.GCP_BUCKET_LINK_PRODUCTION }}/firestore-backups/$(date +'%Y-%m-%d-%s')/ - - - name: Backup Rocketeer storage - run: | - mkdir rocketeer-image-backups - gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }} - echo "Project is now set to ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }}" - gcloud -m cp -r ${{ secrets.GCP_BUCKET_LINK_PRODUCTION }}/mainnetRocketeers ./rocketeer-image-backups/ - gzip -r -v -9 ./rocketeer-image-backups/ - - - uses: actions/upload-artifact@v2 - with: - name: rocketeer-image-backup.gz - path: ./rocketeer-image-backups.gz - - name: Deploy to Firebase uses: w9jds/firebase-action@master diff --git a/.gitignore b/.gitignore index 624dc85..f755f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules build/ docs/ *.log +.backups diff --git a/package.json b/package.json index 344c442..53eea29 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "test" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "backup": "zsh ./scripts/backup-images.zsh" }, "author": "Mentor Palokaj (http://github.com/actuallymentor)", "license": "MIT", diff --git a/scripts/backup-images.zsh b/scripts/backup-images.zsh new file mode 100644 index 0000000..b522ee6 --- /dev/null +++ b/scripts/backup-images.zsh @@ -0,0 +1,14 @@ +## ############### +## Manual image backup +## I intend to make this an online thing +## But the storage cost is a bit expensive +## ############### +timestamp=$( date ) +cd .backups && \ +gcloud config set project rocketeer-nft && \ +gsutil -m cp -r gs://rocketeer-nft.appspot.com/mainnetRocketeers/ ./rocketeer-image-backups/ && \ +tar -cv rocketeer-image-backups | gzip -9 > rocketeer-backup-$timestamp.tar.gz && \ +mv rocketeer-backup-$timestamp.tar.gz ~/Google\ Drive/Backup/Rocketeers/ +echo "✅ success" || echo "🛑 fail" + +say "Backup process done"