Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to HotSwap #1447

Closed
OpenSpacesAndPlaces opened this issue Dec 13, 2021 · 5 comments
Closed

How to HotSwap #1447

OpenSpacesAndPlaces opened this issue Dec 13, 2021 · 5 comments
Labels
Type: Bug Something isn't working

Comments

@OpenSpacesAndPlaces
Copy link

If you're using YARP to manage .Net Core site and you're running off the exe.

What's the correct strategy to load and warm a new version of the site and then swap the old and new?

@OpenSpacesAndPlaces OpenSpacesAndPlaces added the Type: Bug Something isn't working label Dec 13, 2021
@Tratcher
Copy link
Member

Tratcher commented Dec 13, 2021

This is for a new version of the app behind the proxy, right? Not a new version of the proxy?

In general, YARP doesn't directly manage the destinations, you need an orchestrator for that. The general procedure is:

  • Bring up a new instance of the site, send it some warmup requests
  • Update YARP's config to include the new destination
  • Make sure everything's running well
  • Update YARP's config to remove the old destination

There's not currently a mechanism to gradually shift traffic from one to the other. With both destinations active at once you'd get traffic load balanced between them. There's some discussion here: #126

@OpenSpacesAndPlaces
Copy link
Author

OpenSpacesAndPlaces commented Dec 13, 2021

Update YARP's config to include the new destination
Make sure everything's running well
Update YARP's config to remove the old destination

You're saying if I do like this:

 "ReverseProxy": {
    "Routes": {
      "route1": {
        "ClusterId": "cluster1",
        "Match": {
          "Path": "{**catch-all}"
        }
      }
    },
    "Clusters": {
      "cluster1": {
        "Destinations": {
          "destination1": {
            "Address": "https://www.mysitestaging.com"
          }
        }
      }
    }
  },

->

 "ReverseProxy": {
    "Routes": {
      "route1": {
        "ClusterId": "cluster1",
        "Match": {
          "Path": "{**catch-all}"
        }
      }
    },
    "Clusters": {
      "cluster1": {
        "Destinations": {
          "destination1": {
            "Address": "https://www.mysitelive.com"
          }
        }
      }
    }
  },

YARP will automatically read the config file changes and server over a new DNS?

So my pattern would be like?:

New Code -> Staging Url
Old Code -> Coldsite Url
New Code -> Live Url + Cofirm Loadin
Old Code -> Spin Down App


If that's the path - should be easy enough to-do with Octopus Deploy.

@Tratcher
Copy link
Member

Yes, YARP will react to config changes live.

Having a staging site is good too, but I was referring more to having both running side by side like this:

    "Clusters": {
      "cluster1": {
        "Destinations": {
          "destination1": {
            "Address": "https://live1" // old code
          }
        }
      }
    }

->
Add new instance

    "Clusters": {
      "cluster1": {
        "Destinations": {
          "destination1": {
            "Address": "https://live1" // old code
          },
          "destination2": {
            "Address": "https://live2" // new code
          }
        }
      }
    }

Chech health
->
Remove old instance

    "Clusters": {
      "cluster1": {
        "Destinations": {
          "destination2": {
            "Address": "https://live2" // new code
          }
        }
      }
    }

Spin down old instance

@OpenSpacesAndPlaces
Copy link
Author

Thanks! We'll give this a shot!

@karelz
Copy link
Member

karelz commented Jan 4, 2022

Triage: Looks answered. #126 will handle the slow rollout.

@karelz karelz closed this as completed Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants