jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.48k stars 4.02k forks source link

Add Support for Microservices in GAE #10345

Closed SudharakaP closed 4 years ago

SudharakaP commented 5 years ago
Overview of the feature request

I was thinking we could add support for Microservices in our GAE Environment(s). It seems that GAE supports microservices through services.

If this is something useful; I could work on this one. Let me know your thoughts. 😄

Motivation for or Use Case

Add Microservice support for GAE will make our GAE generator more complete with support for all types of applications we generate.

Related issues or PR

10284

saturnism commented 5 years ago

that would be great! i wanted to have that initially but there were some difficulties. I think most of the problems are now resolved through work done on Kubernetes.

Some thoughts on how to approach this:

SudharakaP commented 5 years ago

@saturnism : Wonderful; thanks for the suggestions; Although I have experience deploying monoliths on GAE, I haven't done any microservice deployments. So it will take me some time to figure this one out. :smile:

pascalgrimaud commented 5 years ago

Adding a bounty for this

SudharakaP commented 5 years ago

@pascalgrimaud : Thanks Pascal; not strictly necessary though; I enjoy doing it anyways. 😄

SudharakaP commented 5 years ago

Just to give a heads up; I'll be working on this after finalizing the AWS bug fixes which I think is more important (correct me if I am wrong). :smile:

SudharakaP commented 4 years ago

Do you guys like to add this to the existing gae generator, create a new generator (i.e: gae-microservices) or add this as a module? Let me know what you think. Just asking this since in some threads I've seen the reluctance to add new generators to due to maintainability. 😄

Personally I like the 2nd or 3rd approach; so as not to complicate the existing gae subgenerator.

cc: @saturnism @pascalgrimaud

SudharakaP commented 4 years ago

Okay, so I am gonna try the separate module approach. 😄

saturnism commented 4 years ago

i think we should use the same generator :D

SudharakaP commented 4 years ago

@saturnism : Thanks for the suggestion; yes we could do that. But curious why do you think this should be included in the same generator? I was thinking this might make it a bit more complicated with monolith and microservice logic in the same generator?

saturnism commented 4 years ago

since we already have jhipster gae, ideally the same command should work for both monolith and microservices apps. i feel users will try to run jhipster gae w/o second thought to look for blueprints and/or other ways to generate microservices deployments.

code complexity/design/implementation is orthogonal to this experience. I.e., if we really want, w/ the same command, we can still have maintainable/modular generator code that doesn't have all the if/else statements :)

SudharakaP commented 4 years ago

@saturnism : Sounds good. Let us then go with the same generator. Thanks much for your suggestions. I was just going to start coding with the new module approach yesterday. 😉

SudharakaP commented 4 years ago

@saturnism @ludoch : Sorry for taking so long to try this out. I've done some tests with dispatch.yml. However I think we have a problem with the way dispatch.yml currently behaves which makes it probably impossible to do this feature. So when we route say */services/invoice/* to invoice microservice for example, the router automatically prefixes any request which contains /services/invoice/ with /services/invoice/. Which means a request such as, https://micro-gae.uc.r.appspot.com/services/invoice/api/invoices makes a request in the invoice micro-service as .../services/invoice/api/invoices which is not what we want. Rather, the request should only contain .../api/invoices. Is there a way in the dispatch.yml to configure this? :thinking:

saturnism commented 4 years ago

hiya! i don't think there is an ability to do the rewriting. however, iirc, this is the same w/ a Kuberntes ingress, and do the path pass-through. So the service itself was configured to listen on /services/[servicename]/ prefix

SudharakaP commented 4 years ago

@saturnism : Thanks a lot. I don't know how I missed that; yes it works. I'll code this up soon. :+1:

SudharakaP commented 4 years ago

@saturnism : Thanks a bunch for your help. I've submitted the PR. Let me know if you see any issues with it. Basically this one will automatically add the context path in the application properties file for micro-services and for a gateway application it will prompt the user to select the micro-services; after which it will create the dispatch.yml file as well as add the appropriate application properties.

A sample gateway with two microservices deployed using this can be found at;

Gateway: https://micro-gae.uc.r.appspot.com/

invoice micro-service: https://invoicegae-dot-micro-gae.uc.r.appspot.com/services/invoice/

notification micro-service: https://notificationgae-dot-micro-gae.uc.r.appspot.com/services/notification/

I'll create a documentation PR as well. :smile: