Skip to content

Commit

Permalink
build(deps): update Quarkus to 3.8 LTS (#609)
Browse files Browse the repository at this point in the history
* build(deps): update Quarkus to 3.8 LTS

* add hibernate format mapper override

* remove no longer necessary lazy init

* disable openapi management / swagger UI unless in dev mode

* remove duplicate healthcheck override

* reduce healthcheck start periods

* correct healthcheck URL

* use authproxy image which contains wget for healthcheck

* correct healthchecks for vertx agent test applications
  • Loading branch information
andrewazores authored Sep 30, 2024
1 parent 2e86562 commit 739a65f
Show file tree
Hide file tree
Showing 31 changed files with 176 additions and 184 deletions.
12 changes: 3 additions & 9 deletions compose/auth_proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ services:
QUARKUS_HTTP_PROXY_ENABLE_FORWARDED_PREFIX: "true"
QUARKUS_HTTP_ACCESS_LOG_PATTERN: long
QUARKUS_HTTP_ACCESS_LOG_ENABLED: "true"
healthcheck:
test: curl --fail http://cryostat:8181/health/liveness || exit 1
interval: 10s
retries: 3
start_period: 30s
timeout: 5s
auth:
# the proxy does not actually depend on cryostat being up, but we use this
# to ensure that when the smoketest tries to open the auth login page in a
Expand All @@ -31,7 +25,7 @@ services:
limits:
cpus: "0.1"
memory: 32m
image: ${OAUTH2_PROXY_IMAGE:-quay.io/oauth2-proxy/oauth2-proxy:latest}
image: ${OAUTH2_PROXY_IMAGE:-quay.io/oauth2-proxy/oauth2-proxy:latest-alpine}
command:
- --alpha-config=/tmp/auth_proxy_alpha_config.yml
volumes:
Expand All @@ -49,10 +43,10 @@ services:
CRYOSTAT_PROXY_PORT: ${CRYOSTAT_PROXY_PORT}
restart: unless-stopped
healthcheck:
test: wget -q --spider ${CRYOSTAT_PROXY_PROTOCOL}://localhost:${CRYOSTAT_PROXY_PORT}/ping || exit 1
test: wget --no-check-certificate -q --spider ${CRYOSTAT_PROXY_PROTOCOL}://localhost:${CRYOSTAT_PROXY_PORT}/ping || exit 1
interval: 10s
retries: 3
start_period: 30s
start_period: 10s
timeout: 5s

volumes:
Expand Down
2 changes: 1 addition & 1 deletion compose/cryostat-grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ services:
test: curl --fail http://localhost:3000/ || exit 1
retries: 3
interval: 30s
start_period: 30s
start_period: 10s
timeout: 1s
14 changes: 8 additions & 6 deletions compose/cryostat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ services:
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
restart: unless-stopped
healthcheck:
test: curl --fail http://cryostat:${CRYOSTAT_HTTP_PORT}/health/liveness || exit 1
interval: 10s
retries: 3
start_period: 30s
timeout: 5s
# FIXME reenable this check. Somehow after upgrading to Quarkus 3.8, this check fails with 'connection refused',
# but the container comes up successfully without it and shelling into the container later to run curl succeeds
# healthcheck:
# test: curl --fail http://cryostat:${CRYOSTAT_HTTP_PORT}/health/liveness || exit 1
# interval: 10s
# retries: 3
# start_period: 30s
# timeout: 5s

volumes:
jmxtls_cfg:
Expand Down
2 changes: 1 addition & 1 deletion compose/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
test: pg_isready -U cryostat -d cryostat || exit 1
interval: 10s
retries: 3
start_period: 30s
start_period: 10s
timeout: 5s

volumes:
Expand Down
4 changes: 2 additions & 2 deletions compose/jfr-datasource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ services:
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
healthcheck:
test: curl --fail ${CRYOSTAT_PROXY_PROTOCOL}://localhost:${CRYOSTAT_PROXY_PORT}/ || exit 1
test: curl --fail http://localhost:8080/ || exit 1
retries: 3
interval: 30s
start_period: 30s
start_period: 10s
timeout: 1s
6 changes: 3 additions & 3 deletions compose/sample_apps/vertx-cryostat-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ services:
- "8911"
restart: always
healthcheck:
test: curl --fail http://localhost:8081 || exit 1
test: curl --fail http://localhost:8082 || exit 1
interval: 10s
retries: 3
start_period: 30s
Expand Down Expand Up @@ -102,7 +102,7 @@ services:
- "8912"
restart: always
healthcheck:
test: curl --fail http://localhost:8081 || exit 1
test: curl --fail http://localhost:8083 || exit 1
interval: 10s
retries: 3
start_period: 30s
Expand All @@ -126,7 +126,7 @@ services:
- "8084:8084"
restart: always
healthcheck:
test: curl --fail http://localhost:8081 || exit 1
test: curl --fail http://localhost:8084 || exit 1
interval: 10s
retries: 3
start_period: 30s
Expand Down
24 changes: 7 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,17 @@
<io.cryostat.core.version>4.0.0-SNAPSHOT</io.cryostat.core.version>
<org.openjdk.jmc.version>9.0.0</org.openjdk.jmc.version>

<org.apache.commons.codec.version>1.16.1</org.apache.commons.codec.version>
<org.apache.commons.io.version>2.16.1</org.apache.commons.io.version>
<org.apache.commons.collections.version>4.4</org.apache.commons.collections.version>
<org.apache.httpcomponents.version>5.2.1</org.apache.httpcomponents.version>
<org.apache.commons.lang3.version>3.14.0</org.apache.commons.lang3.version>
<org.apache.commons.validator.version>1.8.0</org.apache.commons.validator.version>
<org.projectnessie.cel.bom.version>0.4.4</org.projectnessie.cel.bom.version>
<com.google.protobuf-java.version>3.25.2</com.google.protobuf-java.version>
<com.nimbusds.jose.jwt.version>9.41.1</com.nimbusds.jose.jwt.version>
<org.testcontainers.bom.version>1.20.1</org.testcontainers.bom.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.2.12.Final</quarkus.platform.version>
<quarkus-quinoa.version>2.2.5</quarkus-quinoa.version>
<io.netty.version>4.1.108.Final</io.netty.version>
<quarkus.platform.version>3.8.6</quarkus.platform.version>
<quarkus-quinoa.version>2.3.10</quarkus-quinoa.version>
<org.codehaus.mojo.build.helper.plugin.version>3.6.0</org.codehaus.mojo.build.helper.plugin.version>
<org.codehaus.mojo.exec.plugin.version>3.4.1</org.codehaus.mojo.exec.plugin.version>
<assembly-plugin.version>3.7.1</assembly-plugin.version>
Expand All @@ -60,19 +56,12 @@
<com.google.java-format.version>1.23.0</com.google.java-format.version>
<com.mycila.license.maven.plugin.version>4.6</com.mycila.license.maven.plugin.version>
<surefire-plugin.version>3.5.0</surefire-plugin.version>
<surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount>
<surefire.rerunFailingTestsCount>0</surefire.rerunFailingTestsCount>
<failsafe-plugin.version>3.5.0</failsafe-plugin.version>
<failsafe.rerunFailingTestsCount>${surefire.rerunFailingTestsCount}</failsafe.rerunFailingTestsCount>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${io.netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
Expand Down Expand Up @@ -161,6 +150,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-netty</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
Expand Down Expand Up @@ -225,12 +218,10 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${org.apache.commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${org.apache.commons.codec.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down Expand Up @@ -566,7 +557,6 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${io.netty.version}</version>
<classifier>${io.netty.netty-transport-native-epoll.classifier}</classifier>
<scope>${io.netty.netty-transport-native-epoll.scope}</scope>
</dependency>
Expand Down
17 changes: 7 additions & 10 deletions schema/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ components:
DiscoveryPlugin:
properties:
builtin:
readOnly: true
type: boolean
callback:
format: uri
Expand Down Expand Up @@ -296,6 +297,7 @@ components:
Target:
properties:
agent:
readOnly: true
type: boolean
alias:
pattern: \S
Expand Down Expand Up @@ -347,11 +349,6 @@ components:
meta:
$ref: '#/components/schemas/Meta'
type: object
securitySchemes:
SecurityScheme:
description: Authentication
scheme: basic
type: http
info:
contact:
email: [email protected]
Expand Down Expand Up @@ -913,7 +910,7 @@ paths:
type: string
requestBody:
content:
application/json:
text/plain:
schema:
type: string
responses:
Expand Down Expand Up @@ -1906,7 +1903,7 @@ paths:
responses:
"200":
content:
application/json:
text/plain:
schema:
type: string
description: OK
Expand Down Expand Up @@ -2393,13 +2390,13 @@ paths:
type: integer
requestBody:
content:
application/json:
text/plain:
schema:
type: string
responses:
"200":
content:
application/json:
text/plain:
schema:
type: string
description: OK
Expand Down Expand Up @@ -2429,7 +2426,7 @@ paths:
responses:
"200":
content:
application/json:
text/plain:
schema:
type: string
description: OK
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/io/cryostat/HibernateFormatMapperCustomization.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright The Cryostat Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cryostat;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.hibernate.orm.JsonFormat;
import io.quarkus.hibernate.orm.PersistenceUnitExtension;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.format.jackson.JacksonJsonFormatMapper;

@JsonFormat
@PersistenceUnitExtension
/**
* @see https://github.com/quarkusio/quarkus/issues/42596
*/
public class HibernateFormatMapperCustomization implements FormatMapper {

private final JacksonJsonFormatMapper delegate =
new JacksonJsonFormatMapper(new ObjectMapper().findAndRegisterModules());

@Override
public <T> T fromString(
CharSequence charSequence, JavaType<T> javaType, WrapperOptions wrapperOptions) {
return delegate.fromString(charSequence, javaType, wrapperOptions);
}

@Override
public <T> String toString(T value, JavaType<T> javaType, WrapperOptions wrapperOptions) {
return delegate.toString(value, javaType, wrapperOptions);
}
}
3 changes: 0 additions & 3 deletions src/main/java/io/cryostat/credentials/Credentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.cryostat.expressions.MatchExpression;
import io.cryostat.expressions.MatchExpression.TargetMatcher;

import io.smallrye.common.annotation.Blocking;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
Expand Down Expand Up @@ -113,7 +112,6 @@ static Map<String, Object> notificationResult(Credential credential) throws Scri
return result;
}

@Blocking
static Map<String, Object> safeResult(Credential credential, TargetMatcher matcher)
throws ScriptException {
Map<String, Object> result = new HashMap<>();
Expand All @@ -124,7 +122,6 @@ static Map<String, Object> safeResult(Credential credential, TargetMatcher match
return result;
}

@Blocking
static Map<String, Object> safeMatchedResult(Credential credential, TargetMatcher matcher)
throws ScriptException {
Map<String, Object> result = new HashMap<>();
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/io/cryostat/credentials/CredentialsFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.cryostat.targets.Target.TargetDiscovery;

import io.quarkus.vertx.ConsumeEvent;
import io.smallrye.common.annotation.Blocking;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.collections4.BidiMap;
Expand Down Expand Up @@ -52,7 +51,6 @@ void onMessage(TargetDiscovery event) {
}
}

@Blocking
public Optional<Credential> getCredentialsForTarget(Target target) {
return Optional.ofNullable(
cache.computeIfAbsent(
Expand All @@ -73,7 +71,6 @@ public Optional<Credential> getCredentialsForTarget(Target target) {
.orElse(null)));
}

@Blocking
public Optional<Credential> getCredentialsForConnectUrl(URI connectUrl) {
return Target.find("connectUrl", connectUrl)
.<Target>singleResultOptional()
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/io/cryostat/discovery/ContainerDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public abstract class ContainerDiscovery {

protected long timerId;

@Transactional
void onStart(@Observes StartupEvent evt) {
if (!enabled()) {
return;
Expand All @@ -201,7 +200,6 @@ void onStart(@Observes StartupEvent evt) {
}

logger.debugv("Starting {0} client", getRealm());

queryContainers();
this.timerId = vertx.setPeriodic(pollPeriod.toMillis(), unused -> queryContainers());
}
Expand Down Expand Up @@ -266,10 +264,9 @@ private Target toTarget(ContainerSpec desc) {
target.connectUrl = connectUrl;
target.alias = Optional.ofNullable(desc.Names.get(0)).orElse(desc.Id);
target.labels = desc.Labels;
target.annotations = new Annotations();
target.annotations
.cryostat()
.putAll(
target.annotations =
new Annotations(
null,
Map.of(
"REALM", // AnnotationKey.REALM,
getRealm(),
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/io/cryostat/discovery/CustomDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ Response doV2Create(
credential.ifPresent(c -> c.persist());

target.activeRecordings = new ArrayList<>();
target.labels = Map.of();
target.annotations = new Annotations();
target.annotations.cryostat().putAll(Map.of("REALM", REALM));
target.annotations = new Annotations(null, Map.of("REALM", REALM));

DiscoveryNode node = DiscoveryNode.target(target, BaseNodeType.JVM);
target.discoveryNode = node;
Expand Down
Loading

0 comments on commit 739a65f

Please sign in to comment.