How to add my project to multiple GCP resource locations? - firebase

I have built a firebase project which has "asia-south1" as its default GCP location, I choose this location because other servers had too much latency. But now I want the application to work in other countries as well, The data of one GCP location will also be accessed by others if we have multiple firebase projects and now I have really no idea how to proceed, your help would be really appreciated.
Hope I was able to clear the question
Thank you

Your Cloud Firestore data can be kept in either a regional or a multi-regional location. The developer must choose a location when Firestore is enabled in a project.
The only way for a developer to alter the location of data in an existing project is to start a new Firestore project at the desired location and transfer the data using the Import/Export capability. A Firestore project's location is not currently possible to be changed.
This is the public documentation on Firestore locations.
Just to clarify and complete my current response a little more, the only way to migrate your data (move your data) to another project at this time is manually using the managed export feature, as stated in this official document, or using cloud functions to schedule exports, as stated in this other one document, and then importing the data into your destination project.

It is unfortunately impossible to change the location of Firestore resource locations after setting up Functions, RTDB or Firestore. As per The Docs, Warning: Setting the location for one of these services (that is, Cloud Firestore, Cloud Storage, or scheduled functions) also sets the location for the others. After you set your project's default GCP resource location, you cannot change it.

Related

Where to store Google Service Account Key while using Google Firebase Functions

Using Google Firebase Functions as a backend of the small application.
Functions are accessing to the Firestore and Realtime database, therefore they need service account credentials file.
On the other hand, I'm trying to automate the deployment of the functions using Github Actions.
Currently I places the credentials file inside the repository. I know that it's not secure.
What is the proper way of storing service account credentials file in this case?
Firebase projects, are, in effect, Google Cloud Platform projects.
More specifically, when you create a Firebase project, an associated Google Cloud Platform project is created for it.
Therefore the process for storing credentials is the same as in Cloud Platform, which is to say in a file, somewhere relatively safe.
This file should be accessible to your Function if it is required, and should either have its path specified as part of an environment variable or explicitly declared in code.
You are already storing it the proper way, because the improper way would be to insert the contents of the JSON file directly into code.
To prevent others from seeing the contents of the JSON file, simply set the respository as private.

How to get the location/region of an Datastore instance

To call the Datastore.export() API I need to provide a GCS bucket name in the same region as the Datastore I'm exporting.
I checked with node.js' #google-cloud/datastore Datastore instances seem to have no .location property or something similar. Also, the Google provided Datastore libraries in other languages seem to lack this functionality.
With other Google APIs you usually have a way to get the Location of the resource. E.g. in GCS: Storage().bucket('mybucket').getMetadata().location -> 'EU'.
How to view Google Cloud Datastore Region shows to get this information in a manual way, but I'm after programmatic access.
Firestore has a database get method (in preview as of 2021-12-23), that you can use to lookup the location of your database. This API will also tell you the mode of your database (Firestore native vs Datastore mode).

How to change the lcoation of firebase storage?

Hello everyone while checking my costs for my firebase project, I detect that I have high cost caused by appspot . My GCP- is located at eur3 (europe-west). But my firebase Storage is Multi-Regional. So my question is can I change the location for firbebase Storage ? My question is not about us.artficats only about if it's makes sense to change location of firebase storage if so then how ?
Also as you can see that us.artifacts....appspot.com takes HUGE Bandwidth. The Problem should be fixed in Firebase CLI 9.14 but mine is 9.23.1. So I have no idea what caused this problem.Please leave also a solution(if you know a fix )down below.
Cloud Storage for Firebase stores your files in a Google Cloud Storage bucket, making them accessible through both Firebase and Google Cloud. Cloud Storage location is set on a bucket and you can create different buckets in different locations. You can change the storage class of the bucket but changing the location for the bucket is not supported currently. So if you want you can create another bucket with the preferred location. You can follow this guide on how to move and rename the bucket.
Now about the huge bandwidth taken by the us.artifacts....appspot.com bucket, I would suggest you setting up the Life Cycle Management Policy on the bucket as mentioned in this StackOverFlow answer.

Where are the Firebase server locations?

I am afraid of some latency when calling Firebase API. So I would like to know where the Firebase API servers are located. Are there any documents? Please help. Thanks.
The official documentation regarding choosing locations for your project, doesn't include an option for the Firebase Authentication. So currently, there is no way to specify a particular location for storing the Firebase Authentication data.
However, when you are using Cloud Firestore, Cloud Storage, or Cloud Functions for Firebase, you're prompted to select your project's default location. On the other hand, when using the Realtime Database, you're prompted to select the location of the instance, and each instance can be in a different location.
If you are also using Analytics, you're also prompted to select an Analytics reporting location. You can select a country or region that represents the location of your organization.

Firebase Hosting for a client in Denmark by a group of developers in India

I am working on an application for a client in Denmark, using the firebase Hosting, Firestore and Cloud functions from among the features of firebase.
While creating a project on the console i selected the location as Denmark as well, so my doubt here is once i Deploy the app to my client's system where will the server be location, will all the features work as expected.
If not what configurations are required?
First of all, you need to read this carefully. Even if you selected Denmark, it does not determine the location of your data for Firebase features.
I recommend you to take a look at this link for Firestore region. In the case of Cloud Function region, it is helpful to look at this link and this link.

Resources