diff --git a/docker/datahub-frontend/Dockerfile b/docker/datahub-frontend/Dockerfile index a70e64bd70b628..ac86dfeeaf256c 100644 --- a/docker/datahub-frontend/Dockerfile +++ b/docker/datahub-frontend/Dockerfile @@ -18,7 +18,23 @@ RUN apk --no-cache --update-cache --available upgrade \ ARG USE_SYSTEM_NODE="true" ENV CI=true ENV GRADLE_OPTS="-Xms256m -Xmx512m" -COPY . datahub-src + +# copy only what's realy needed for the build +# to get the benefits of caching as much as possible +COPY ./datahub-frontend ./datahub-src/datahub-frontend +COPY ./entity-registry ./datahub-src/entity-registry +COPY ./buildSrc ./datahub-src/buildSrc +COPY ./datahub-web-react ./datahub-src/datahub-web-react +COPY ./li-utils ./datahub-src/li-utils +COPY ./metadata-models ./datahub-src/metadata-models +COPY ./metadata-models-validator ./datahub-src/metadata-models-validator +COPY ./metadata-utils ./datahub-src/metadata-utils +COPY ./metadata-service ./datahub-src/metadata-service +COPY ./metadata-io ./datahub-src/metadata-io +COPY ./datahub-graphql-core ./datahub-src/datahub-graphql-core +COPY ./gradle ./datahub-src/gradle +COPY repositories.gradle gradle.properties gradlew settings.gradle build.gradle ./datahub-src/ + RUN cd datahub-src \ && ./gradlew :datahub-web-react:build -x test -x yarnTest -x yarnLint \ && ./gradlew :datahub-frontend:dist -PuseSystemNode=${USE_SYSTEM_NODE} -x test -x yarnTest -x yarnLint \ @@ -27,6 +43,9 @@ RUN cd datahub-src \ FROM base as prod-install COPY --from=prod-build /datahub-frontend /datahub-frontend/ +COPY ./docker/monitoring/client-prometheus-config.yaml /datahub-frontend/ +RUN wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.4.1/opentelemetry-javaagent-all.jar -O opentelemetry-javaagent-all.jar \ + && wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.16.1/jmx_prometheus_javaagent-0.16.1.jar -O jmx_prometheus_javaagent.jar RUN chown -R datahub:datahub /datahub-frontend && chmod 755 /datahub-frontend FROM base as dev-install @@ -43,14 +62,5 @@ RUN echo $SERVER_PORT EXPOSE $SERVER_PORT HEALTHCHECK --start-period=2m --retries=4 CMD curl --fail http://localhost:$SERVER_PORT/admin || exit 1 - -ENV JAVA_OPTS=" \ - -Xms512m \ - -Xmx1024m \ - -Dhttp.port=$SERVER_PORT \ - -Dconfig.file=datahub-frontend/conf/application.conf \ - -Djava.security.auth.login.config=datahub-frontend/conf/jaas.conf \ - -Dlogback.configurationFile=datahub-frontend/conf/logback.xml \ - -Dlogback.debug=false \ - -Dpidfile.path=/dev/null" -CMD ["datahub-frontend/bin/datahub-frontend"] +COPY ./docker/datahub-frontend/start.sh / +CMD ./start.sh \ No newline at end of file diff --git a/docker/datahub-frontend/start.sh b/docker/datahub-frontend/start.sh new file mode 100755 index 00000000000000..73d2d1fbf2b7fe --- /dev/null +++ b/docker/datahub-frontend/start.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -u + +PROMETHEUS_AGENT="" +if [[ ${ENABLE_PROMETHEUS:-false} == true ]]; then + PROMETHEUS_AGENT="-javaagent:jmx_prometheus_javaagent.jar=4318:/datahub-frontend/client-prometheus-config.yaml" +fi + +OTEL_AGENT="" +if [[ ${ENABLE_OTEL:-false} == true ]]; then + OTEL_AGENT="-javaagent:/opentelemetry-javaagent-all.jar" +fi + +# make sure there is no whitespace at the beginning and the end of +# this string +export JAVA_OPTS="-Xms512m \ + -Xmx1024m \ + -Dhttp.port=$SERVER_PORT \ + -Dconfig.file=datahub-frontend/conf/application.conf \ + -Djava.security.auth.login.config=datahub-frontend/conf/jaas.conf \ + -Dlogback.configurationFile=datahub-frontend/conf/logback.xml \ + -Dlogback.debug=false \ + ${PROMETHEUS_AGENT:-} ${OTEL_AGENT:-} + -Dpidfile.path=/dev/null" + +exec ./datahub-frontend/bin/datahub-frontend + diff --git a/docker/monitoring/docker-compose.monitoring.yml b/docker/monitoring/docker-compose.monitoring.yml index 73cc3ec39a2593..1fdf8a854808a7 100644 --- a/docker/monitoring/docker-compose.monitoring.yml +++ b/docker/monitoring/docker-compose.monitoring.yml @@ -12,6 +12,17 @@ services: ports: - "4318" + datahub-frontend-react: + environment: + - ENABLE_PROMETHEUS=true + - ENABLE_OTEL=true + - OTEL_TRACES_EXPORTER=jaeger + - OTEL_EXPORTER_JAEGER_ENDPOINT=http://jaeger-all-in-one:14250 + - OTEL_METRICS_EXPORTER=none + - OTEL_SERVICE_NAME=datahub-gms + ports: + - "4318" + # Jaeger jaeger-all-in-one: image: jaegertracing/all-in-one:latest diff --git a/docker/monitoring/prometheus.yaml b/docker/monitoring/prometheus.yaml index c28a38fef1e7fe..7efe6059ea62aa 100644 --- a/docker/monitoring/prometheus.yaml +++ b/docker/monitoring/prometheus.yaml @@ -6,4 +6,5 @@ scrape_configs: - 'host.docker.internal:4318' - 'datahub-gms:4318' - 'datahub-mae-consumer:4318' - - 'datahub-mce-consumer:4318' \ No newline at end of file + - 'datahub-mce-consumer:4318' + - 'datahub-frontend-react:4318' \ No newline at end of file diff --git a/docker/quickstart.sh b/docker/quickstart.sh index 6bb42da6fb71e1..f7f14d8af9c226 100755 --- a/docker/quickstart.sh +++ b/docker/quickstart.sh @@ -24,6 +24,11 @@ TAG_VERSION=$(cd $DIR && git name-rev --name-only --tags HEAD) DEFAULT_VERSION=$(echo $TAG_VERSION | sed 's/undefined/head/') export DATAHUB_VERSION=${DATAHUB_VERSION:-${DEFAULT_VERSION}} +M1_COMPOSE="" +if [[ $(uname -m) == 'arm64' && $(uname) == 'Darwin' ]]; then + M1_COMPOSE="-f docker-compose.m1.yml" +fi + echo "Quickstarting DataHub: version ${DATAHUB_VERSION}" if docker volume ls | grep -c -q datahub_neo4jdata then @@ -32,10 +37,7 @@ then else echo "No Datahub Neo4j volume found, starting with elasticsearch as graph service" cd $DIR && \ - docker-compose \ - -f quickstart/docker-compose-without-neo4j.quickstart.yml \ - $MONITORING_COMPOSE $CONSUMERS_COMPOSE pull && \ docker-compose -p datahub \ -f quickstart/docker-compose-without-neo4j.quickstart.yml \ - $MONITORING_COMPOSE $CONSUMERS_COMPOSE up $@ + $MONITORING_COMPOSE $CONSUMERS_COMPOSE $M1_COMPOSE up $@ fi diff --git a/docker/quickstart/docker-compose.monitoring.quickstart.yml b/docker/quickstart/docker-compose.monitoring.quickstart.yml index 0c9e822e2dfb31..aad409d5bf1e6c 100644 --- a/docker/quickstart/docker-compose.monitoring.quickstart.yml +++ b/docker/quickstart/docker-compose.monitoring.quickstart.yml @@ -1,4 +1,14 @@ services: + datahub-frontend-react: + environment: + - ENABLE_PROMETHEUS=true + - ENABLE_OTEL=true + - OTEL_TRACES_EXPORTER=jaeger + - OTEL_EXPORTER_JAEGER_ENDPOINT=http://jaeger-all-in-one:14250 + - OTEL_METRICS_EXPORTER=none + - OTEL_SERVICE_NAME=datahub-gms + ports: + - '4318' datahub-gms: environment: - ENABLE_PROMETHEUS=true