Hello, I currently have a firebase webapp and I have a situation where I need a GCP VM to run Typesense which I'm self-hosting for compliance reasons (Typesense Cloud would be easier). I am not really an expert on networking and security but what I need to do is have the firebase webapp send requests to the VM typesense server using an internal IP address. I did come across this this S.O. answer:
It's a similar requirement but seems like there's particular emphasis on cloud functions and serverless, which I'm not using. Is the only way to do this to create a custom VPC? Is there a more straight forward guide on the entire process? Thanks
Hi @Marlonus ,
This approach might work for you as it is more tailored for VM instances rather than serverless or Cloud Functions. To enable the communication between the Firebase web app and VM (Typesense) using an internal IP address, creating custom VPC is definitely the most possible and effective approach as it will provide control over the network and setup interal IPs for the VMs.
Let me rundown the steps:
1. Create your Custom VPC. Make sure to provide a name for your VPC, and specify the IP range for the VPC.
2. Inside the VPC network, create one or more subnets. Remember to use the internal IP range for these subnets and specify a region for each of them.
3. For the firewall rules, set up firewall rules to allow traffic between the Firebase web app and the Typesense server. There must be a rule that will allow ingress traffic for the application (ports).
Assuming that you have not yet created or you will recreate the setup, this is for the VM instance creation and Firebase configuration.
4. When you create the VM instances for your Typesense server, make sure they are part of the custom VPC and subnet. Then assign the internal IP address to the VM.
5. When setting up your Firebase web app, remember to change the API endpoints or any important URLs to use the internal IP addresses or internal DNS names of your Typesense VMs.
From here, you can test and check if the VM can communicate with the Typesense server using the internal IP addresses.
Let me know if this helps.