Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Microservices in GAE #10345

Closed
1 task done
SudharakaP opened this issue Sep 3, 2019 · 15 comments · Fixed by #11969
Closed
1 task done

Add Support for Microservices in GAE #10345

SudharakaP opened this issue Sep 3, 2019 · 15 comments · Fixed by #11969
Assignees
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: GCP $100 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@SudharakaP
Copy link
Member

SudharakaP commented Sep 3, 2019

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

  • Checking this box is mandatory (this is just to show you read everything)
@saturnism
Copy link
Member

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:

  • Use a dispatch file to map sub-urls to the backend services.
    • Do this in the Gateway application
    • Disable Zuul and everything similar to Kubernetes Ingress / Istio
    • Similar to Kubernetes Ingress, we can map by prefixes, e.g., /services/inventory/* -> inventory service

@SudharakaP
Copy link
Member Author

@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. 😄

@pascalgrimaud pascalgrimaud added $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/ labels Sep 12, 2019
@pascalgrimaud
Copy link
Member

Adding a bounty for this

@SudharakaP
Copy link
Member Author

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

@SudharakaP
Copy link
Member Author

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). 😄

@SudharakaP
Copy link
Member Author

SudharakaP commented Oct 6, 2019

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
Copy link
Member Author

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

@saturnism
Copy link
Member

i think we should use the same generator :D

@SudharakaP
Copy link
Member Author

@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
Copy link
Member

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
Copy link
Member Author

@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
Copy link
Member Author

@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? 🤔

@saturnism
Copy link
Member

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
Copy link
Member Author

SudharakaP commented Jun 20, 2020

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

@SudharakaP
Copy link
Member Author

SudharakaP commented Jun 21, 2020

@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. 😄

SudharakaP added a commit to SudharakaP/jhipster.github.io that referenced this issue Jun 21, 2020
… GAE

This adds some new details about the support for microservices in GAE and refactor the GAE sections.

Related to jhipster/generator-jhipster#10345
@pascalgrimaud pascalgrimaud added this to the 6.10.0 milestone Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: GCP $100 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants