dashersw / cote

A Node.js library for building zero-configuration microservices.
http://cote.js.org
MIT License
2.35k stars 187 forks source link

Recommended approach to version Cote microservices? #234

Closed chaeron closed 3 years ago

chaeron commented 3 years ago

We need the ability to version microservices and have multiple versions of a microservice running and available at any one time.

What is the recommended approach using Cote, to implement versioning of microservices?

Thanks!

dashersw commented 3 years ago

Hello @chaeron! cote has a feature called Keys to segregate different services. In this case the approach I prefer is to create new services with different keys. This allows them to co-exist, and then the clients / consumers can decide to operate on whichever key they like. If you are already using keys, you can choose to use Environments or Namespaces instead.

dashersw commented 3 years ago

Furthermore, cote has an undocumented but useful feature called subsetting or directed requesters, which allows you to choose which group of responders your request should land at, given the same environments and keys.

You can see detailed usage scenarios in the tests: https://github.com/dashersw/cote/blob/master/test/directed-requester.js. This would allow you to use and choose versions in individual messages, rather than at a requester component level.

chaeron commented 3 years ago

Thanks for the guidance, Armagan!

The subsetting approach seems like a really clean way to layer versioning on top of microservices, while leaving keys for other purposes. Nice!