Skip to content

Commit

Permalink
feat(jdp): add env vars to enable/configure JDP (backport #804) (#814)
Browse files Browse the repository at this point in the history
* feat(jdp): add env vars to enable/configure JDP (#804)

* feat(jdp): add env var to enable JDP

* feat(jdp): add env vars for JDP addr and port

* enable JDP in development tests

* fix(jdp): broken env var checks

* default JDP to true for backward compatibility

(cherry picked from commit 5fd17e7)

# Conflicts:
#	README.md
#	pom.xml
#	run.sh

* resolve README conflicts

* resolve run.sh conflicts

* resolve pom.xml conflicts

* fixup! resolve README conflicts

* fixup! fixup! resolve README conflicts

* fixup! fixup! fixup! resolve README conflicts

Co-authored-by: Andrew Azores <aazores@redhat.com>
  • Loading branch information
mergify[bot] and andrewazores authored Feb 9, 2022
1 parent ca2277e commit 6d6dbb1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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 Expand Up @@ -100,6 +100,9 @@ Cryostat can be configured via the following environment variables
* `CRYOSTAT_AUTH_MANAGER`: the authentication/authorization manager used for validating user accesses. See the `USER AUTHENTICATION / AUTHORIZATION` section for more details. Set to the fully-qualified class name of the auth manager implementation to use, ex. `io.cryostat.net.BasicAuthManager`.
* `CRYOSTAT_PLATFORM`: the platform client used for performing platform-specific actions, such as listing available target JVMs. If `CRYOSTAT_AUTH_MANAGER` is not specified then a default auth manager will also be selected corresponding to the platform, whether that platform is specified by the user or automatically detected. Set to the fully-qualified name of the platform detection strategy implementation to use, ex. `io.cryostat.platform.internal.KubeEnvPlatformStrategy`.
* `CRYOSTAT_CONFIG_PATH`: the filesystem path for the configuration directory (default `/opt/cryostat.d/conf.d`)
* `CRYOSTAT_ENABLE_JDP_BROADCAST`: enable the Cryostat JVM to broadcast itself via JDP (Java Discovery Protocol). Defaults to `true`.
* `CRYOSTAT_JDP_ADDRESS`: the JDP multicast address to send discovery packets. Defaults to `224.0.23.178`.
* `CRYOSTAT_JDP_PORT`: the JDP multicast port to send discovery packets. Defaults to `7095`.

#### Configuration for Automated Analysis Reports

Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@
<argument>--env</argument>
<argument>CRYOSTAT_TARGET_CACHE_TTL=5</argument>
<argument>--env</argument>
<argument>CRYOSTAT_ENABLE_JDP_BROADCAST=true</argument>
<argument>--env</argument>
<argument>CRYOSTAT_DISABLE_JMX_AUTH=true</argument>
<argument>--env</argument>
<argument>CRYOSTAT_DISABLE_SSL=true</argument>
Expand Down
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ podman run \
--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 \
-e CRYOSTAT_ENABLE_JDP_BROADCAST=true \
-e CRYOSTAT_PLATFORM=$CRYOSTAT_PLATFORM \
-e CRYOSTAT_DISABLE_SSL=$CRYOSTAT_DISABLE_SSL \
-e CRYOSTAT_DISABLE_JMX_AUTH=$CRYOSTAT_DISABLE_JMX_AUTH \
Expand Down
15 changes: 14 additions & 1 deletion src/main/extras/app/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,26 @@ fi

FLAGS=(
"-XX:+CrashOnOutOfMemoryError"
"-Dcom.sun.management.jmxremote.autodiscovery=true"
"-Dcom.sun.management.jmxremote.port=$CRYOSTAT_RJMX_PORT"
"-Dcom.sun.management.jmxremote.rmi.port=$CRYOSTAT_RMI_PORT"
"-Djavax.net.ssl.trustStore=$SSL_TRUSTSTORE"
"-Djavax.net.ssl.trustStorePassword=$SSL_TRUSTSTORE_PASS"
)

if [ -z "$CRYOSTAT_ENABLE_JDP_BROADCAST" ]; then
FLAGS+=("-Dcom.sun.management.jmxremote.autodiscovery=true")
else
FLAGS+=("-Dcom.sun.management.jmxremote.autodiscovery=$CRYOSTAT_ENABLE_JDP_BROADCAST")
fi

if [ -n "$CRYOSTAT_JDP_ADDRESS" ]; then
FLAGS+=("-Dcom.sun.management.jmxremote.jdp.address=$CRYOSTAT_JDP_ADDRESS")
fi

if [ -n "$CRYOSTAT_JDP_PORT" ]; then
FLAGS+=("-Dcom.sun.management.jmxremote.jdp.port=$CRYOSTAT_JDP_PORT")
fi

importTrustStores

if [ "$CRYOSTAT_DISABLE_JMX_AUTH" = "true" ]; then
Expand Down

0 comments on commit 6d6dbb1

Please sign in to comment.