Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How we configure API gateway, service discovery for micro services in pcf?

I am learning building microservices using spring boot, Spring Cloud(netflix OSS Components). I have used netflix Eureka for service discovery, zuul for api gateway, ribbon, feign while running in my local machine.

Netflix eureka, zuul, ribbon, feign spring cloud config are not useful when we deploy to PCF?(if yes what are the alternatives available in pcf and how to configure them?)

As who are building microservices follows CI/CD approach, how developer verify working of their micro services before pushing code as we don't use eureka, zuul,ribbon,feign in production pcf. (how to simulate pcf environment in developer machine?).

like image 336
Riding Cave Avatar asked Apr 20 '18 15:04

Riding Cave


2 Answers

I'd suggest to read below content before implementing if you have any doubt regarding usage of Eureka and Zuul, you will get all answers yourself.

https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance

https://github.com/Netflix/zuul/wiki

As who are building microservices follows CI/CD approach, how developer verify working of their micro services before pushing code as we don't use eureka, zuul,ribbon,feign in production pcf.

Answer to this question is: You must be aware of JUnit test cases, so you can run you test cases using deployment pipelines to make sure all your functionalities are working as expected or you can use Test Automation for the same.

(how to simulate pcf environment in developer machine?). Answer to this one: You can use eclipse plugin you are using eclipse/STS IDE. Or you can connect all PCF services from you local machine using CloudFactory

@Bean
public Cloud cloud() {
    return new CloudFactory().getCloud();
}

https://docs.pivotal.io/pivotalcf/2-1/buildpacks/java/sts.html

like image 96
Avhi Avatar answered Jan 15 '23 05:01

Avhi


Here are some thoughts:

  • Eureka Service discovery: in my opinion this is not strictly necessary when running on PCF. When you push an app on PCF usually a route is assigned to your app, and you can use this Route as a poor man's service discovery. Eureka would allow you to use client-side load balancing in the case of container-to-container networking, but usually you wouldn't need this.

  • Zuul: Can be very useful also on CloudFoundry in case you are doing things like writing frontend-for-backend services, providing frontends for different devices (mobiles, desktops, i-pads) that use the same backend services. Might also be useful for an authentication/authorization layer or rate-limiting. One native CloudFoundry alternative would be to use route-services for tasks such as rate limiting, authentication/authorization.

  • spring-cloud-config: makes sense if you want your configuration to be under version control for different environments. This is useful no matter if you are running on CloudFoundry or not. I don't know of any alternatives on plain CloudFoundry.

  • spring-cloud-feign: makes sense if you want use annotations such as @RequestMapping with your Feign client interfaces. This is independent on if you are running on CloudFoundry or not. AFAIK there are no alternatives for this in case you want to use Spring MVC annotations with Feign.

  • ribbon: makes sense if you want to use client side load balancing as opposed to let the CloudFoundry router to do the load balancing for you.

How developers can check locally if this works for them:

  • In general, I don't believe developers should need to check locally if their app is working fine together with zuul, cloud-config-service, and eureka.

  • They could check this in a dev or test space or environment though.

  • If they really want to check this on their local machine, they could download PCFDev and run these infrastructure components there.

Hope this helps.

like image 20
user152468 Avatar answered Jan 15 '23 06:01

user152468