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 properties to netty-app from jetty-app and update proj status #5505

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions py/client/tests/testbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def tearDownClass(cls) -> None:
os.remove(BaseTestCase.csv_file)

def setUp(self) -> None:
# For netty server and psk, change auth_token to what the server printed.
# self.session = Session(port = 8080, auth_type = 'io.deephaven.authentication.psk.PskAuthenticationHandler', auth_token = 'safw7c4nzegp')
self.session = Session()

def tearDown(self) -> None:
Expand Down
20 changes: 7 additions & 13 deletions server/netty-app/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Native packaging for Deephaven Netty server

This build is not actively maintained or tested, but should still work. As this build uses the grpc-netty server
implementation, it can not be used for serving static web content and does not provide any grpc-web proxies. As
such, it can only be used in an environment where the Deephaven Web IDE will not be used, or where the IDE is
hosted on a different server, with some grpc-web proxy (such as [Envoy](https://www.envoyproxy.io/)) between the
Deephaven server and the browser.

### Build

```shell
Expand Down Expand Up @@ -47,19 +53,7 @@ Finally, Gradle can be used to update the build and run the application in a sin

### Configuration / SSL

By default, the server starts up on all interfaces with plaintext port 8080 (port 443 when SSL is enabled), a token
expiration duration of 5 minutes, a scheduler pool size of 4, and a max inbound message size of 100 MiB.

To bring up a SSL-enabled server on port 8443 with a development key and certificate, you can run:
```shell
./gradlew server-netty-app:run -Pgroovy -PdevCerts
```

SSL configuration can be applied manually with the properties "ssl.identity.type", "ssl.identity.certChainPath",
"ssl.identity.privateKeyPath", "ssl.trust.type", and "ssl.trust.path". Furthermore, outbound Deephaven-to-Deephaven
connections can be explicitly configured separately if desired, with the same properties prefixed with "outbound.".
See the javadocs on `io.deephaven.server.netty.NettyConfig` and `io.deephaven.server.runner.Main.parseSSLConfig` for
more information.
See [the configuration section for the jetty-app](../jetty-app/README.md#configuration) for flags that are supported here.

### SSL examples

Expand Down
61 changes: 61 additions & 0 deletions server/netty-app/build.gradle
Copy link
Member

Choose a reason for hiding this comment

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

So, this file is now exactly the same as server/jetty-app/build.gradle, if you replace "jetty" with "netty".
Is there a way to avoid the copy-paste and just share the content with a parametrized gradle file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not quite exactly - there's a different dependency (netty-app vs jetty-app) and different application plugin configuration (they call different main()s, in netty.NettyMain vs jetty.JettyMain). Could probably factor out much of the rest though to some kind of ServerPlugin if we wanted, or do some subprojects nonsense to force both to use the same properties

Copy link
Member

Choose a reason for hiding this comment

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

Well, yes exactly, if you do a case-preserving search replace. ;-)

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ if (!hasProperty('excludeClockImpl')) {
extraJvmArgs += ['--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED']
}

if (!hasProperty('excludeSql')) {
dependencies {
runtimeOnly project(':engine-sql')
}
}

if (!hasProperty('excludeS3')) {
dependencies {
runtimeOnly project(':extensions-s3')
}
}

def authHandlers = []
def authConfigs = ['AuthHandlers']
if (hasProperty('anonymous')) {
authHandlers += ['io.deephaven.auth.AnonymousAuthenticationHandler']
}

if (hasProperty('devCerts') || hasProperty('devMTLS')) {
extraJvmArgs += [
'-Dhttp.port=8443',
Expand All @@ -58,13 +76,19 @@ if (hasProperty('devCerts') || hasProperty('devMTLS')) {
'-Dssl.trust.path=../dev-certs/ca.crt',
'-Dssl.clientAuthentication=NEEDED',
]
authHandlers += ['io.deephaven.authentication.mtls.MTlsAuthenticationHandler']
dependencies.implementation(dependencies.project(path: ':authentication:example-providers:mtls', configuration:'shadow'))
}
}

if (hasProperty('debug')) {
extraJvmArgs += ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005']
}

if (hasProperty('debugAutocomplete')) {
extraJvmArgs += ['-Ddeephaven.console.autocomplete.quiet=false']
}

if (hasProperty('gcApplication')) {
extraJvmArgs += ['-Dio.deephaven.app.GcApplication.enabled=true']
}
Expand All @@ -73,6 +97,43 @@ if (hasProperty('quiet')) {
extraJvmArgs += ['-Ddeephaven.quiet=true']
}

if (hasProperty('psk')) {
authHandlers += ['io.deephaven.authentication.psk.PskAuthenticationHandler']
if (project.getProperty('psk')) {
// if there is a non-empty value assigned, use that for the key
extraJvmArgs += ["-Dauthentication.psk=${getProperty('psk')}"]
}
}
if (hasProperty('sql-username-password')) {
authHandlers += ['io.deephaven.authentication.sql.BasicSqlAuthenticationHandler']
extraJvmArgs += [
'-Dauthentication.basic.sql.jdbc.connection=jdbc:postgresql://localhost:5432/postgres',
'-Dauthentication.basic.sql.jdbc.user=postgres',
'-Dauthentication.basic.sql.jdbc.password=password',
]
dependencies.implementation(dependencies.project(path: ':authentication:example-providers:sql-username-password', configuration:'shadow'))
}
if (hasProperty('oidc')) {
authHandlers += ['io.deephaven.authentication.oidc.OidcAuthenticationHandler']
extraJvmArgs += [
'-Dauthentication.oidc.keycloak.url=http://localhost:6060',
'-Dauthentication.oidc.keycloak.realm=deephaven_core',
'-Dauthentication.oidc.keycloak.clientId=deephaven',
]
authConfigs += [
'authentication.oidc.keycloak.url',
'authentication.oidc.keycloak.realm',
'authentication.oidc.keycloak.clientId',
]
extraJvmArgs += ['-Dauthentication.client.configuration.list=AuthHandlers,authentication.oidc.keycloak.url,authentication.oidc.keycloak.realm,authentication.oidc.keycloak.clientId']
dependencies.implementation(dependencies.project(path: ':authentication:example-providers:oidc', configuration:'shadow'))
}

if (!authHandlers.isEmpty()) {
extraJvmArgs += ["-DAuthHandlers=${authHandlers.join(',')}"]
}
extraJvmArgs += ["-Dauthentication.client.configuration.list=${authConfigs.join(',')}"]

tasks.withType(JavaExec).configureEach {
// This appends to the existing jvm args, so that java-open-nio still takes effect
jvmArgs extraJvmArgs
Expand Down
Loading