Last active
October 10, 2023 17:21
-
-
Save spookyuser/e3e18386e33cfc16b9d02f2661676881 to your computer and use it in GitHub Desktop.
Big firebase backup
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 characters
#! /bin/bash | |
# Manual stuff | |
# Install gcloud sdk: https://cloud.google.com/sdk/docs/install | |
# Install firebase tools: https://firebase.google.com/docs/cli#install_the_firebase_cli | |
# Login to firebase: firebase login | |
# Login to gcloud: gcloud auth login | |
GCLOUD_PROJECT_ID=xxxx | |
BACKUP_BUCKET=gs://backups-$GCLOUD_PROJECT_ID-firebase | |
gcloud config set project $GCLOUD_PROJECT_ID | |
gsutil ls $BACKUP_BUCKET || gcloud storage buckets create $BACKUP_BUCKET | |
gcloud beta firestore export --async $BACKUP_BUCKET | |
firebase use $GCLOUD_PROJECT_ID | |
firebase auth:export users.json --format=JSON | |
# More manual stuff | |
# Wait a few min then download the bucket, it takes like 5 min to export: | |
# - gsutil -m cp -r gs://$BACKUP_BUCKET . | |
# | |
# - Save the Password Paramaters from the firebase authentication section https://firebase.google.com/docs/cli/auth#password_hash_parameters in your password manager probably |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment