Skip to content

Commit

Permalink
feat(hotreload): create configuration for hot-reload dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 3, 2021
1 parent 8d46e45 commit 4f84100
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<cryostat.itest.jfr-datasource.imageStream>quay.io/cryostat/jfr-datasource</cryostat.itest.jfr-datasource.imageStream>
<cryostat.itest.jfr-datasource.version>1.0.0</cryostat.itest.jfr-datasource.version>

<io.reactiverse.plugin.version>1.0.25</io.reactiverse.plugin.version>
<org.apache.maven.plugins.compiler.version>3.8.1</org.apache.maven.plugins.compiler.version>
<org.apache.maven.plugins.surefire.version>2.22.2</org.apache.maven.plugins.surefire.version>
<org.apache.maven.plugins.failsafe.version>${org.apache.maven.plugins.surefire.version}</org.apache.maven.plugins.failsafe.version>
Expand Down Expand Up @@ -217,6 +218,15 @@

<build>
<plugins>
<plugin>
<groupId>io.reactiverse</groupId>
<artifactId>vertx-maven-plugin</artifactId>
<version>${io.reactiverse.plugin.version}</version>
<configuration>
<redeploy>true</redeploy>
<launcher>io.cryostat.Cryostat</launcher>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
26 changes: 16 additions & 10 deletions run-local.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

0 comments on commit 4f84100

Please sign in to comment.