Closed mraible closed 1 year ago
Can this be related to consul as default service discovery mechanism?
@atomfrede Possibly. If I create a microservices architecture with jhipster jdl reactive-mf.jdl
, it works. This JDL uses Consul instead of JHipster Registry.
Do you know why this might be happening, @deepu105? Are you able to reproduce it?
Today, I discovered that jhipster jdl reactive-ms.jdl
doesn't create any files in the docker-compose
directory. Here's the relevant section from the JDL:
deployment {
deploymentType docker-compose
appsFolders [gateway, blog, store]
dockerRepositoryName "mraible"
}
Added a bug bounty to try and get this fixed. I was hoping to use jhipster jdl reactive-ms.jdl
in my demo next Tuesday.
The deployment is missing the serviceDiscovery since eureka is not default anymore. But from your reproduction, doesn’t sounds related.
CI is passing with eureka. I will try to reproduce.
@mraible
cd gateway docker compose -f src/main/docker/keycloak.yml up -d docker compose -f src/main/docker/jhipster-registry.yml up -d ./gradlew
fails due to a race condition. jhipster-registry fails to start due to keycloak not started.
cd gateway
docker compose -f src/main/docker/services.yml up -d
./gradlew
I've added the services.yml
recently.
Works.
@mshima I was using npm run ci:e2e:prepare
, which does use services.yml
. I tried manually using:
docker compose -f src/main/docker/services.yml up -d
The JHipster Registry starts up just fine and I can log in to it via Keycloak at http://localhost:8761
.
If I start the gateway using ./gradlew
, it fails to register itself.
----------------------------------------------------------
2023-02-27T15:22:24.501-07:00 INFO 13013 --- [ restartedMain] com.okta.developer.gateway.GatewayApp :
----------------------------------------------------------
Config Server: Connected to the JHipster Registry running in Docker
----------------------------------------------------------
2023-02-27T15:22:29.415-07:00 INFO 13013 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient
: Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://admin:admin@jhipster-registry:8761/eureka/}, exception=I/O error on PUT request for "http://admin:admin@jhipster-registry:8761/eureka/apps/GATEWAY/gateway:efbea8dda11e5eca83d671613c2cc33e"
: jhipster-registry stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on PUT request for "http://admin:admin@jhipster-registry:8761/eureka/apps/GATEWAY/gateway:efbea8dda11e5eca83d671613c2cc33e":
I'm using openjdk 17.0.6 2023-01-17
on an M1.
@mraible so you have jhipster-registry host pointing to localhost?
@mshima I'm just trying to make this tutorial work with JHipster 8. When I compared the generated jhipster-registry.yml
from the tutorial's example and the one generated by JHipster 8, I found the fix in https://github.com/jhipster/generator-jhipster/pull/21246 to be the only difference. Changing it from docker
to localhost
solves this issue.
I'm seeing strange behavior when running the following commands:
take reactive-stack
jhipster jdl reactive-ms.jdl
It generates everything pretty quickly, likely because JHipster no longer runs npm install
by default.
...
create gateway/src/main/docker/services.yml
create gateway/src/test/javascript/cypress/e2e/entity/blog.cy.ts
create gateway/src/test/javascript/cypress/e2e/entity/post.cy.ts
create gateway/src/test/javascript/cypress/e2e/entity/tag.cy.ts
create gateway/src/test/javascript/cypress/e2e/entity/product.cy.ts
Execution time: 7 s.
However, there are no files generated in the docker-compose
directory. However, if I run jhipster jdl reactive-ms.jdl
again, it works the 2nd time.
...
identical store/src/test/java/com/okta/developer/store/domain/ProductTest.java
identical store/src/main/docker/grafana/provisioning/dashboards/JVM.json
identical store/src/main/docker/grafana/provisioning/datasources/datasource.yml
No change to package.json was detected. No package manager install will be executed.
✔ Git repository initialized.
✔ Application successfully committed to Git from /Users/mraible/Downloads/reactive-stack/store.
✔ Spring Boot application generated successfully.
Run your Spring Boot application:
./gradlew
INFO! Generator app succeed
INFO! Generating 1 deployment.
INFO! Docker is installed
Found .yo-rc.json config file...
🐳 Welcome to the JHipster Docker Compose Sub-Generator 🐳
Files will be generated in folder: /Users/mraible/Downloads/reactive-stack/docker-compose
Checking Docker images in applications directories...
force docker-compose/.yo-rc.json
create docker-compose/docker-compose.yml
create docker-compose/README-DOCKER-COMPOSE.md
create docker-compose/central-server-config/application.yml
create docker-compose/realm-config/jhipster-realm.json
No change to package.json was detected. No package manager install will be executed.
WARNING! Docker Compose configuration generated, but no Jib cache found
WARNING! If you forgot to generate the Docker image for this application, please run:
To generate the missing Docker image(s), please run:
./gradlew bootJar -Pprod jibDockerBuild in /Users/mraible/Downloads/reactive-stack/gateway
./gradlew bootJar -Pprod jibDockerBuild in /Users/mraible/Downloads/reactive-stack/blog
./gradlew bootJar -Pprod jibDockerBuild in /Users/mraible/Downloads/reactive-stack/store
INFO! You can launch all your infrastructure by running : docker compose up -d
INFO! Generator docker-compose succeed
Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/
Sponsored with ❤️ by @oktadev.
Execution time: 13 s.
FWIW, I see the same behavior when running jhipster jdl reactive-mf.jdl
.
Overview of the issue
I'm trying to re-create a demo I did a couple of years ago to work with JHipster 8 (aka, the
main
branch).If I start all the Docker instances necessary for each app, then run them with Gradle, they're unable to connect to the JHipster Registry.
Motivation for or Use Case
It should be possible to generate a microservices architecture with a JDL that worked with JHipster 7.
Reproduce the error
Install JHipster 8 from its
main
branch:Create a directory called
reactive-stack
and initializegit
.Import the
reactive-ms
architecture definition from the jdl-samples repository and generategateway
,blog
, andstore
apps.Run the following commands to start Keycloak, PostgreSQL, and the JHipster Registry.
Open a new terminal window, start the blog app's Neo4j database, and then the app itself.
Open another terminal window, start the store app's MongoDB database, and the microservice.
Open
http://localhost:8080
in your favorite browser. You will be able to log in withadmin/admin
as credentials, but you won't be able to view any entities.