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

fix(config): config classloader strategy for different attach scenarios #523

Merged
merged 6 commits into from
Nov 25, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Oct 25, 2024

Fixes #486

To test:

Agent:

$ ./mvnw clean spotless:apply install
$ podman build -t quay.io/$MYUSER/cryostat-agent-init:0.5.0-snapshot -f src/main/container/Dockerfile .
$ podman push quay.io/$MYUSER/cryostat-agent-init:0.5.0-snapshot

Test applications:
(directly replace $MYUSER in patch - variable substitution probably doesn't work here)

diff --git a/quarkus-agent/build.bash b/quarkus-agent/build.bash
index 20899a8..0209f1a 100755
--- a/quarkus-agent/build.bash
+++ b/quarkus-agent/build.bash
@@ -19,7 +19,7 @@ podman manifest create "${BUILD_IMG}:${BUILD_TAG}"
 
 for arch in ${ARCHS:-amd64 arm64}; do
     echo "Building for ${arch} ..."
-    podman build --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}" -f "${DIR}/src/main/docker/Dockerfile.jvm" "${DIR}"
+    podman build --pull=missing --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}" -f "${DIR}/src/main/docker/Dockerfile.jvm" "${DIR}"
     podman manifest add "${BUILD_IMG}:${BUILD_TAG}" containers-storage:"${BUILD_IMG}:linux-${arch}"
 done
 
diff --git a/wildfly/28/Containerfile b/wildfly/28/Containerfile
index 69286cc..729c573 100644
--- a/wildfly/28/Containerfile
+++ b/wildfly/28/Containerfile
@@ -1,6 +1,6 @@
 ARG agent_version
 
-FROM quay.io/cryostat/cryostat-agent-init:${agent_version} AS agent
+FROM quay.io/$MYUSER/cryostat-agent-init:${agent_version} AS agent
 
 FROM quay.io/wildfly/wildfly:28.0.1.Final-jdk17
 COPY --from=agent /cryostat/agent/cryostat-agent-shaded.jar /opt/cryostat/cryostat-agent.jar
diff --git a/wildfly/28/build.bash b/wildfly/28/build.bash
index fcf585d..383244c 100755
--- a/wildfly/28/build.bash
+++ b/wildfly/28/build.bash
@@ -20,7 +20,7 @@ podman manifest create "${BUILD_IMG}:${BUILD_TAG}"
 
 for arch in "${ARCHS[@]}"; do
     echo "Building for ${arch} ..."
-    podman build --build-arg agent_version="${CRYOSTAT_AGENT_VERSION,,}" --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}" -f "${DIR}/Containerfile" "${DIR}"
+    podman build --pull=missing --build-arg agent_version="${CRYOSTAT_AGENT_VERSION,,}" --platform="linux/${arch}" -t "${BUILD_IMG}:linux-${arch}" -f "${DIR}/Containerfile" "${DIR}"
     podman manifest add "${BUILD_IMG}:${BUILD_TAG}" containers-storage:"${BUILD_IMG}:linux-${arch}"
 done
$ # you may first need to 'podman rmi' and remove existing local container images
$ ./quarkus-agent/build.bash
$ ./wildfly/28/build.bash

Cryostat smoketest:

$ ./smoketest.bash -OG -s localstack -t quarkus-cryostat-agent,wildfly-28

Containers should come up. Open https://localhost:8443 in a browser and go to Topology. Both sample applications' Agent instances should be discovered.

Check logs with podman logs compose_quarkus-cryostat-agent_1 or podman logs compose_wildfly-28_1 and ensure that there are no classloader exceptions or null pointer exceptions etc. in the agent startup sequence. HTTP exceptions early on are normal and expected.

@andrewazores andrewazores merged commit cc58824 into cryostatio:main Nov 25, 2024
9 checks passed
@andrewazores andrewazores deleted the agent-classloader branch November 25, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] When loaded via WildFly MODULE_OPTS, the default configuration properties are unset
2 participants