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

feat: Upgrade JHipster, Quarkus dependencies, fix broken flows #247

Merged
merged 24 commits into from
Oct 20, 2022

Conversation

vishal423
Copy link
Collaborator

@vishal423 vishal423 commented Oct 2, 2022

Closes #245
Closes #213
Closes #228
Closes #222

@vishal423 vishal423 marked this pull request as ready for review October 2, 2022 12:56
@vishal423
Copy link
Collaborator Author

@mraible, there seems an issue with embedded mongodb dependency and driver version. This is independent of current upgrade and can be tracked separately ( I believe there exists a ticket for mongodb migration).

@vishal423
Copy link
Collaborator Author

@mraible, did you get a chance to review the changes? I don't have commit access to this repository to assign reviewers.

I am amidst another change to bump quarkus ecosystem dependencies and noticed a few more broken flows. I will raise separate PRs to fix those.

@avdev4j
Copy link
Contributor

avdev4j commented Oct 5, 2022

@vishal423 it seems the way GitHub allows us to manage groups is a bit complicated: as administrator I can create a team but I can't add people to existing ones if I'm not the maintainer of this team...

That doesn't make sense... So I've added you directly with the writing access. Let's see after how to fix that.

@mraible
Copy link
Contributor

mraible commented Oct 5, 2022

@vishal423 I'm traveling and attending conferences this week. I'll take a look when I'm back home next week.

@vishal423
Copy link
Collaborator Author

thanks @avdev4j for granting write access

@mraible, please take your time, no rush

@vishal423 vishal423 requested a review from mraible October 6, 2022 04:32
@@ -13,5 +13,4 @@ insert_final_newline = true
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that indents are now tabs, or indents are spaces by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was redundant as we define to use spaces for all type of files:

[*]
indent_style = space

@mraible
Copy link
Contributor

mraible commented Oct 12, 2022

I tried this branch today with @danielpetisme's tutorial from the Okta developer blog.

The initial console output is a bit lengthy, especially since there are two logos displayed. Also, there are a lot of "Using blueprint" messages.

Screen Shot 2022-10-12 at 13 00 36

At the end of the application creating part, there's a printout of commands:

> jhipster@0.0.1-SNAPSHOT clean-www
> rimraf target/classes/META-INF/resourcesapp/{src,target/}

It looks like there should be a space between resources and app, but not sure. Also, it seems weird that files are removed just after installation.

I was using Java 17 and received an error:

[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-versions) @ jhipster ---
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
You are running an incompatible version of Java. JHipster Quarkus supports JDK
                                    8 to
                                    13.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Reverting to Java 11 fixes this. However, I think we should support Java 17 since the main generator does.

Finally, after starting Keycloak and running ./mvnw, I get an error:

2022-10-12 13:05:38,606 WARN  [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-41) Unable to start devservices for default datasource as this datasource type (h2) does not support devservices
2022-10-12 13:05:38,680 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.agroal.deployment.AgroalProcessor#build threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Unable to find a JDBC driver corresponding to the database kind 'h2' for the default datasource. Either provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding 'quarkus.datasource.jdbc=false' to your configuration if you don't need it.
	at io.quarkus.agroal.deployment.AgroalProcessor.resolveDriver(AgroalProcessor.java:332)
	at io.quarkus.agroal.deployment.AgroalProcessor.getAggregatedConfigBuildItems(AgroalProcessor.java:278)
	at io.quarkus.agroal.deployment.AgroalProcessor.build(AgroalProcessor.java:83)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:415)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:275)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:91)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:424)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:64)
	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:133)
	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:90)
	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.agroal.deployment.AgroalProcessor#build threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Unable to find a JDBC driver corresponding to the database kind 'h2' for the default datasource. Either provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding 'quarkus.datasource.jdbc=false' to your configuration if you don't need it.
	at io.quarkus.agroal.deployment.AgroalProcessor.resolveDriver(AgroalProcessor.java:332)
	at io.quarkus.agroal.deployment.AgroalProcessor.getAggregatedConfigBuildItems(AgroalProcessor.java:278)
	at io.quarkus.agroal.deployment.AgroalProcessor.build(AgroalProcessor.java:83)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

	at io.quarkus.builder.Execution.run(Execution.java:116)
	at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:151)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:413)
	... 9 more
