Skip to content

Commit 2a30b07

Browse files
committed
refactor(GMS): migrate GMS to Spring boot
* GMS: Migrate GMS Spring WebApp -> Spring Boot (embedded jetty 12) * Spring WebMvc endpoints are the default, Rest.li endpoints are secondary * Removed jetty 11 * Refactor kafka consumers startup * GMS with all embedded consumers startup <40s * Neo4j upgraded * Dgraph upgraded
1 parent 262dd76 commit 2a30b07

File tree

73 files changed

+784
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+784
-905
lines changed

build.gradle

+16-7
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ buildscript {
3939
ext.springBootVersion = '3.2.9'
4040
ext.springKafkaVersion = '3.1.6'
4141
ext.openTelemetryVersion = '1.18.0'
42-
ext.neo4jVersion = '5.14.0'
43-
ext.neo4jTestVersion = '5.14.0'
44-
ext.neo4jApocVersion = '5.14.0'
42+
ext.neo4jVersion = '5.20.0'
43+
ext.neo4jTestVersion = '5.20.0'
44+
ext.neo4jApocVersion = '5.20.0'
4545
ext.testContainersVersion = '1.17.4'
4646
ext.elasticsearchVersion = '2.11.1' // ES 7.10, Opensearch 1.x, 2.x
4747
ext.jacksonVersion = '2.15.3'
48-
ext.jettyVersion = '11.0.21'
48+
ext.jettyVersion = '12.0.16'
4949
// see also datahub-frontend/play.gradle
5050
ext.playVersion = '2.8.22'
5151
ext.playScalaVersion = '2.13'
@@ -136,7 +136,8 @@ project.ext.externalDependency = [
136136
'datastaxOssNativeProtocol': 'com.datastax.oss:native-protocol:1.5.1',
137137
'datastaxOssCore': 'com.datastax.oss:java-driver-core:4.14.1',
138138
'datastaxOssQueryBuilder': 'com.datastax.oss:java-driver-query-builder:4.14.1',
139-
'dgraph4j' : 'io.dgraph:dgraph4j:21.12.0',
139+
'dgraph4j' : 'io.dgraph:dgraph4j:24.1.1',
140+
'dgraphNetty': 'io.grpc:grpc-netty-shaded:1.69.0',
140141
'dropwizardMetricsCore': 'io.dropwizard.metrics:metrics-core:4.2.3',
141142
'dropwizardMetricsJmx': 'io.dropwizard.metrics:metrics-jmx:4.2.3',
142143
'ebean': 'io.ebean:ebean:' + ebeanVersion,
@@ -176,8 +177,9 @@ project.ext.externalDependency = [
176177
'jakartaValidation': 'jakarta.validation:jakarta.validation-api:3.1.0-M2',
177178
'jerseyCore': 'org.glassfish.jersey.core:jersey-client:2.41',
178179
'jerseyGuava': 'org.glassfish.jersey.bundles.repackaged:jersey-guava:2.25.1',
179-
'jettyJaas': "org.eclipse.jetty:jetty-jaas:$jettyVersion",
180+
'jettySecurity': "org.eclipse.jetty:jetty-security:$jettyVersion",
180181
'jettyClient': "org.eclipse.jetty:jetty-client:$jettyVersion",
182+
'jettyJmx': "org.eclipse.jetty:jetty-jmx:$jettyVersion",
181183
'jettison': 'org.codehaus.jettison:jettison:1.5.4',
182184
'jgrapht': 'org.jgrapht:jgrapht-core:1.5.1',
183185
'jna': 'net.java.dev.jna:jna:5.12.1',
@@ -380,6 +382,13 @@ configure(subprojects.findAll {! it.name.startsWith('spark-lineage')}) {
380382
resolutionStrategy.force externalDependency.antlr4Runtime
381383
resolutionStrategy.force externalDependency.antlr4
382384
resolutionStrategy.force 'org.apache.mina:mina-core:2.2.4'
385+
resolutionStrategy {
386+
force "org.eclipse.jetty:jetty-security:${jettyVersion}"
387+
force "org.eclipse.jetty:jetty-server:${jettyVersion}"
388+
force "org.eclipse.jetty:jetty-ee10-servlet:${jettyVersion}"
389+
force "org.eclipse.jetty:jetty-ee10-webapp:${jettyVersion}"
390+
force "org.eclipse.jetty:jetty-xml:${jettyVersion}"
391+
}
383392
}
384393
}
385394

@@ -407,7 +416,7 @@ subprojects {
407416
implementation externalDependency.annotationApi
408417
constraints {
409418
implementation("com.google.googlejavaformat:google-java-format:$googleJavaFormatVersion")
410-
implementation('io.netty:netty-all:4.1.115.Final')
419+
implementation('io.netty:netty-all:4.1.116.Final')
411420
implementation('org.apache.commons:commons-compress:1.27.1')
412421
implementation('org.apache.velocity:velocity-engine-core:2.4')
413422
implementation('org.hibernate:hibernate-validator:6.0.20.Final')
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,33 @@
11
package security;
22

33
import com.google.common.base.Preconditions;
4-
import java.util.Collections;
54
import javax.annotation.Nonnull;
65
import javax.naming.AuthenticationException;
7-
import javax.security.auth.callback.Callback;
8-
import javax.security.auth.callback.CallbackHandler;
9-
import javax.security.auth.callback.NameCallback;
10-
import javax.security.auth.callback.PasswordCallback;
11-
import javax.security.auth.login.LoginContext;
12-
import javax.security.auth.login.LoginException;
136
import org.apache.commons.lang3.StringUtils;
14-
import org.eclipse.jetty.jaas.JAASLoginService;
15-
import org.eclipse.jetty.jaas.PropertyUserStoreManager;
16-
import play.Logger;
7+
import org.eclipse.jetty.security.UserPrincipal;
8+
import org.eclipse.jetty.util.security.Credential;
179

1810
public class AuthenticationManager {
19-
20-
private AuthenticationManager(boolean verbose) {}
11+
private AuthenticationManager() {} // Prevent instantiation
2112

2213
public static void authenticateJaasUser(@Nonnull String userName, @Nonnull String password)
2314
throws Exception {
2415
Preconditions.checkArgument(!StringUtils.isAnyEmpty(userName), "Username cannot be empty");
25-
JAASLoginService jaasLoginService = new JAASLoginService("WHZ-Authentication");
26-
PropertyUserStoreManager propertyUserStoreManager = new PropertyUserStoreManager();
27-
propertyUserStoreManager.start();
28-
jaasLoginService.setBeans(Collections.singletonList(propertyUserStoreManager));
29-
JAASLoginService.INSTANCE.set(jaasLoginService);
30-
try {
31-
LoginContext lc =
32-
new LoginContext("WHZ-Authentication", new WHZCallbackHandler(userName, password));
33-
lc.login();
34-
} catch (LoginException le) {
35-
AuthenticationException authenticationException =
36-
new AuthenticationException(le.getMessage());
37-
authenticationException.setRootCause(le);
38-
throw authenticationException;
39-
}
40-
}
4116

42-
private static class WHZCallbackHandler implements CallbackHandler {
43-
private String password;
44-
private String username;
45-
46-
private WHZCallbackHandler(@Nonnull String username, @Nonnull String password) {
47-
this.username = username;
48-
this.password = password;
49-
}
17+
try {
18+
// Create and configure credentials for authentication
19+
UserPrincipal userPrincipal = new UserPrincipal(userName, Credential.getCredential(password));
5020

51-
@Override
52-
public void handle(@Nonnull Callback[] callbacks) {
53-
NameCallback nc = null;
54-
PasswordCallback pc = null;
55-
for (Callback callback : callbacks) {
56-
Logger.debug(
57-
"The submitted callback is of type: " + callback.getClass() + " : " + callback);
58-
if (callback instanceof NameCallback) {
59-
nc = (NameCallback) callback;
60-
nc.setName(this.username);
61-
} else if (callback instanceof PasswordCallback) {
62-
pc = (PasswordCallback) callback;
63-
pc.setPassword(this.password.toCharArray());
64-
}
21+
// Verify credentials
22+
if (!userPrincipal.authenticate(password)) {
23+
throw new AuthenticationException("Invalid credentials for user: " + userName);
6524
}
25+
26+
} catch (Exception e) {
27+
AuthenticationException authenticationException =
28+
new AuthenticationException("Authentication failed");
29+
authenticationException.setRootCause(e);
30+
throw authenticationException;
6631
}
6732
}
6833
}

datahub-frontend/play.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies {
5050
implementation externalDependency.springBeans
5151
implementation externalDependency.springContext
5252
implementation externalDependency.springBootAutoconfigure
53-
implementation externalDependency.jettyJaas
53+
implementation externalDependency.jettySecurity
5454
implementation externalDependency.graphqlJava
5555
implementation externalDependency.antlr4Runtime
5656
implementation externalDependency.antlr4

docker/datahub-gms/Dockerfile

+1-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION
2626
FROM alpine:3.21 AS base
2727

2828
ENV JMX_VERSION=0.18.0
29-
ENV JETTY_VERSION=11.0.21
3029

3130
# Re-declaring args from above to make them available in this stage (will inherit default values)
3231
ARG ALPINE_REPO_URL
@@ -42,9 +41,6 @@ RUN apk --no-cache --update-cache --available upgrade \
4241
&& apk --no-cache add curl bash coreutils gcompat sqlite libc6-compat snappy \
4342
&& apk --no-cache add openjdk17-jre-headless --repository=${ALPINE_REPO_URL}/edge/community \
4443
&& apk --no-cache add jattach --repository ${ALPINE_REPO_URL}/edge/community/ \
45-
&& curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-runner/${JETTY_VERSION}/jetty-runner-${JETTY_VERSION}.jar --output jetty-runner.jar \
46-
&& curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-jmx/${JETTY_VERSION}/jetty-jmx-${JETTY_VERSION}.jar --output jetty-jmx.jar \
47-
&& curl -sS ${MAVEN_CENTRAL_REPO_URL}/org/eclipse/jetty/jetty-util/${JETTY_VERSION}/jetty-util-${JETTY_VERSION}.jar --output jetty-util.jar \
4844
&& wget --no-verbose ${GITHUB_REPO_URL}/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.24.0/opentelemetry-javaagent.jar \
4945
&& wget --no-verbose ${MAVEN_CENTRAL_REPO_URL}/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \
5046
&& cp /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks
@@ -56,8 +52,6 @@ FROM base AS prod-install
5652
COPY war.war /datahub/datahub-gms/bin/war.war
5753
COPY metadata-models/src/main/resources/entity-registry.yml /datahub/datahub-gms/resources/entity-registry.yml
5854
COPY docker/datahub-gms/start.sh /datahub/datahub-gms/scripts/start.sh
59-
COPY docker/datahub-gms/jetty.xml /datahub/datahub-gms/scripts/jetty.xml
60-
COPY docker/datahub-gms/jetty-jmx.xml /datahub/datahub-gms/scripts/jetty-jmx.xml
6155
COPY docker/monitoring/client-prometheus-config.yaml /datahub/datahub-gms/scripts/prometheus-config.yaml
6256
RUN chmod +x /datahub/datahub-gms/scripts/start.sh
6357

@@ -70,7 +64,7 @@ FROM ${APP_ENV}-install AS final
7064
RUN mkdir -p /etc/datahub/plugins/auth/resources
7165

7266
RUN addgroup -S datahub && adduser -S datahub -G datahub
73-
RUN chown -R datahub:datahub /etc/datahub
67+
RUN chown -R datahub:datahub /etc/datahub /datahub
7468
USER datahub
7569

7670
ENV JMX_OPTS=""

docker/datahub-gms/jetty-jmx.xml

-31
This file was deleted.

docker/datahub-gms/jetty.xml

-57
This file was deleted.

docker/datahub-gms/start.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,8 @@ COMMON="
6262
java $JAVA_OPTS $JMX_OPTS \
6363
$OTEL_AGENT \
6464
$PROMETHEUS_AGENT \
65-
-jar /jetty-runner.jar \
66-
--stats unsecure \
67-
--jar jetty-util.jar \
68-
--jar jetty-jmx.jar \
69-
--config /datahub/datahub-gms/scripts/jetty.xml \
70-
--config /datahub/datahub-gms/scripts/jetty-jmx.xml \
71-
/datahub/datahub-gms/bin/war.war"
65+
-Dstats=unsecure \
66+
-jar /datahub/datahub-gms/bin/war.war"
7267

7368
if [[ $SKIP_ELASTICSEARCH_CHECK != true ]]; then
7469
exec dockerize \

docker/docker-compose.dev.yml

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ services:
4949
- KAFKA_CONSUMER_STOP_ON_DESERIALIZATION_ERROR=${KAFKA_CONSUMER_STOP_ON_DESERIALIZATION_ERROR:-true}
5050
volumes:
5151
- ./datahub-gms/start.sh:/datahub/datahub-gms/scripts/start.sh
52-
- ./datahub-gms/jetty.xml:/datahub/datahub-gms/scripts/jetty.xml
53-
- ./datahub-gms/jetty-jmx.xml:/datahub/datahub-gms/scripts/jetty-jmx.xml
5452
- ./monitoring/client-prometheus-config.yaml:/datahub/datahub-gms/scripts/prometheus-config.yaml
5553
- ../metadata-models/src/main/resources/:/datahub/datahub-gms/resources
5654
- ../metadata-service/war/build/libs/:/datahub/datahub-gms/bin

docker/profiles/docker-compose.frontend.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ x-datahub-frontend-service-dev: &datahub-frontend-service-dev
2626
DATAHUB_ANALYTICS_ENABLED: ${DATAHUB_ANALYTICS_ENABLED:-true}
2727
volumes:
2828
- ../../datahub-frontend/build/stage/main:/datahub-frontend
29+
- ./monitoring/client-prometheus-config.yaml:/datahub-frontend/client-prometheus-config.yaml
2930

3031
services:
3132
frontend-quickstart:

docker/profiles/docker-compose.gms.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,13 @@ x-datahub-gms-service-dev: &datahub-gms-service-dev
130130
<<: [*datahub-dev-telemetry-env, *datahub-gms-env]
131131
SKIP_ELASTICSEARCH_CHECK: false
132132
JAVA_TOOL_OPTIONS: '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5001'
133-
BOOTSTRAP_SYSTEM_UPDATE_WAIT_FOR_SYSTEM_UPDATE: false
133+
BOOTSTRAP_SYSTEM_UPDATE_WAIT_FOR_SYSTEM_UPDATE: ${BOOTSTRAP_SYSTEM_UPDATE_WAIT_FOR_SYSTEM_UPDATE:-false}
134134
SEARCH_SERVICE_ENABLE_CACHE: false
135135
LINEAGE_SEARCH_CACHE_ENABLED: false
136136
SHOW_BROWSE_V2: true
137137
ENTITY_VERSIONING_ENABLED: ${ENTITY_VERSIONING_ENABLED:-true}
138138
volumes:
139139
- ./datahub-gms/start.sh:/datahub/datahub-gms/scripts/start.sh
140-
- ./datahub-gms/jetty.xml:/datahub/datahub-gms/scripts/jetty.xml
141-
- ./datahub-gms/jetty-jmx.xml:/datahub/datahub-gms/scripts/jetty-jmx.xml
142140
- ./monitoring/client-prometheus-config.yaml:/datahub/datahub-gms/scripts/prometheus-config.yaml
143141
- ../../metadata-models/src/main/resources/:/datahub/datahub-gms/resources
144142
- ../../metadata-service/war/build/libs/:/datahub/datahub-gms/bin

metadata-ingestion/src/datahub/secret/datahub_secrets_client.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,32 @@ class DataHubSecretsClient:
1111
def __init__(self, graph: DataHubGraph):
1212
self.graph = graph
1313

14-
def _cleanup_secret_name(self, secret_names: List[str]) -> List[str]:
15-
"""Remove empty strings from the list of secret names."""
16-
return [secret_name for secret_name in secret_names if secret_name]
17-
1814
def get_secret_values(self, secret_names: List[str]) -> Dict[str, Optional[str]]:
1915
if len(secret_names) == 0:
2016
return {}
2117

22-
res_data = self.graph.execute_graphql(
23-
query="""query getSecretValues($input: GetSecretValuesInput!) {
24-
getSecretValues(input: $input) {
25-
name
26-
value
27-
}
18+
request_json = {
19+
"query": """query getSecretValues($input: GetSecretValuesInput!) {\n
20+
getSecretValues(input: $input) {\n
21+
name\n
22+
value\n
23+
}\n
2824
}""",
29-
variables={"input": {"secrets": self._cleanup_secret_name(secret_names)}},
25+
"variables": {"input": {"secrets": secret_names}},
26+
}
27+
# TODO: Use graph.execute_graphql() instead.
28+
29+
# Fetch secrets using GraphQL API f
30+
response = self.graph._session.post(
31+
f"{self.graph.config.server}/api/graphql", json=request_json
3032
)
33+
response.raise_for_status()
34+
35+
# Verify response
36+
res_data = response.json()
37+
if "errors" in res_data:
38+
raise Exception("Failed to retrieve secrets from DataHub.")
39+
3140
# Convert list of name, value secret pairs into a dict and return
3241
secret_value_list = res_data["getSecretValues"]
3342
secret_value_dict = dict()

metadata-integration/java/acryl-spark-lineage/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ dependencies {
5757
//implementation "io.acryl:datahub-client:0.10.2"
5858
implementation "io.openlineage:openlineage-spark_2.12:$openLineageVersion"
5959
compileOnly "org.apache.iceberg:iceberg-spark3-runtime:0.12.1"
60-
compileOnly "org.apache.spark:spark-sql_2.12:3.1.3"
60+
compileOnly("org.apache.spark:spark-sql_2.12:3.1.3") {
61+
exclude group: 'org.eclipse.jetty', module: 'jetty-servlet'
62+
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
63+
exclude group: 'org.eclipse.jetty', module: 'jetty-util'
64+
exclude group: 'org.eclipse.jetty', module: 'jetty-webapp'
65+
exclude group: 'org.eclipse.jetty', module: 'jetty-security'
66+
}
6167
compileOnly "io.github.spark-redshift-community:spark-redshift_2.12:6.2.0-spark_3.5"
6268

6369
testCompileOnly externalDependency.lombok

metadata-io/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dependencies {
3737
exclude group: 'com.google.guava', module: 'guava'
3838
exclude group: 'io.grpc', module: 'grpc-protobuf'
3939
}
40+
implementation externalDependency.dgraphNetty
4041
implementation externalDependency.slf4jApi
4142
runtimeOnly externalDependency.logbackClassic
4243
compileOnly externalDependency.lombok

0 commit comments

Comments
 (0)