Comments (17)
I was able to get service discovery working when I wrote this blog post back in December.
from generator-jhipster.
Yes, we should add the --experimental flag.
Done
from generator-jhipster.
I will take a look.
from generator-jhipster.
There is no support for service discovery yet.
from generator-jhipster.
I was able to get service discovery working when I wrote this blog post back in December.
There is no support for spring.cloud.gateway.discovery.locator.enabled=true
So this does not work:
Routes needs to be manually configured.
from generator-jhipster.
Confirmed: spring-cloud/spring-cloud-gateway#3332
from generator-jhipster.
Gateway is reactive by default it’s possible to force it imperative by setting reactive false
or --no-reactive
.
Issues:
- openapi generated server url is wrong in microservices.
- JwtTokenRelay needs to be implemented.
Maybe we should require --experimental
flag.
from generator-jhipster.
Yes, we should add the --experimental flag.
from generator-jhipster.
I tried using the following JDL with 8.3.0:
application {
config {
baseName gateway
packageName org.jhipster.gateway
applicationType gateway
authenticationType oauth2
buildTool gradle
clientFramework react
prodDatabaseType postgresql
serviceDiscoveryType consul
testFrameworks [cypress]
microfrontends [blog, store]
}
}
application {
config {
baseName blog
packageName org.jhipster.blog
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType neo4j
enableHibernateCache false
serverPort 8081
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Blog, Post, Tag
}
application {
config {
baseName store
packageName org.jhipster.store
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType mongodb
enableHibernateCache false
serverPort 8082
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Product
}
entity Blog {
name String required minlength(3)
handle String required minlength(2)
}
entity Post {
title String required
content TextBlob required
date Instant required
}
entity Tag {
name String required minlength(2)
}
entity Product {
title String required
price BigDecimal required min(0)
image ImageBlob
}
relationship ManyToOne {
Blog{user(login)} to User with builtInEntity
Post{blog(name)} to Blog
}
relationship ManyToMany {
Post{tag(name)} to Tag{post}
}
paginate Post, Tag with infinite-scroll
paginate Product with pagination
deployment {
deploymentType docker-compose
serviceDiscoveryType consul
appsFolders [gateway, blog, store]
dockerRepositoryName "mraible"
}
deployment {
deploymentType kubernetes
appsFolders [gateway, blog, store]
clusteredDbApps [store]
kubernetesNamespace demo
kubernetesUseDynamicStorage true
kubernetesStorageClassName ""
serviceDiscoveryType consul
dockerRepositoryName "mraible"
}
The command I used to create my apps:
jhipster --experimental jdl app.jdl
If I look for webflux in the gateway's build file, it's still there:
$ cat gateway/build.gradle | grep webflux
implementation "org.springframework.boot:spring-boot-starter-webflux"
implementation libs.springdoc.openapi.starter.webflux.api
Do I have to specify reactive false
for the gateway?
from generator-jhipster.
Do I have to specify
reactive false
for the gateway?
Yes
from generator-jhipster.
I used the following JDL to create a set of apps:
application {
config {
baseName gateway
reactive false
packageName org.jhipster.gateway
applicationType gateway
authenticationType oauth2
buildTool gradle
clientFramework react
prodDatabaseType postgresql
serviceDiscoveryType consul
testFrameworks [cypress]
microfrontends [blog, store]
}
}
application {
config {
baseName blog
reactive false
packageName org.jhipster.blog
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType neo4j
enableHibernateCache false
serverPort 8081
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Blog, Post, Tag
}
application {
config {
baseName store
reactive false
packageName org.jhipster.store
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType mongodb
enableHibernateCache false
serverPort 8082
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Product
}
entity Blog {
name String required minlength(3)
handle String required minlength(2)
}
entity Post {
title String required
content TextBlob required
date Instant required
}
entity Tag {
name String required minlength(2)
}
entity Product {
title String required
price BigDecimal required min(0)
image ImageBlob
}
relationship ManyToOne {
Blog{user(login)} to User with builtInEntity
Post{blog(name)} to Blog
}
relationship ManyToMany {
Post{tag(name)} to Tag{post}
}
paginate Post, Tag with infinite-scroll
paginate Product with pagination
deployment {
deploymentType docker-compose
serviceDiscoveryType consul
appsFolders [gateway, blog, store]
dockerRepositoryName "mraible"
}
deployment {
deploymentType kubernetes
appsFolders [gateway, blog, store]
clusteredDbApps [store]
kubernetesNamespace demo
kubernetesUseDynamicStorage true
kubernetesStorageClassName ""
serviceDiscoveryType consul
dockerRepositoryName "mraible"
}
I used the following command:
jhipster jdl reactive-mf.jdl --monorepository --workspaces --experimental
When I start everything, the gateway is not able to load the microservice apps and the menu says "Error loading component".
The logs show a 404 when trying to connect to downstream services.
2024-04-10T10:23:02.247-04:00 WARN 28572 --- [ XNIO-1 task-4] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.servlet.resource.NoResourceFoundException: No static resource services/store/remoteEntry.js.]
2024-04-10T10:23:02.248-04:00 WARN 28572 --- [ XNIO-1 task-7] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.servlet.resource.NoResourceFoundException: No static resource services/blog/remoteEntry.js.]
Everything works as expected when I change to use reactive true
in the JDL.
from generator-jhipster.
The logs show a 404 when trying to connect to downstream services.
Since there is no service discovery integration, due to #25715 (comment), that's expected.
Routes needs to be manually configured.
from generator-jhipster.
@mraible following #25817 the routes option accepts "route"
, "route:host"
or "route:host:port"
.
Updated jdl with routes option:
application {
config {
baseName gateway
reactive false
packageName org.jhipster.gateway
applicationType gateway
authenticationType oauth2
buildTool gradle
clientFramework react
prodDatabaseType postgresql
serviceDiscoveryType consul
testFrameworks [cypress]
microfrontends [blog, store]
routes ["blog:blog:8081", "store:store:8082"]
}
}
application {
config {
baseName blog
reactive false
packageName org.jhipster.blog
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType neo4j
enableHibernateCache false
serverPort 8081
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Blog, Post, Tag
}
application {
config {
baseName store
reactive false
packageName org.jhipster.store
applicationType microservice
authenticationType oauth2
buildTool gradle
clientFramework react
databaseType mongodb
enableHibernateCache false
serverPort 8082
serviceDiscoveryType consul
testFrameworks [cypress]
}
entities Product
}
entity Blog {
name String required minlength(3)
handle String required minlength(2)
}
entity Post {
title String required
content TextBlob required
date Instant required
}
entity Tag {
name String required minlength(2)
}
entity Product {
title String required
price BigDecimal required min(0)
image ImageBlob
}
relationship ManyToOne {
Blog{user(login)} to User with builtInEntity
Post{blog(name)} to Blog
}
relationship ManyToMany {
Post{tag(name)} to Tag{post}
}
paginate Post, Tag with infinite-scroll
paginate Product with pagination
deployment {
deploymentType docker-compose
serviceDiscoveryType consul
appsFolders [gateway, blog, store]
dockerRepositoryName "mraible"
}
deployment {
deploymentType kubernetes
appsFolders [gateway, blog, store]
clusteredDbApps [store]
kubernetesNamespace demo
kubernetesUseDynamicStorage true
kubernetesStorageClassName ""
serviceDiscoveryType consul
dockerRepositoryName "mraible"
}
from generator-jhipster.
@mshima This seems like quite a few changes for a feature that might go away once Spring Cloud Gateway MVC supports it. However, I talked with the Gateway project lead and he said service discovery won't be GA until November, so we should probably implement this workaround until then.
from generator-jhipster.
This could be reused for #21012, otherwise we should just close it.
from generator-jhipster.
@egvimo Would this solution work to solve #21012?
from generator-jhipster.
Yes, this would work, I think.
from generator-jhipster.
Related Issues (20)
- Angular: style broken on the threads dump modal
- Use typesafety within the generator HOT 3
- Allow unidirectional one-to-one
- IllegalArgumentException "key cannot be empty or null" on freshly created project. (add steps to the guide or fix the issue) HOT 6
- Oauth2 OIDC - claims - BuiltInUserEntity HOT 6
- side-by-side pattern for vue js
- Can't wrap a component from PrimeReact with ValidatedField.
- Astro for Microfrontend
- Embedded ManyToOne relationships are broken in vue and react frontends.
- Release missing v8 based blueprints. HOT 18
- [React] `serializeError` should not be used by known errors
- Upgrade spring-boot to v3.3.0 HOT 1
- Not generating service files HOT 4
- Upgrade to Angular 18 HOT 2
- Applications should not delete entire User records in tests. HOT 3
- Jhipster Support Sidebar Menu HOT 4
- generatr-blueprint creates *.js files instead of *.mjs HOT 7
- Get "Not Found" error for Entities menu for Micro Frontend entities HOT 3
- Release 8.5.0 with Spring Boot 3.3.0 HOT 18
- Handle generator-jhipster version compatibility using engines. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-jhipster.