Caused by: io.quarkus.runtime.configuration.ConfigurationException: Unable to find a JDBC driver corresponding to the database kind 'h2' for the default datasource. Either provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding 'quarkus.datasource.jdbc=false' to your configuration if you don't need it.
	at io.quarkus.agroal.deployment.AgroalProcessor.resolveDriver(AgroalProcessor.java:332)
	at io.quarkus.agroal.deployment.AgroalProcessor.getAggregatedConfigBuildItems(AgroalProcessor.java:278)
	at io.quarkus.agroal.deployment.AgroalProcessor.build(AgroalProcessor.java:83)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Below is my .yo-rc.json:

{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "jhipster",
    "blueprints": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "2.0.0-beta.1"
      }
    ],
    "buildTool": "maven",
    "cacheProvider": "caffeine",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1665600995874,
    "cypressAudit": true,
    "cypressCoverage": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableTranslation": true,
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.3",
    "languages": ["en", "nl"],
    "nativeLanguage": "en",
    "otherModules": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "2.0.0-beta.1"
      }
    ],
    "packageName": "com.company.myapp",
    "pages": [],
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serviceDiscoveryType": false,
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipFakeData": false,
    "skipUserManagement": true,
    "testFrameworks": ["cypress"],
    "websocket": false,
    "withAdminUi": true
  }
}

@avdev4j
Copy link
Contributor

avdev4j commented Oct 12, 2022

Hi @mraible
Quickly, the console print are coming the blueprint itself, so I think we can edit it and remove the console print from each index.js files.
Then, the Java version is fixed in the pom.xml file, so it has been decided in time where we did not choose to use Java 17 in the main generator. Before doing that we might have to check if it works with quarkus libraries (no ideas, even if I think it should be).

@vishal423
Copy link
Collaborator Author

The initial console output is a bit lengthy, especially since there are two logos displayed. Also, there are a lot of "Using blueprint" messages.

The first logo is coming from the JHipster generator itself and I don't see an option to customize/hide that. If you refer to any other blueprint using the latest published JHipster version, it should be the same behavior. The Using blueprint logs / warnings are also from the JHipster and can't do much over here.

It looks like there should be a space between resources and app, but not sure. Also, it seems weird that files are removed just after installation.

It also doesn't look correct to me. Either space or slash should come. I will take a look into that. However, files removal is the JHipster generator behavior and isn't controlled over here 😞

Reverting to Java 11 fixes this. However, I think we should support Java 17 since the main generator does.

This PR doesn't touch on the Quarkus lib upgrade. I have a separate unpublished branch that contains the fix to support Java 17, and Quarkus lib upgrades for Maven, however, the OIDC flow seems to be broken. I didn't spend much time debugging the issue, however, that seems to come due to quarkus integration with the problem library. Unfortunately, I am a bit occupied and wouldn't get much time before mid-November. If you want to combine those changes, I can push them over here.

@mraible
Copy link
Contributor

mraible commented Oct 13, 2022

This PR doesn't touch on the Quarkus lib upgrade.

OK. I'll take a look and see if I can figure out the problem with MongoDB.

I have a separate unpublished branch that contains the fix to support Java 17, and Quarkus lib upgrades for Maven, however, the OIDC flow seems to be broken. I didn't spend much time debugging the issue, however, that seems to come due to quarkus integration with the problem library. Unfortunately, I am a bit occupied and wouldn't get much time before mid-November. If you want to combine those changes, I can push them over here.

Yes, please push your changes into another PR. If it's easier, you can merge this one first.

@vishal423
Copy link
Collaborator Author

I will push those lib changes over here, so that you can take a consolidated view of change. I haven't looked into mongo db flow and the dependencies upgrade.

Additionally, I have replaced the in-memory Redis with devservices support (uses TestContainer), so, docker is going to be a requirement.

@mraible
Copy link
Contributor

mraible commented Oct 13, 2022

I created vishal423#1. It seems to fix MongoDB, but still has issues.

@vishal423
Copy link
Collaborator Author

