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(discovery): add cryostat-agent discovery plugin #45

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
!target/dependency/*.jar
!target/quarkus-app/*
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ You can run your application in dev mode that enables live coding using:

## Packaging and running the application

The [`cryostat-agent`](https://github.com/cryostatio/cryostast-agent) JAR dependency will be downloaded from an
authenticated repository by default. Add or merge the following configuration into your `$HOME/.m2/settings.xml`,
creating the file if it does not exist:

```xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>github</id>
<username>$MY_GITHUB_USERNAME</username>
<password>$MY_GITHUB_ACCESSTOKEN</password>
</server>
</servers>
</settings>
```

The token must have the `read:packages` permission. It is recommended that this is the *only* permission the token has.

The application can be packaged using:
```shell script
./mvnw package
Expand Down
30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<groupId>io.cryostat</groupId>
<artifactId>cryostat-reports</artifactId>
<version>1.1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/cryostatio/cryostat-agent</url>
</repository>
</repositories>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
Expand All @@ -16,9 +22,11 @@
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.2.5.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<dependency-plugin.version>3.3.0</dependency-plugin.version>
<com.diffplug.spotless.maven.plugin.version>2.22.7</com.diffplug.spotless.maven.plugin.version>
<org.codehaus.mojo.build.helper.plugin.version>3.3.0</org.codehaus.mojo.build.helper.plugin.version>
<io.cryostat.core.version>2.12.0</io.cryostat.core.version>
<io.cryostat.agent.version>0.1.0-SNAPSHOT</io.cryostat.agent.version>
<org.jsoup.version>1.14.3</org.jsoup.version>
</properties>
<dependencyManagement>
Expand Down Expand Up @@ -92,6 +100,28 @@
<parameters>${maven.compiler.parameters}</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${dependency-plugin.version}</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.cryostat</groupId>
<artifactId>cryostat-agent</artifactId>
<version>${io.cryostat.agent.version}</version>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
Expand Down
11 changes: 9 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ if [ -z "${TIMEOUT}" ]; then
fi

podman run \
--name cryostat-reports \
--user 0 \
--pod cryostat-pod \
--cpus "${CPUS}" \
--memory "${MEMORY}" \
--publish 8080:8080 \
--env JAVA_OPTIONS="-XX:ActiveProcessorCount=${CPUS} -XX:+PrintCommandLineFlags -Dorg.openjdk.jmc.flightrecorder.parser.singlethreaded=${SINGLETHREAD_JFR_PARSE} -Dio.cryostat.reports.memory-factor=${MEMORY_FACTOR} -Dio.cryostat.reports.timeout=${TIMEOUT}" \
--env JAVA_OPTIONS="-XX:ActiveProcessorCount=${CPUS} -XX:+PrintCommandLineFlags -Dorg.openjdk.jmc.flightrecorder.parser.singlethreaded=${SINGLETHREAD_JFR_PARSE} -Dio.cryostat.reports.memory-factor=${MEMORY_FACTOR} -Dio.cryostat.reports.timeout=${TIMEOUT} -Dcom.sun.management.jmxremote.port=7878 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -javaagent:/deployments/app/cryostat-agent.jar" \
--env QUARKUS_HTTP_PORT=10005 \
--env CRYOSTAT_AGENT_APP_NAME="cryostat-reports" \
--env CRYOSTAT_AGENT_CALLBACK="http://localhost:9977/" \
--env CRYOSTAT_AGENT_BASEURI="https://localhost:8181/" \
--env CRYOSTAT_AGENT_TRUST_ALL="true" \
--env CRYOSTAT_AGENT_AUTHORIZATION="Basic $(echo -n user:pass | base64)" \
--rm -it \
quay.io/cryostat/cryostat-reports:latest
4 changes: 3 additions & 1 deletion src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security

# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/deployments/app/cryostat-agent.jar"
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=1001 target/quarkus-app/*.jar /deployments/
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/

COPY --chown=1001 target/dependency/cryostat-agent.jar /deployments/app/

EXPOSE 8080
USER 1001

Expand Down