0

I am working on a Firebase project, and I'm wondering how to push code up through my chain of environments. My understanding is that you are supposed to create a different project for each environment. If this is wrong please stop me now. Let's say for example, I have a prod and test environment. I create a Cloud Function on test and it works fine. I now want to move it to prod environment. How do I do this? Same goes for authentication etc?

Also, can I copy an environment(project) and create another one if, for example, I want to have two dev environments?

Thanks so much for your help! -Matt

Matt125
  • 13
  • 3

1 Answers1

0

It is always a best practise to have different environments....Below stackoverflow thread will help you in that part of your question: Best practice for test and production environments

Regarding moving your Cloud Function from one project to another: You can use GitHub Actions for deploying your Cloud Function in that way you will just need to tweak your YAML/Config file.

Another way is you can deploy your application via Cloud Run....Since, Cloud Run runs containers ( which is in turn your application ) .... it will be easier to deploy that container to your another project... and you can simply deploy Cloud Run in another project.

  1. Create Docker Images of your application
  2. Push your Docker Images to your GCP Project
  3. Deploy Cloud Run Application using the container you just pushed to GCP ... it will reside in your Google Container Registry

https://cloud.google.com/run/docs/quickstarts/deploy-container

Also, there is a key difference between Cloud Run and Cloud Function: Cloud Functions only supports a single request at a time for each cloud function instance whereas Cloud Run is able to handle multiple requests at the same time and is able to scale up based on demand.

  • I hope this addressed your concerns..... – Aayush Mohta Aug 26 '22 at 09:06
  • Thanks so much @Aayush Mohta! I'm going to keep the question open for a little while longer in case anyone else wants to say something but I will almost certainly accept your answer. Thanks again! – Matt125 Aug 27 '22 at 16:56