I have merged the MongoDB fixes, however, my previous library upgrade seems to have broke tests. I will spend some time to see what caused that behavior.

@vishal423
Copy link
Collaborator Author

We are now good on tests front except MongoDB

@mraible
Copy link
Contributor

mraible commented Oct 13, 2022

@vishal423 I was able to fix the MongoDB compilation error. However, tests still fail so it seems whatever authentication mechanism the tests use is not working.

@mraible
Copy link
Contributor

mraible commented Oct 14, 2022

@vishal423 I'm OK with this.

@vishal423
Copy link
Collaborator Author

@mraible, this PR is now ready to be reviewed. During testing, I noticed a few broken scenarios and raised a couple of issues, however much more can be identified if regressed further. I will raise couple more issues that I noticed recently.

@mraible
Copy link
Contributor

mraible commented Oct 18, 2022 via email

@vishal423 vishal423 changed the title feat: Upgrade JHipster dependencies to 7.9.3 feat: Upgrade JHipster, Quarkus dependencies, fix broken flows Oct 18, 2022
@mraible
Copy link
Contributor

mraible commented Oct 19, 2022

@vishal423 I tried again with the .yo-rc.json in #247 (comment). Everything launches OK with ./mvnw:

2022-10-19 11:19:37,061 WARN  [io.qua.hib.orm.dep.HibernateOrmProcessor] (build-24) Hibernate ORM is disabled because no JPA entities were found
2022-10-19 11:19:37,071 WARN  [io.net.res.dns.DnsServerAddressStreamProviders] (build-89) Can not find io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the classpath, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
2022-10-19 11:19:37,111 INFO  [io.qua.oid.dep.dev.OidcDevConsoleProcessor] (build-89) OIDC Dev Console: discovering the provider metadata at http://localhost:9080/realms/jhipster/.well-known/openid-configuration

        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

:: JHipster 🤓  :: https://www.jhipster.tech ::

                                                 Powered by Quarkus 2.13.0.Final
2022-10-19 11:19:38,181 INFO  [io.agr.pool] (Quarkus Main Thread) Datasource '<default>': Initial size smaller than min. Connections will be created when necessary

2022-10-19 11:19:38,318 INFO  [liq.database] (Quarkus Main Thread) Set default schema name to PUBLIC
2022-10-19 11:19:38,454 INFO  [liq.changelog] (Quarkus Main Thread) Reading from PUBLIC.DATABASECHANGELOG
2022-10-19 11:19:38,482 INFO  [liq.lockservice] (Quarkus Main Thread) Successfully acquired change log lock
2022-10-19 11:19:38,510 INFO  [liq.lockservice] (Quarkus Main Thread) Successfully released change log lock
2022-10-19 11:19:38,571 INFO  [io.quarkus] (Quarkus Main Thread) jhipster 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.13.0.Final) started in 1.998s. Listening on: http://localhost:8080
2022-10-19 11:19:38,572 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-10-19 11:19:38,572 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cache, cdi, hibernate-orm, hibernate-orm-panache, hibernate-validator, jdbc-h2, liquibase, mailer, micrometer, narayana-jta, oidc, qute, resteasy, resteasy-jsonb, resteasy-problem, security, servlet, smallrye-context-propagation, smallrye-health, smallrye-openapi, swagger-ui, vertx]

If I go to http://localhost:8080 and click sign in, I get a 401 in my browser.

{
  "status": 401,
  "title": "Unauthorized",
  "instance": "/oauth2/authorization/oidc"
}

@vishal423
Copy link
Collaborator Author

#248 is to track this issue. One workaround is to remove the problem library and associated code references (that I used to test OIDC flow).

@sonarcloud
Copy link

sonarcloud bot commented Oct 20, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vishal423
Copy link
Collaborator Author

I will merge by tomorrow. @mraible, I assume you got chance to verify all issues closed as part of it.

@mraible mraible merged commit 61a7949 into jhipster:main Oct 20, 2022
@vishal423 vishal423 deleted the upgrade-dependencies branch October 21, 2022 02:35
@vishal423
Copy link
Collaborator Author

@DanielFran
Copy link
Member

@vishal423 approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants