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

Migrate to Quarkus #1520

Merged
merged 50 commits into from
Aug 18, 2024
Merged

Migrate to Quarkus #1520

merged 50 commits into from
Aug 18, 2024

Conversation

Athou
Copy link
Owner

@Athou Athou commented Aug 18, 2024

Replace Dropwizard with Quarkus

#1517

@Athou Athou changed the title Migrate to QUarkus Migrate to Quarkus Aug 18, 2024
@Athou Athou merged commit 8594908 into master Aug 18, 2024
9 checks passed
@Athou Athou deleted the quarkus branch August 18, 2024 05:54
@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

I meet a problem, but I don't know if the cause is this migration, or a PEBKAC :

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------

(snip)

[INFO] Running com.commafeed.backend.HttpGetterTest
Handler org.mockserver.logging.StandardOutConsoleHandler is not defined
Handler org.mockserver.logging.StandardOutConsoleHandler is not defined
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2024-08-18 11:18:36,072 INFO  [io.net.uti.int.NativeLibraryLoader] (MockServer-MockServer-workerEventLoop9) /tmp/libnetty_tcnative_linux_x86_648066554815368152247.so exists but cannot be executed even when execute permissions set; check volume for "noexec" flag; use -Dio.netty.native.workdir=[path] to set native working directory separately.
[ERROR] Tests run: 19, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.11 s <<< FAILURE! -- in com.commafeed.backend.HttpGetterTest
[ERROR] com.commafeed.backend.HttpGetterTest.ignoreInvalidSsl -- Time elapsed: 5.675 s <<< ERROR!
org.apache.hc.client5.http.ConnectTimeoutException: Connect to https://localhost:45819 [localhost/127.0.0.1] failed: Read timed out
	at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:288)
	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:314)
	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:355)
	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:808)
	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
	at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
	at org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.executeHandshake(SSLConnectionSocketFactory.java:345)
	at org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:313)
	at org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:251)
	at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:189)
	at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:450)
	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
	at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
	at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:245)
	at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:188)
	at com.commafeed.backend.HttpGetter.getBinary(HttpGetter.java:100)
	at com.commafeed.backend.HttpGetter.getBinary(HttpGetter.java:74)
	at com.commafeed.backend.HttpGetterTest.ignoreInvalidSsl(HttpGetterTest.java:225)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

(snip)

[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   HttpGetterTest.ignoreInvalidSsl:225 » ConnectTimeout Connect to https://localhost:45819 [localhost/127.0.0.1] failed: Read timed out
[INFO] 
[ERROR] Tests run: 65, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for CommaFeed 5.0.0:
[INFO] 
[INFO] CommaFeed .......................................... SUCCESS [  0.120 s]
[INFO] CommaFeed Client ................................... SUCCESS [05:24 min]
[INFO] CommaFeed Server ................................... FAILURE [01:08 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:35 min
[INFO] Finished at: 2024-08-18T11:18:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.3.1:test (default-test) on project commafeed-server: 
[ERROR] 

Skipping the tests is sufficient to end the build.

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

Not sure, but there is now a SSL handshake timeout on the HTTP client that was not set on previous versions. During tests, it's set to 5s which could be too low if you're building on a slow machine (MockServer is building a SSL certificate dynamically when needed, it takes 1.5s on my machine). Could you try to increase the timeout in line Mockito.when(config.httpClient().sslHandshakeTimeout()).thenReturn(Duration.ofSeconds(5)); of com.commafeed.backend.HttpGetterTest.java to something like 30s?

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

Indeed, my server is a slow machine :

[INFO] Running com.commafeed.backend.HttpGetterTest
Handler org.mockserver.logging.StandardOutConsoleHandler is not defined
Handler org.mockserver.logging.StandardOutConsoleHandler is not defined
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2024-08-18 12:00:57,213 INFO  [io.net.uti.int.NativeLibraryLoader] (MockServer-MockServer-workerEventLoop9) /tmp/libnetty_tcnative_linux_x86_645656822277209167061.so exists but cannot be executed even when execute permissions set; check volume for "noexec" flag; use -Dio.netty.native.workdir=[path] to set native working directory separately.
[INFO] Tests run: 19, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.02 s -- in com.commafeed.backend.HttpGetterTest

The build is OK :

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for CommaFeed 5.0.0:
[INFO] 
[INFO] CommaFeed .......................................... SUCCESS [  0.112 s]
[INFO] CommaFeed Client ................................... SUCCESS [01:58 min]
[INFO] CommaFeed Server ................................... SUCCESS [01:19 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:19 min
[INFO] Finished at: 2024-08-18T12:01:23+02:00
[INFO] ------------------------------------------------------------------------

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

Thanks! b88e5d2

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

Works well now. Thank you.

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

Dumb question, but perhaps useful for other sysadmins : could you be more precise about the application.properties location, and its syntax, please ? I tried several directories, and commafeed always ignores it. So I use an .env file, successfully.
Perhaps you could add an example into the tree ?

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

I guess you tried to configure the JDBC url and it didn't work, because I just tried and it was not working for me either, until I realized I made a mistake in the README e6dd088 I'm sorry 😢

It worked with the .env because both . and - should be _ in env variables.

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

OK, no problem. Let's try. :)
Another question : is there an equivalent to "publicUrl:" (config.yml) for an instance behind a reverse proxy ?

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

It's not needed anymore, the value was only used in contexts where the HTTP request was available so now it's extracted from the request. Your reverse proxy needs to forward the hostname though, I think via the Host header. Caddy does this automatically, you have to configure it manually for nginx and httpd.

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

OK for application.properties. Thank you. The config directory must be in the same place than quarkus-run.jar.

Concerning the reverse proxy trick, nginx does it by defaut. Indeed, all seems to work well... All but the redirection to the login page after disconnection, where there's no URL rewriting.

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

I think you need those two nginx directives for it to work:

proxy_set_header Host $host;
proxy_set_header X_FORWARDED_PROTO https;

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

Oh yes ! I inadvertently deleted the second directive during a config update, it seems. Sorry, that works.

@Athou
Copy link
Owner Author

Athou commented Aug 18, 2024

I just added a link to this in the README https://github.com/Athou/commafeed/blob/master/commafeed-server/doc/commafeed.adoc It's not very sexy yet but it should help.

@canoine
Copy link
Contributor

canoine commented Aug 18, 2024

Nice ! That's much more understandable. Thank you.

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

Successfully merging this pull request may close these issues.

2 participants