Skip to content

Commit

Permalink
Improvements: Allow Designer to run locally with remote debugging & n…
Browse files Browse the repository at this point in the history
…ormalize NUSSKNACKER_SCALA_VERSION env param name (#5724)
  • Loading branch information
lciolecki committed Mar 29, 2024
1 parent 4800d99 commit 50575a2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions .run/NussknackerRemoteDebug.run.xml
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration name="NussknackerRemoteDebug" type="Remote">
<module name="nussknacker-designer" />
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<option name="AUTO_RESTART" value="false" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="5005" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method v="2" />
</configuration>
</component>
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions 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"`
Expand Down
6 changes: 4 additions & 2 deletions designer/runServer.sh
Expand Up @@ -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
Expand Down Expand Up @@ -39,4 +39,6 @@ else
echo "Using local environment"
fi

export JAVA_DEBUG_PORT=5005

$DIST_BASE_DIR/bin/run.sh
5 changes: 4 additions & 1 deletion docs/MigrationGuide.md
Expand Up @@ -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

Expand Down
11 changes: 8 additions & 3 deletions nussknacker-dist/src/universal/bin/run.sh
Expand Up @@ -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
Expand All @@ -47,20 +53,19 @@ 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"
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

0 comments on commit 50575a2

Please sign in to comment.