Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hotreload): create configuration for hot-reload dev server #745

Merged
merged 5 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ bin/

archive/
conf/
truststore/
clientlib/
certs/*.p12
certs/*.pass
clientlib/
templates/
truststore/
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 devserver.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
41 changes: 41 additions & 0 deletions devserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

work_dir=$(mktemp -d)

if [ -z $MVN ]; then
MVN=$(which mvn)
fi

for i in archive clientlib conf templates; do
if [ -e $work_dir/$i ]; then
if [ ! -d $work_dir/$i ]; then
echo "$work_dir/$i already exists but is not a directory"
exit 1
fi
else
mkdir $work_dir/$i
fi
done

flags=(
"-Dcom.sun.management.jmxremote.autodiscovery=true"
"-Dcom.sun.management.jmxremote.port=9091"
"-Dcom.sun.management.jmxremote.rmi.port=9091"
"-Dcom.sun.management.jmxremote.authenticate=false"
"-Dcom.sun.management.jmxremote.ssl=false"
"-Dcom.sun.management.jmxremote.registry.ssl=false"
)

MAVEN_OPTS="${flags[@]}" \
CRYOSTAT_PLATFORM=io.cryostat.platform.internal.DefaultPlatformStrategy \
CRYOSTAT_DISABLE_SSL=true \
CRYOSTAT_DISABLE_JMX_AUTH=true \
CRYOSTAT_WEB_HOST=localhost \
CRYOSTAT_WEB_PORT=8181 \
CRYOSTAT_CORS_ORIGIN=http://localhost:9000 \
CRYOSTAT_AUTH_MANAGER=io.cryostat.net.NoopAuthManager \
CRYOSTAT_ARCHIVE_PATH="$work_dir/archive" \
CRYOSTAT_CLIENTLIB_PATH="$work_dir/clientlib" \
CRYOSTAT_CONFIG_PATH="$work_dir/conf" \
CRYOSTAT_TEMPLATE_PATH="$work_dir/templates" \
$MVN -Dcryostat.minimal=true clean vertx:run
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
6 changes: 3 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ fi
podman run \
--pod cryostat \
--memory 512M \
--mount type=tmpfs,target=/opt/cryostat.d/templates.d \
--mount type=bind,source="$(dirname $0)/archive",destination=/opt/cryostat.d/recordings.d,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/conf",destination=/opt/cryostat.d/conf.d,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/truststore",destination=/truststore,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/certs",destination=/certs,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/clientlib",destination=/clientlib,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/conf",destination=/opt/cryostat.d/conf.d,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/templates",destination=/opt/cryostat.d/templates.d,relabel=shared,bind-propagation=shared \
--mount type=bind,source="$(dirname $0)/truststore",destination=/truststore,relabel=shared,bind-propagation=shared \
-e CRYOSTAT_PLATFORM=$CRYOSTAT_PLATFORM \
-e CRYOSTAT_DISABLE_SSL=$CRYOSTAT_DISABLE_SSL \
-e CRYOSTAT_DISABLE_JMX_AUTH=$CRYOSTAT_DISABLE_JMX_AUTH \
Expand Down