From 858ea1e94a3447c70d9eeb096c14332811df0511 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 3 Nov 2021 13:53:04 -0400 Subject: [PATCH] feat(hotreload): create configuration for hot-reload dev server --- README.md | 16 ++++++++++++---- pom.xml | 10 ++++++++++ run-local.sh | 26 ++++++++++++++++---------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9995b59b72..9153c8a58a 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,21 @@ Run Requirements: ### Build project locally * `mvn compile` +### Build and run project locally in development hot-reload mode +* `sh run-local.sh` - this will start the Vert.x backend in hot-reload mode, so +any modifications to files in `src/` will cause a re-compilation and re-deploy. +This is only intended for use during development. The `web-client` assets will +not be built and will not be included in the application classpath. To set up +the `web-client` frontend for hot-reload development, see +[cryostat-web Development Server](https://github.com/cryostatio/cryostat-web/blob/main/README.md#development-server). ### Build and push to local podman image registry * `mvn package` -* Run `mvn -Dcryostat.minimal=true clean package` to exclude web-client assets. The -`clean` phase should always be specified here, or else previously-generated +* Run `mvn -Dcryostat.minimal=true clean package` to exclude web-client assets. +The `clean` phase should always be specified here, or else previously-generated client assets will still be included into the built image. -* For other OCI builders, use the `imageBuilder` Maven property. For example, to use docker run: `mvn -DimageBuilder=$(which docker) clean verify` +* For other OCI builders, use the `imageBuilder` Maven property. For example, to +use docker, run: `mvn -DimageBuilder=$(which docker) clean verify` ## TEST @@ -62,7 +70,7 @@ client assets will still be included into the built image. ### Integration tests and analysis tools * `mvn verify` -### Skipping tests +### Skipping tests * `-DskipUTs=true` to skip unit tests * `-DskipITs=true` to skip integration tests * `-DskipTests=true` to skip all tests diff --git a/pom.xml b/pom.xml index 711460dbc7..a3cfe9aa01 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,7 @@ quay.io/cryostat/jfr-datasource 1.0.0 + 1.0.25 3.8.1 2.22.2 ${org.apache.maven.plugins.surefire.version} @@ -217,6 +218,15 @@ + + io.reactiverse + vertx-maven-plugin + ${io.reactiverse.plugin.version} + + true + io.cryostat.Cryostat + + org.apache.maven.plugins maven-compiler-plugin diff --git a/run-local.sh b/run-local.sh index c73366a6b9..04a8079d17 100755 --- a/run-local.sh +++ b/run-local.sh @@ -1,18 +1,23 @@ #!/bin/sh +script_dir="$(dirname $(realpath $0))" + if [ -z $MVN ]; then MVN=$(which mvn) fi -if [ ! -f target/classes/io/cryostat/Cryostat.class ]; then - echo "Ensure you have done 'mvn prepare-package' before running this script" - exit 1 -fi - -script_dir="$(dirname $(realpath $0))" +for i in archive clientlib conf templates; do + if [ -e $i ]; then + if [ ! -d $i ]; then + echo "$i already exists but is not a directory" + exit 1 + fi + else + mkdir $i + fi +done flags=( - "-Dvertxweb.environment=dev" "-Dcom.sun.management.jmxremote.autodiscovery=true" "-Dcom.sun.management.jmxremote.port=9091" "-Dcom.sun.management.jmxremote.rmi.port=9091" @@ -25,11 +30,12 @@ MAVEN_OPTS="${flags[@]}" \ CRYOSTAT_PLATFORM=io.cryostat.platform.internal.DefaultPlatformStrategy \ CRYOSTAT_DISABLE_SSL=true \ CRYOSTAT_DISABLE_JMX_AUTH=true \ - CRYOSTAT_WEB_HOST=$(hostname) \ - CRYOSTAT_WEB_PORT=8080 \ + CRYOSTAT_WEB_HOST=localhost \ + CRYOSTAT_WEB_PORT=8181 \ + CRYOSTAT_CORS_ORIGIN=http://localhost:9000 \ CRYOSTAT_AUTH_MANAGER=io.cryostat.net.NoopAuthManager \ CRYOSTAT_ARCHIVE_PATH="$script_dir/archive" \ CRYOSTAT_CLIENTLIB_PATH="$script_dir/clientlib" \ CRYOSTAT_CONFIG_PATH="$script_dir/conf" \ CRYOSTAT_TEMPLATE_PATH="$script_dir/templates" \ - $MVN exec:java + $MVN vertx:run