From 50575a2c03c20c1d4ec3c725ca7910be0789896d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Cio=C5=82ecki?= Date: Fri, 29 Mar 2024 08:48:49 +0100 Subject: [PATCH] Improvements: Allow Designer to run locally with remote debugging & normalize NUSSKNACKER_SCALA_VERSION env param name (#5724) --- .github/workflows/pr.yml | 6 +++--- .run/NussknackerRemoteDebug.run.xml | 16 ++++++++++++++++ CONTRIBUTING.md | 2 ++ ciRunSbt.sh | 6 +++--- designer/runServer.sh | 6 ++++-- docs/MigrationGuide.md | 5 ++++- nussknacker-dist/src/universal/bin/run.sh | 11 ++++++++--- 7 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 .run/NussknackerRemoteDebug.run.xml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a1806af6aab..a301818876e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -171,7 +171,7 @@ jobs: matrix: scalaVersion: ${{fromJson(needs.setup.outputs.scala_version_matrix)}} env: - SCALA_VERSION: ${{ matrix.scalaVersion }} + NUSSKNACKER_SCALA_VERSION: ${{ matrix.scalaVersion }} TESTS_WITH_COVERAGE: ${{ github.ref == 'refs/heads/staging' && matrix.scalaVersion == '2.13' }} if: ${{ needs.setup.outputs.fe_changes_count != needs.setup.outputs.all_changes_count || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/demo' || startsWith(github.ref, 'refs/heads/preview') || startsWith(github.ref, 'refs/heads/release') }} steps: @@ -260,7 +260,7 @@ jobs: matrix: scalaVersion: ${{fromJson(needs.setup.outputs.scala_version_matrix)}} env: - SCALA_VERSION: ${{ matrix.scalaVersion }} + NUSSKNACKER_SCALA_VERSION: ${{ matrix.scalaVersion }} if: ${{ needs.setup.outputs.fe_changes_count != needs.setup.outputs.all_changes_count || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/demo' || startsWith(github.ref, 'refs/heads/preview') || startsWith(github.ref, 'refs/heads/release') }} runs-on: ubuntu-latest steps: @@ -308,7 +308,7 @@ jobs: matrix: scalaVersion: ${{fromJson(needs.setup.outputs.scala_version_matrix)}} env: - SCALA_VERSION: ${{ matrix.scalaVersion }} + NUSSKNACKER_SCALA_VERSION: ${{ matrix.scalaVersion }} if: ${{ needs.setup.outputs.fe_changes_count != needs.setup.outputs.all_changes_count || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/demo' || startsWith(github.ref, 'refs/heads/preview') || startsWith(github.ref, 'refs/heads/release') }} steps: - name: Cancel previous runs diff --git a/.run/NussknackerRemoteDebug.run.xml b/.run/NussknackerRemoteDebug.run.xml new file mode 100644 index 00000000000..ea46b4eabdc --- /dev/null +++ b/.run/NussknackerRemoteDebug.run.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 646e8a48d4a..3a12d2fe4d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,6 +126,8 @@ Building: Run `./runServer.sh` in `designer`Documentation +Changing the version of the Scala is done by setting `NUSSKNACKER_SCALA_VERSION`, e.g. `NUSSKNACKER_SCALA_VERSION=2.12 ./buildServer.sh` + #### Running using integration environment - Clone [nussknacker-quickstart](https://github.com/TouK/nussknacker-quickstart) diff --git a/ciRunSbt.sh b/ciRunSbt.sh index 75df5202a1c..85d7dd01d86 100755 --- a/ciRunSbt.sh +++ b/ciRunSbt.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -e -# When $SCALA_VERSION is not present, we check for $CROSS_BUILD. If it's true - we do cross build, otherwise we use default scala version -if [[ -n "$SCALA_VERSION" ]]; then - ARGS="++$SCALA_VERSION $*" +# When $NUSSKNACKER_SCALA_VERSION is not present, we check for $CROSS_BUILD. If it's true - we do cross build, otherwise we use default scala version +if [[ -n "$NUSSKNACKER_SCALA_VERSION" ]]; then + ARGS="++$NUSSKNACKER_SCALA_VERSION $*" elif [[ $CROSS_BUILD == 'true' ]]; then #for crossbuild we prepend each arg with +... ARGS=`echo " $*" | sed "s/ \+/ \+/g"` diff --git a/designer/runServer.sh b/designer/runServer.sh index 5b46b8d2053..3b0df9f8c1d 100755 --- a/designer/runServer.sh +++ b/designer/runServer.sh @@ -7,11 +7,11 @@ export NUSSKNACKER_DIR=$WORKING_DIR mkdir -p "$WORKING_DIR" cd $WORKING_DIR -SCALA_VERSION=${SCALA_VERSION:-2.13} +NUSSKNACKER_SCALA_VERSION=${NUSSKNACKER_SCALA_VERSION:-2.13} PROJECT_BASE_DIR="../../.." DIST_BASE_DIR="$PROJECT_BASE_DIR/nussknacker-dist/src/universal" -export LIB_DIR="${PROJECT_BASE_DIR}/designer/server/target/scala-$SCALA_VERSION" +export LIB_DIR="${PROJECT_BASE_DIR}/designer/server/target/scala-$NUSSKNACKER_SCALA_VERSION" export CONF_DIR="${DIST_BASE_DIR}/conf" export CONFIG_FILE="$DIST_BASE_DIR/conf/dev-application.conf" export NUSSKNACKER_LOG_LEVEL=DEBUG @@ -39,4 +39,6 @@ else echo "Using local environment" fi +export JAVA_DEBUG_PORT=5005 + $DIST_BASE_DIR/bin/run.sh diff --git a/docs/MigrationGuide.md b/docs/MigrationGuide.md index 1ba88c46596..fc341aea2d5 100644 --- a/docs/MigrationGuide.md +++ b/docs/MigrationGuide.md @@ -43,7 +43,10 @@ To see the biggest differences please consult the [changelog](Changelog.md). ### Other changes -* [#5574](https://github.com/TouK/nussknacker/pull/5574) Removed the support for the plugable expression languages: `ExpressionConfig.languages` removed +* [#5574](https://github.com/TouK/nussknacker/pull/5574) Removed the support for the pluggable expression languages: `ExpressionConfig.languages` removed +* [#5724](https://github.com/TouK/nussknacker/pull/5724) Improvements: Run Designer locally + * Introduce `JAVA_DEBUG_PORT` to run the Designer locally with remote debugging capability + * Removed `SCALA_VERSION`, please use `NUSSKNACKER_SCALA_VERSION` instead of it ## In version 1.14.0 diff --git a/nussknacker-dist/src/universal/bin/run.sh b/nussknacker-dist/src/universal/bin/run.sh index a500c8fef16..6eec027f5c6 100755 --- a/nussknacker-dist/src/universal/bin/run.sh +++ b/nussknacker-dist/src/universal/bin/run.sh @@ -30,6 +30,12 @@ export SCHEMA_REGISTRY_URL=${SCHEMA_REGISTRY_URL:-http://localhost:8082} export GRAFANA_URL=${GRAFANA_URL:-http://localhost:3000} export INFLUXDB_URL=${INFLUXDB_URL:-http://localhost:8086} +if [ "$JAVA_DEBUG_PORT" == "" ]; then + JAVA_DEBUG_OPTS="" +else + JAVA_DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:$JAVA_DEBUG_PORT" +fi + if [ "$PROMETHEUS_METRICS_PORT" == "" ]; then JAVA_PROMETHEUS_OPTS="" else @@ -47,13 +53,12 @@ export USAGE_REPORTS_SOURCE="binaries" mkdir -p $LOGS_DIR cd $WORKING_DIR - if [[ "${RUN_IN_BACKGROUND}" == "true" ]]; then echo -e "JVM: `java -version`\n" >> $LOG_FILE 2>&1 echo "Starting Nussknacker in background" export CONSOLE_THRESHOLD_LEVEL=OFF set -x - exec java $JDK_JAVA_OPTIONS $JAVA_PROMETHEUS_OPTS -Dconfig.override_with_env_vars=true -Dlogback.configurationFile=$LOGBACK_FILE -Dnussknacker.config.locations=$CONFIG_FILE -cp "$CLASSPATH" pl.touk.nussknacker.ui.NussknackerApp >> $LOG_FILE 2>&1 & + exec java $JDK_JAVA_OPTIONS $JAVA_DEBUG_OPTS $JAVA_PROMETHEUS_OPTS -Dconfig.override_with_env_vars=true -Dlogback.configurationFile=$LOGBACK_FILE -Dnussknacker.config.locations=$CONFIG_FILE -cp "$CLASSPATH" pl.touk.nussknacker.ui.NussknackerApp >> $LOG_FILE 2>&1 & set +x echo $! > $PID_FILE echo "Nussknacker up and running" @@ -61,6 +66,6 @@ else echo -e "JVM: `java -version`\n" echo "Starting Nussknacker" set -x - exec java $JDK_JAVA_OPTIONS $JAVA_PROMETHEUS_OPTS -Dconfig.override_with_env_vars=true -Dlogback.configurationFile=$LOGBACK_FILE -Dnussknacker.config.locations=$CONFIG_FILE -cp "$CLASSPATH" pl.touk.nussknacker.ui.NussknackerApp + exec java $JDK_JAVA_OPTIONS $JAVA_DEBUG_OPTS $JAVA_PROMETHEUS_OPTS -Dconfig.override_with_env_vars=true -Dlogback.configurationFile=$LOGBACK_FILE -Dnussknacker.config.locations=$CONFIG_FILE -cp "$CLASSPATH" pl.touk.nussknacker.ui.NussknackerApp set +x fi