15

A blue green deploy involves pumping live prod data flows (blue) into a hot swap non prod environment (green) in preparation to deploy to live the green environment, such that the green has full data sync with the previous prod blue environment.

I am wondering what people are using to live copy ongoing websocket traffic from blue to green do I write my own or is there a publish/subscribe websocket library or possibly a different approach to blue green?

My app has nodejs REST servers which also manage websocket traffic from mobile devices ... a mongodb server, etc ... each in containers on GCE/AWS

I realize I could just keep the mongodb in sync from blue to green however that would not exercise the green nodejs servers with live traffic which is a nice regression sanity check I am looking for

Possibly if I just live forward HTTP traffic the underlying websocket which runs atop HTTP will just take care of itself and not demand specific blue green setup

2

2 Answers 2

5

With a minimally engineered server code (a Google AppEngine application in the example) it's possible to duplicate and forward incoming HTTP traffic received by a production server to a test server (or vice-versa) for the purpose of comparing their responses. See https://stackoverflow.com/questions/38799566/can-i-asynchronously-duplicate-a-webapp2-requesthandler-request-to-a-different-u.

1
  • Websockets aren't really normal HTTP traffic.
    – coderanger
    Feb 28, 2017 at 23:38
6

Websockets don't really have any handling for this per se. You could build your own system but generally the idea for HA is that if anything happens you'll set the client up to automatically reconnect. There will be some non-zero downtime during a blue-green swap but if your app is well built it should handle that already.

If you wanted something more smooth, you could build a message in to your protocol to connect to a new server and then drop the original connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.