Creating a Spring Cloud microservice - spring

I am trying to learn and create a microservice using Spring Cloud. I am using Spring mvc and Spring Boot for development. I added separate Spring Boot application for both Eureka server and Zuul client. I have three Spring Boot application now. One Sureka server, one for Zuul routing and third one is for my microservice application. I run the Eureka server and the microservice and Zuul found to be running properly in Eureka server UI.
My doubt is that, I am planned to use routing and service discovery in my microservice. So I have a total of three Spring Boot applications. Can I deploy these three applications into AWS Elastic Beanstalk?
When I exploring I found that Pivotal Cloud Foundry topic. Since I am planing to use AWS Elastic Beanstalk. So what is the role of Pivotal Cloud Foundry in my application?
I am still confused about microservice development using Spring Cloud.

So there are two elements in your confusion. Is Amazon Beanstalk suitable?
So answer is yes. but you have overhead of orchestrating various services of amazon over then. Basically Amazon Elastic Beanstalk is more form based which means you need to tell what exactly you want to do with application for example route setup , scaling mechanism , application portability, application health management , Integration with external log aggregators etc. This is big learning curve to many people (including me :) ). Where as these with PCF these things are easy and straightforward and sometimes implicitly done.
Now Can I use pivotal cloud foundry with amazon? answer will be absolutely yes.
Pivotal cloud foundry is Wrapper written over open source Cloud Foundry project.
It is more succinct PaaS option than Amazon Beanstalk. You can host PCF on amazon ec2 ( IaaS )boxes using BOSH software. To answer you PCF is a alternative to Amazon Beanstalk. You don't need PCF is you want to use Amazon Beanstalk and vice versa.

Related

Deployment of spring application on kubernetes cluster

I am going to create a kubernetes cluster to deploy all my spring boot microservices. Currently I have a spring cloud gateway server, a eureka discovery server and my back-end and front-end applications.
Do we need gateway server and discovery server if deployed on kubernetes, as these services are provided as part of cluster?
Thanks.
You are not required to use the Spring Cloud Gateway or Eureka discovery server. Kubernetes provides all basic building blocks (like Service) implemented without additional software requirements (for example with plain DNS).
If you need a more advanced setup you can integrate kubernetes API in Spring applications or use other ways to integrate. For the 90% case there is no need to do so.

How can i configure Spring Cloud Config Server with refresh functionalities on AWS ECS

I am migrating a Spring Boot application from PCF to AWS ECS which is currently using cloud config server reading properties from git repo, and aws RDS. Now in ECS is there a way we can implement config servers along with refresh in ECS AWS.
I think ECS operates on a different level.
Spring Cloud Config server is a solution that works especially good with spring boot based applications. For example, a refresh option that you've mentioned is implemented as a special Scope which is purely a spring (applicative) thing.
On the other hand, AWS ECS (stands for Elastic Container Service) provides a way to work with containers in a general sense (with scaling and everything). It doesn't require the containers to be spring-based or even java based.
So, I think you might want to consider keeping a spring boot driven microservice for config server just like you have now, but wrap it into docker container and deploy it in AWS ECS

Deploying micro services to Pivotal Cloud Foundry and establish communication between the micro services

I have multiple .Net core micro services where some of the micro services will talk/communicate with the other micro services. I want to deploy these services to Pivotal Cloud Foundry(PCF) each to a different container and need to establish the communication between them.
I have tried using Registry service in PCF which didn't work out.
I wanted to know the steps which are used to establish the communication between the micro services.
Any existing example with code would help out.
Could anybody help on this?
Thanks
What you need is Steeltoe.
Steeltoe client libraries enable .NET Core and .NET Framework apps to easily leverage Netflix Eureka, Hystrix, Spring Cloud Config Server, and Cloud Foundry services.

Running Apache Ignite Cluster on Pivotal Cloud Foundry environment

I am trying to build a Apache Ignite Cluster on Pivotal Cloud Foundry environment as follows.
Created a Spring-Boot app that starts a new Ignite node, Deployed it on on Cloud Foundry ( ex. Ignite-Node1)
Created another Spring-Boot app which will also starts a new Ignite node, Deployed it on on Cloud Foundry ( ex. Ignite-Node2)
Now, even though both the apps are running in a same CloudFoundry Env, they are not forming the Ignite Cluster as they are not able to discover each other.
Apache Ignite documentation provides examle configuration details for AWS, Google cloud , however there are no examples for Pivotal Cloud Foundry.
Can somebody provide me with an example configuration on how to get the Ignite Cluster running on Cloud Foundry environment.
Srini
Container-to-container (app-to-app) networking is not supported on Pivotal Cloud Foundry, although it is possible to enable.
By default all communications must be made 'via the front door' through Cloud Foundry's router, either via HTTP or on a TCP port. One cannot choose which instance of an application to hit. This is due to change with the Container Networking initiative, the progress of which you can check on Pivotal Tracker. There is a detailed design document which is publicly available.
An alternative approach which is more appropriate for data services is to deploy them using BOSH. As a PCF user, you may wish to consider creating a PCF Tile for Apache Ignite.
My company has been helping Hazelcast create a PCF Tile that will create dedicated-VM clusters on-demand. Perhaps you could consider making use of Hazelcast instead?

how monolith spring 3 application will communicate with microservice?

I have one monolith spring web application developed using spring 3.1 and spring-security 3.1 with Java 7 and it is deployed on tomcat 7.
Now I have a new requirement where I have to create a micro-service for a new module using spring boot with java 8. This micro-service will be deployed separately on different EC2 instance.
I am looking for suggestion/idea to access new microservice from my existing spring web application.
How to perform inter process communication within these two spring application?
Can someone provide me any help/pointer?
You can make use of service discovery pattern, which are mainly of two kinds -
Client-side discovery - This is where clients are responsible for figuring out available service instances. Example - Netflix OSS.
Server-side discovery - In this the service instances are registered on the server-side using a service registry. Example - AWS ELB.
You can read a lot about these on the internet. Just remember the keywords.
Hope this helps !

Resources