add offline backup script

This commit is contained in:
Mentor Palokaj 2021-12-16 11:16:46 +01:00
parent 0822003795
commit 624b660f3b
4 changed files with 17 additions and 15 deletions

View File

@ -49,20 +49,6 @@ jobs:
gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }} gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID_PRODUCTION }}
echo "Project is now set to ${{ 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')/ 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 - name: Deploy to Firebase
uses: w9jds/firebase-action@master uses: w9jds/firebase-action@master

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ node_modules
build/ build/
docs/ docs/
*.log *.log
.backups

View File

@ -7,7 +7,8 @@
"test": "test" "test": "test"
}, },
"scripts": { "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 <mentor@palokaj.co> (http://github.com/actuallymentor)", "author": "Mentor Palokaj <mentor@palokaj.co> (http://github.com/actuallymentor)",
"license": "MIT", "license": "MIT",

14
scripts/backup-images.zsh Normal file
View File

@ -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"