Skip to content

Commit

Permalink
Upgrade to Quarkus2.15.0 (#22)
Browse files Browse the repository at this point in the history
Add properties to README
Update Dockerfile files
  • Loading branch information
ruromero authored Dec 19, 2022
1 parent 948dd3b commit 33044fd
Show file tree
Hide file tree
Showing 25 changed files with 1,588 additions and 970 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/lib/*
!target/quarkus-app/*
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
90 changes: 59 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ work well and send valid CloudEvents.
By default the application will start using a loopback endpoint

```{bash}
./target/cloudevent-player-1.0-SNAPSHOT-runner
./target/cloudevent-player-1.1-SNAPSHOT-runner
```

You can send a message from inside the application by filling in the form and the activity will show the sent
Expand Down Expand Up @@ -73,45 +73,51 @@ mvn clean package
Run

```shell script
$ java -jar target/quarkus-app/quarkus-run.jar
$ java -Dplayer.mode=LOCAL -jar target/quarkus-app/quarkus-run.jar
...
021-04-05 15:11:00,138 INFO [io.quarkus] (main) cloudevent-player 1.0-SNAPSHOT on JVM (powered by Quarkus 1.13.0.Final) started in 1.246s. Listening on: http://0.0.0.0:8080
2021-04-05 15:11:00,138 INFO [io.quarkus] (main) Profile prod activated.
2021-04-05 15:11:00,138 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, mutiny, rest-client, resteasy, resteasy-jsonb, servlet, smallrye-context-propagation, vertx, websockets]
2022-06-24 18:39:07,794 INFO [io.und.websockets] (main) UT026003: Adding annotated server endpoint class com.redhat.syseng.tools.cloudevents.resources.MessagesSocket for path /socket
2022-06-24 18:39:08,130 INFO [io.qua.sma.ope.run.OpenApiRecorder] (main) Default CORS properties will be used, please use 'quarkus.http.cors' properties instead
2022-06-24 18:39:08,216 INFO [io.quarkus] (main) cloudevent-player 1.1-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 0.879s. Listening on: http://0.0.0.0:8080
2022-06-24 18:39:08,217 INFO [io.quarkus] (main) Profile prod activated.
2022-06-24 18:39:08,217 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, vertx, websockets, websockets-client]
```

### Quarkus dev mode

```shell script
$ mvn clean compile quarkus:dev
$ mvn quarkus:dev -Dplayer.mode=LOCAL
...
Listening for transport dt_socket at address: 5005
...
[INFO] --- quarkus-maven-plugin:1.0.1.Final:dev (default-cli) @ cloudevent-player ---
Listening for transport dt_socket at address: 5005
2019-12-02 17:14:33,177 INFO [io.und.web.jsr] (main) UT026003: Adding annotated server endpoint class com.redhat.syseng.tools.cloudevents.resources.MessagesSocket for path /socket
2019-12-02 17:14:33,556 INFO [io.quarkus] (main) Quarkus 1.13.0.Final started in 2.161s. Listening on: http://0.0.0.0:8080
2019-12-02 17:14:33,556 INFO [io.quarkus] (main) Profile dev activated. Live Coding activated.
2019-12-02 17:14:33,556 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, mutiny, rest-client, resteasy, resteasy-jsonb, servlet, smallrye-context-propagation, vertx, websockets]
2022-06-24 18:51:43,172 INFO [io.und.websockets] (Quarkus Main Thread) UT026003: Adding annotated server endpoint class com.redhat.syseng.tools.cloudevents.resources.MessagesSocket for path /socket

2022-06-24 18:51:43,229 WARN [org.jbo.res.res.i18n] (Quarkus Main Thread) RESTEASY002155: Provider class io.cloudevents.http.restful.ws.CloudEventsProvider is already registered. 2nd registration is being ignored.
2022-06-24 18:51:43,513 INFO [io.quarkus] (Quarkus Main Thread) cloudevent-player 1.1-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 2.543s. Listening on: http://localhost:8080
2022-06-24 18:51:43,514 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-06-24 18:51:43,515 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx, websockets, websockets-client]


```

### Native build

Build

```shell script
mvn clean install -Pnative -Dquarkus.native.container-build=true
mvn clean install -Pnative
```

Run

```shell script
$ ./target/cloudevent-player-1.0-SNAPSHOT-runner
$ ./target/cloudevent-player-1.1-SNAPSHOT-runner -Dplayer.mode=LOCAL
...
2021-04-05 15:07:09,940 INFO [io.quarkus] (main) cloudevent-player 1.0-SNAPSHOT native (powered by Quarkus 1.13.0.Final) started in 0.016s. Listening on: http://0.0.0.0:8080
2021-04-05 15:07:09,940 INFO [io.quarkus] (main) Profile prod activated.
2021-04-05 15:07:09,940 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, mutiny, rest-client, resteasy, resteasy-jsonb, servlet, smallrye-context-propagation, vertx, websockets]
2021-04-05 15:07:12,937 INFO [com.red.sys.too.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode LOCAL - broker: http://localhost:8080/
2022-06-24 18:48:11,565 INFO [io.quarkus] (main) cloudevent-player 1.1-SNAPSHOT native (powered by Quarkus 2.15.0.Final) started in 0.022s. Listening on: http://0.0.0.0:8080
2022-06-24 18:48:11,565 INFO [io.quarkus] (main) Profile prod activated.
2022-06-24 18:48:11,565 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, vertx, websockets, websockets-client]
2022-06-24 18:48:17,028 INFO [com.red.sys.too.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode LOCAL - broker: http://localhost:8080/
```

### Skip frontend build
Expand All @@ -124,16 +130,8 @@ mvn clean package -PskipFrontend

## Build the container image

### JVM version

```shell script
podman build -t quay.io/ruben/cloudevents-player-jdk8:latest -f src/main/docker/Dockerfile.jvm .
```

### Native version

```shell script
podman build -t quay.io/ruben/cloudevents-player:latest -f src/main/docker/Dockerfile.native .
mvn package -Dcontainer
```

## Running CloudEvents Player on Kubernetes
Expand All @@ -145,10 +143,10 @@ podman build -t quay.io/ruben/cloudevents-player:latest -f src/main/docker/Docke

### Deploy the application

Use [deploy.yaml](./src/main/knative/deploy.yaml) to create the resources
Use [knative.yaml](deploy/knative.yaml) to create the resources

```shell script
$ kubectl apply -n myproject -f src/main/knative/deploy.yaml
$ kubectl apply -n myproject -f deploy/knative.yaml
service.serving.knative.dev/cloudevents-player created
trigger.eventing.knative.dev/cloudevents-player created
```
Expand All @@ -160,9 +158,39 @@ The following resources are created:

## Configuration

Cloudevents player comes with 2 modes defined in the PLAYER_MODE environment variable:
### Mode

* LOCAL: Received events are forwarded to the loopback broker. This mode is just for development and testing
* KNATIVE: The application will get the current namespace it is running in and will use the `PLAYER_BROKER`
Cloudevents-player comes with 2 modes defined in the PLAYER_MODE environment variable:

- LOCAL: Received events are forwarded to the loopback broker. This mode is just for development and testing
- KNATIVE (default): The application will get the current namespace it is running in and will use the `PLAYER_BROKER`
environment variable to decide which broker to connect to (`default` is the default broker).


```bash
# Local Mode
./target/cloudevent-player-1.1-SNAPSHOT-runner -Dplayer.mode=LOCAL

# Knative Mode
./target/cloudevent-player-1.1-SNAPSHOT-runner -Dplayer.mode=KNATIVE
```

### Broker URI

Sets the broker URI where the messages will be sent to. It will always be `localhost:8080` for `LOCAL` mode.
Overrides the name and namespace properties.

```bash
./target/cloudevent-player-1.1-SNAPSHOT-runner -Dplayer.mode=KNATIVE -Dbroker.uri=http://some-broker:1234
```

### Broker Name and Namespace

Define the broker name and namespace to guess the broker URI. The default broker name is `default` and the default
namespace will be the current namespace.

```bash
# The broker URL
./target/cloudevent-player-1.1-SNAPSHOT-runner -Dplayer.mode=KNATIVE -Dbroker.name=example -Dbroker.namespace=other
...
2022-06-24 19:08:53,681 INFO [com.red.sys.too.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode KNATIVE - broker: http://broker-ingress.knative-eventing.svc.cluster.local/other/example
```
2 changes: 1 addition & 1 deletion src/main/knative/deploy.yaml → deploy/knative.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
autoscaling.knative.dev/minScale: "1"
spec:
containers:
- image: quay.io/ruben/cloudevents-player:latest
- image: quay.io/ruben/cloudevents-player:v1.1
env:
- name: PLAYER_MODE
value: KNATIVE
Expand Down
Loading

0 comments on commit 33044fd

Please sign in to comment.