Score:1

Migrating React app from App Engine to Cloud run LB configuration

br flag

We tried to migrate our front end app from App Engine to Cloud run.

We did the following steps

  1. Created a LB, so we could direct traffic to the correct Cloud run APP.
  2. Changed DNS A records from App engine pointing to LB's external IP.

Traffic began flowing into cloud run , BUT we started to see some off the traffic still redirect to the app engine and got 404.

Our assumption is that some DNS,ISP and cache take few days to refresh SO we need to find a way to serve both version (AppEngine and cloud run) under the same domain.

How do we set up two different back-ends for one load balancer ?

Wojtek_B avatar
jp flag
It's possible to have two backedns for one load balancer but it's not clear why you're getting 404's so please update your question with some logs - at this moment it would be guessing what's going on. You can also change TTL of your A records to 60 seconds which may also help.
Score:0
jp flag

To answer your question - it is possible to configure one GCP load balancer with multiple backends such as:

  • instance groups
  • single VM's
  • GAE applications
  • Cloud Run functions
  • network endpoint groups (consisting from external hosts)
  • storage buckets

For example let say you have a load balancer with dwo backends:

  • GAE app
  • Cloud Run function

One of them will be available under yourdomain.com and the other has to be available with a yourdomain.com/somepath/ - it's up to you which one will be the "main" one.

It also possible to add other backends to the LB - all of them will have to be available under different paths.

It can look like this: enter image description here

As you can see you can have one frontend for both GAE and Cloud Run and the same port - the only difference is the path.

This will however not solve your issue - if some DNS's that you have no control ever still redirect to the old IP - the only "weapon" you have here is to change TTL in the DNS service from several hours to 1 minute or so and hope that changes will propagate fast enough.

Wytrzymały Wiktor avatar
it flag
Hello @MIkCode. Does this [answer your question](https://stackoverflow.com/help/someone-answers)?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.