Skip to content

Commit 6ee4987

Browse files
rmartingmanusa
andauthored
🔀 Upgrade to latest Quarkus, Strimizi, Apicurio Registry Operators and others (#1)
Main changes included: * ⚡ Updated to Quarkus 1.13.7.Final * ⬆️ Upgrade to Strimzi 0.24.0 (Apache Kafka 2.7) * ⬆️ Upgrade to Apicurio Registry 2.0.1.Final * ♻️ Refactored Kafka config to use latest version of Apicurio Serdes * ⬆️ Update JKube (kubernetes|openshift)-maven-plugin to 1.3.0 * 📝 How to deploy in Minikube or CodeReady Containers * 📝 Fix minor typos in readme * 📝 Changed Maven commands to use mvnw cli Co-authored-by: manusa <marc@marcnuri.com>
1 parent f0ccafa commit 6ee4987

24 files changed

+459
-504
lines changed

README.md

Lines changed: 115 additions & 67 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 72 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.jromanmartin.kafka</groupId>
66
<artifactId>kafka-clients-quarkus-sample</artifactId>
7-
<version>1.0.0-SNAPSHOT</version>
7+
<version>2.0.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<dependencyManagement>
@@ -23,23 +23,23 @@
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424
<maven.compiler.source>11</maven.compiler.source>
2525
<maven.compiler.target>11</maven.compiler.target>
26+
<maven.compiler.parameters>true</maven.compiler.parameters>
27+
<compiler-plugin.version>3.8.1</compiler-plugin.version>
28+
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
2629
<!-- Kafka Clients -->
27-
<kafka-clients.version>2.5.0</kafka-clients.version>
30+
<kafka-clients.version>2.7.0</kafka-clients.version>
2831
<!-- Avro -->
29-
<avro.version>1.10.1</avro.version>
32+
<avro.version>1.10.2</avro.version>
3033
<!-- Apicurio Registry -->
31-
<apicurio.version>1.3.2.Final</apicurio.version>
32-
<!--<apicurio.registry.url>http://localhost:8080/api</apicurio.registry.url>-->
33-
<!-- <apicurio.registry.url>http://service-registry.amq-streams-demo.apps-crc.testing/api</apicurio.registry.url>-->
34-
<apicurio.registry.url>http://service-registry.amq-streams-demo.apps.selae.sandbox1805.opentlc.com/api</apicurio.registry.url>
34+
<apicurio.version>2.0.1.Final</apicurio.version>
35+
<!--<apicurio.registry.url>http://localhost:8080/apis/registry/v2</apicurio.registry.url>-->
36+
<apicurio.registry.url>http://service-registry.amq-streams-demo.apps-crc.testing/apis/registry/v2</apicurio.registry.url>
3537
<!-- JKube -->
3638
<jkube.enricher.jkube-service.type>NodePort</jkube.enricher.jkube-service.type>
3739
<jkube.generator.name>${project.artifactId}:${project.version}</jkube.generator.name>
3840
<jkube.generator.quarkus.webPort>8181</jkube.generator.quarkus.webPort>
3941
<!-- Quarkus -->
40-
<quarkus.platform.version>1.10.5.Final</quarkus.platform.version>
41-
<!-- Quarkus Extensions -->
42-
<quarkiverse.apicurio.version>0.0.1</quarkiverse.apicurio.version>
42+
<quarkus.platform.version>1.13.7.Final</quarkus.platform.version>
4343
</properties>
4444

4545
<dependencies>
@@ -83,23 +83,11 @@
8383
<artifactId>quarkus-avro</artifactId>
8484
</dependency>
8585

86-
<dependency>
87-
<groupId>io.quarkiverse.apicurio</groupId>
88-
<artifactId>quarkiverse-apicurio-registry-client</artifactId>
89-
<version>${quarkiverse.apicurio.version}</version>
90-
</dependency>
91-
9286
<!-- Apicurio Serializers/Deserializers -->
9387
<dependency>
9488
<groupId>io.apicurio</groupId>
95-
<artifactId>apicurio-registry-utils-serde</artifactId>
89+
<artifactId>apicurio-registry-serdes-avro-serde</artifactId>
9690
<version>${apicurio.version}</version>
97-
<exclusions>
98-
<exclusion>
99-
<groupId>org.jboss.spec.javax.interceptor</groupId>
100-
<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
101-
</exclusion>
102-
</exclusions>
10391
</dependency>
10492

10593
<!-- Test Dependencies -->
@@ -115,14 +103,32 @@
115103
<executions>
116104
<execution>
117105
<goals>
106+
<goal>build</goal>
118107
<goal>generate-code</goal>
119108
<goal>generate-code-tests</goal>
120-
<goal>build</goal>
121109
</goals>
122110
</execution>
123111
</executions>
124112
</plugin>
125113

114+
<plugin>
115+
<artifactId>maven-compiler-plugin</artifactId>
116+
<version>${compiler-plugin.version}</version>
117+
<configuration>
118+
<parameters>${maven.compiler.parameters}</parameters>
119+
</configuration>
120+
</plugin>
121+
<plugin>
122+
<artifactId>maven-surefire-plugin</artifactId>
123+
<version>${surefire-plugin.version}</version>
124+
<configuration>
125+
<systemPropertyVariables>
126+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
127+
<maven.home>${maven.home}</maven.home>
128+
</systemPropertyVariables>
129+
</configuration>
130+
</plugin>
131+
126132
<!-- Avro Maven Plug-In to generate classes from schemas (files *.avsc) -->
127133
<plugin>
128134
<groupId>org.apache.avro</groupId>
@@ -153,9 +159,10 @@
153159
<plugin>
154160
<groupId>org.codehaus.mojo</groupId>
155161
<artifactId>build-helper-maven-plugin</artifactId>
156-
<version>3.1.0</version>
162+
<version>3.2.0</version>
157163
<executions>
158164
<execution>
165+
<id>add-source</id>
159166
<!-- Added the generated source folder as source path to compile classes -->
160167
<phase>generate-sources</phase>
161168
<goals>
@@ -174,6 +181,7 @@
174181
</build>
175182

176183
<profiles>
184+
<!-- Apicurio Registry -->
177185
<profile>
178186
<id>apicurio</id>
179187
<build>
@@ -190,17 +198,42 @@
190198
</goals>
191199
<configuration>
192200
<registryUrl>${apicurio.registry.url}</registryUrl>
193-
<artifactType>AVRO</artifactType>
194201
<artifacts>
195-
<!-- Schema definition for RecordIdStrategy strategy -->
196-
<io.jromanmartin.kafka.schema.avro.Message>${project.basedir}/src/main/resources/schemas/message.avsc</io.jromanmartin.kafka.schema.avro.Message>
197-
<!-- Online -->
198202
<!-- Schema definition for SimpleTopicIdStrategy strategy -->
199-
<messages>${project.basedir}/src/main/resources/schemas/message.avsc</messages>
203+
<artifact>
204+
<groupId>default</groupId>
205+
<artifactId>messages</artifactId>
206+
<type>AVRO</type>
207+
<file>
208+
${project.basedir}/src/main/resources/schemas/message.avsc
209+
</file>
210+
<ifExists>RETURN_OR_UPDATE</ifExists>
211+
<canonicalize>true</canonicalize>
212+
</artifact>
213+
200214
<!-- Schema definition for TopicIdStrategy strategy -->
201-
<messages-value>${project.basedir}/src/main/resources/schemas/message.avsc</messages-value>
202-
<!-- Schema definition for TopicRecordIdStrategystrategy -->
203-
<messages-io.jromanmartin.kafka.schema.avro.Message>${project.basedir}/src/main/resources/schemas/message.avsc</messages-io.jromanmartin.kafka.schema.avro.Message>
215+
<artifact>
216+
<groupId>default</groupId>
217+
<artifactId>messages-value</artifactId>
218+
<type>AVRO</type>
219+
<file>
220+
${project.basedir}/src/main/resources/schemas/message.avsc
221+
</file>
222+
<ifExists>RETURN_OR_UPDATE</ifExists>
223+
<canonicalize>true</canonicalize>
224+
</artifact>
225+
226+
<!-- Schema definition for RecordIdStrategy strategy -->
227+
<artifact>
228+
<groupId>io.jromanmartin.kafka.schema.avro</groupId>
229+
<artifactId>Message</artifactId>
230+
<type>AVRO</type>
231+
<file>
232+
${project.basedir}/src/main/resources/schemas/message.avsc
233+
</file>
234+
<ifExists>RETURN_OR_UPDATE</ifExists>
235+
<canonicalize>true</canonicalize>
236+
</artifact>
204237
</artifacts>
205238
</configuration>
206239
</execution>
@@ -218,7 +251,7 @@
218251
<plugin>
219252
<groupId>org.eclipse.jkube</groupId>
220253
<artifactId>openshift-maven-plugin</artifactId>
221-
<version>1.0.2</version>
254+
<version>1.3.0</version>
222255
</plugin>
223256
</plugins>
224257
</build>
@@ -232,7 +265,7 @@
232265
<plugin>
233266
<groupId>org.eclipse.jkube</groupId>
234267
<artifactId>kubernetes-maven-plugin</artifactId>
235-
<version>1.0.2</version>
268+
<version>1.3.0</version>
236269
</plugin>
237270
</plugins>
238271
</build>
@@ -250,7 +283,7 @@
250283
<plugins>
251284
<plugin>
252285
<artifactId>maven-failsafe-plugin</artifactId>
253-
<version>3.0.0-M5</version>
286+
<version>${surefire-plugin.version}</version>
254287
<executions>
255288
<execution>
256289
<goals>
@@ -262,9 +295,10 @@
262295
<native.image.path>
263296
${project.build.directory}/${project.build.finalName}-runner
264297
</native.image.path>
265-
<java.util.logging.manager>org.jboss.logmanager.LogManager
298+
<java.util.logging.manager>
299+
org.jboss.logmanager.LogManager
266300
</java.util.logging.manager>
267-
<!--<maven.home>${maven.home}</maven.home>-->
301+
<maven.home>${maven.home}</maven.home>
268302
</systemPropertyVariables>
269303
</configuration>
270304
</execution>

src/main/apicurio/operator/subscription-k8s.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ apiVersion: operators.coreos.com/v1alpha1
33
kind: Subscription
44
metadata:
55
name: apicurio-registry
6-
namespace: amq-streams-demo
6+
namespace: operators
77
spec:
8-
channel: alpha
8+
channel: 2.x
99
name: apicurio-registry
1010
source: operatorhubio-catalog
1111
sourceNamespace: olm

src/main/apicurio/operator/subscription.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: apicurio-registry
66
namespace: amq-streams-demo
77
spec:
8-
channel: alpha
8+
channel: 2.x
99
installPlanApproval: Automatic
1010
name: apicurio-registry
1111
source: community-operators
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
apiVersion: apicur.io/v1alpha1
1+
apiVersion: registry.apicur.io/v1
22
kind: ApicurioRegistry
33
metadata:
44
name: service-registry
55
spec:
66
configuration:
7-
logLevel: INFO
8-
persistence: "streams"
9-
streams:
10-
applicationId: "service-registry"
7+
persistence: "kafkasql"
8+
kafkasql:
119
bootstrapServers: "my-kafka-kafka-bootstrap:9093"
1210
security:
1311
scram:
1412
mechanism: SCRAM-SHA-512
1513
user: service-registry-scram
1614
passwordSecretName: service-registry-scram
1715
truststoreSecretName: my-kafka-cluster-ca-cert
18-
# tls:
19-
# keystoreSecretName: service-registry-tls
20-
# truststoreSecretName: my-kafka-cluster-ca-cert
2116
ui:
2217
readOnly: false
18+
logLevel: INFO
2319
deployment:
2420
replicas: 1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kafka.strimzi.io/v1beta2
2+
kind: KafkaTopic
3+
metadata:
4+
labels:
5+
strimzi.io/cluster: my-kafka
6+
name: kafkasql-journal
7+
spec:
8+
partitions: 1
9+
replicas: 1
10+
config:
11+
cleanup.policy: compact

src/main/apicurio/topics/kafkatopic-global-id-topic.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/apicurio/topics/kafkatopic-storage-topic.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/docker/Dockerfile.jvm

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
3+
#
4+
# Before building the container image run:
5+
#
6+
# ./mvnw package
7+
#
8+
# Then, build the image with:
9+
#
10+
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/kafka-clients-quarkus-sample .
11+
#
12+
# Then run the container using:
13+
#
14+
# docker run -i --rm -p 8080:8080 quarkus/kafka-clients-quarkus-sample-jvm
15+
#
16+
# If you want to include the debug port into your docker image
17+
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005
18+
#
19+
# Then run the container using :
20+
#
21+
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/kafka-clients-quarkus-sample-jvm
22+
#
23+
###
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
25+
26+
ARG JAVA_PACKAGE=java-11-openjdk-headless
27+
ARG RUN_JAVA_VERSION=1.3.8
28+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
29+
# Install java and the run-java script
30+
# Also set up permissions for user `1001`
31+
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
32+
&& microdnf update \
33+
&& microdnf clean all \
34+
&& mkdir /deployments \
35+
&& chown 1001 /deployments \
36+
&& chmod "g+rwX" /deployments \
37+
&& chown 1001:root /deployments \
38+
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
39+
&& chown 1001 /deployments/run-java.sh \
40+
&& chmod 540 /deployments/run-java.sh \
41+
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
42+
43+
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
44+
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
45+
# We make four distinct layers so if there are application changes the library layers can be re-used
46+
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
47+
COPY --chown=1001 target/quarkus-app/*.jar /deployments/
48+
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
49+
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
50+
51+
EXPOSE 8080
52+
USER 1001
53+
54+
ENTRYPOINT [ "/deployments/run-java.sh" ]

0 commit comments

Comments
 (0)