Setup multiple sites for your project using firebase
Why you need multiple sites
You need to separate sites for production, staging, development so that you don’t mess up client’s data and you can do testing.
To mirror your workflow environments (for example, Dev, Q1, Q2, Prod), we recommend that you create a separate Firebase project for each environment rather than creating multiple sites in a single Firebase project.
Generally, you don't want to use production-environment Firebase resources (like customer data in a Realtime Database) in a development environment.
Things to watch out for
- regions
- Function Locations Where you deploy your site can affect the speed and cost.
Things to do
- Install firebase-tools (nodejs, npm)
- Check in the right environment
firebase projects:list
Set projectfirebase use project-name
- export users
firebase auth:export users.json
- change project
- import users
firebase auth:import users.json --hash-algo=scrypt --hash-key=xxx --salt-separator=xxx --rounds=8 --mem-cost=14
- project authentication hash settings example hash-key, salt-separator settings
- Install anaconda setup python env
- Install gcloud sdk
- enable Cloud Storage
- export data
gcloud config set project project-id gcloud firestore export gs://project-id.appspot.com/all-collections-20200218 gcloud firestore operations list
- import data
gcloud config set project project-id2 gsutil cp -r gs://project-id.appspot.com/all-collections-20200218 gs://project-id2.appspot.com gcloud firestore import gs://project-id2.appspot.com/all-collections-20200218
Comments