Punter Vicky
Punter Vicky

Reputation: 16982

Cloud Foundry - Multiple versions of services

When I want to deploy multiple versions of same microservice , should I have different endpoints exposed one for each service. For instance if I am exposing CustomerService , should I expose http://host:port/v1/CustomerService , http://host:port/v2/CustomerService etc? Or is there a way to expose a single endpoint and route based on consumer within cloud foundry?

Upvotes: 0

Views: 405

Answers (1)

Amit Kumar Gupta
Amit Kumar Gupta

Reputation: 18567

You can create and map routes that include part of a path, e.g. v2. For instance, you might have two apps, MyService and MyServiceV2, then you could do:

cf create-route SPACE_NAME SOME_APP_DOMAIN --hostname myservice
cf create-route SPACE_NAME SOME_APP_DOMAIN --hostname myservice --path v2
cf map-route MyService SOME_APP_DOMAIN --hostname myservice
cf map-route MyServiceV2 SOME_APP_DOMAIN --hostname myservice --path v2

Then, any clients of this microservice can talk to things like myservice.SOME_APP_DOMAIN/some-resource or myservice.SOME_APP_DOMAIN/v2/some-resource, depending whether these are old clients talking to the old service, or up-to-date clients talking to the newer one.

Upvotes: 2

Related Questions