• Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    CSS
  • License
    Apache License 2.0
  • Created almost 3 years ago
  • Updated 29 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quarkus sample application - Super Heroes

Quarkus Superheroes Sample

Table of Contents

Introduction

This is a sample application demonstrating Quarkus features and best practices. The application allows superheroes to fight against supervillains. The application consists of several microservices, communicating either synchronously via REST or asynchronously using Kafka. All the data used by the applications are on the characterdata branch of this repository.

The base JVM version for all the applications is Java 17.

Here is an architecture diagram of the application: Superheroes architecture diagram

The main UI allows you to pick one random Hero and Villain by clicking on New Fighters. Then, click Fight! to start the battle. The table at the bottom shows the list of previous fights. Fight screen

Running Locally via Docker Compose

Pre-built images for all of the applications in the system can be found at quay.io/quarkus-super-heroes.

Pick one of the 4 versions of the application from the table below and execute the appropriate docker compose command from the quarkus-super-heroes directory.

NOTE: You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine.

There is a watch-services.sh script that can be run in a separate terminal that will watch the startup of all the services and report when they are all up and ready to serve requests.

Run scripts/watch-services.sh -h for details about it's usage.

Description Image Tag Docker Compose Run Command Docker Compose Run Command with Monitoring
JVM Java 17 java17-latest docker compose -f deploy/docker-compose/java17.yml up --remove-orphans docker compose -f deploy/docker-compose/java17.yml -f deploy/docker-compose/monitoring.yml up --remove-orphans
Native native-latest docker compose -f deploy/docker-compose/native.yml up --remove-orphans docker compose -f deploy/docker-compose/native.yml -f deploy/docker-compose/monitoring.yml up --remove-orphans

NOTE: If your system does not have the compose sub-command, you can try the above commands with the docker-compose command instead of docker compose.

Once started the main application will be exposed at http://localhost:8080. If you want to watch the Event Statistics UI, that will be available at http://localhost:8085. The Apicurio Registry will be available at http://localhost:8086.

If you launched the monitoring stack, Prometheus will be available at http://localhost:9090 and Jaeger will be available at http://localhost:16686.

Deploying to Kubernetes

Pre-built images for all of the applications in the system can be found at quay.io/quarkus-super-heroes.

Deployment descriptors for these images are provided in the deploy/k8s directory. There are versions for OpenShift, Minikube, Kubernetes, and KNative.

The only real difference between the Minikube and Kubernetes descriptors is that all the application Services in the Minikube descriptors use type: NodePort so that a list of all the applications can be obtained simply by running minikube service list.

NOTE: If you'd like to deploy each application directly from source to Kubernetes, please follow the guide located within each application's folder (i.e. event-statistics, rest-fights, rest-heroes, rest-villains).

Routing

Both the Minikube and Kubernetes descriptors also assume there is an Ingress Controller installed and configured. There is a single Ingress in the Minikube and Kubernetes descriptors denoting / and /api/fights paths. You may need to add/update the host field in the Ingress as well in order for things to work.

Both the ui-super-heroes and the rest-fights applications need to be exposed from outside the cluster. On Minikube and Kubernetes, the ui-super-heroes Angular application communicates back to the same host and port as where it was launched from under the /api/fights path. See the routing section in the UI project for more details.

On OpenShift, the URL containing the ui-super-heroes host name is replaced with rest-fights. This is because the OpenShift descriptors use Route objects for gaining external access to the application. In most cases, no manual updating of the OpenShift descriptors is needed before deploying the system. Everything should work as-is.

Additionally, there is also a Route for the event-statistics application. On Minikube or Kubernetes, you will need to expose the event-statistics application, either by using an Ingress or doing a kubectl port-forward. The event-statistics application runs on port 8085.

Versions

Pick one of the 4 versions of the system from the table below and deploy the appropriate descriptor from the deploy/k8s directory. Each descriptor contains all of the resources needed to deploy a particular version of the entire system.

NOTE: These descriptors are NOT considered to be production-ready. They are basic enough to deploy and run the system with as little configuration as possible. The databases, Kafka broker, and schema registry deployed are not highly-available and do not use any Kubernetes operators for management or monitoring. They also only use ephemeral storage.

For production-ready Kafka brokers, please see the Strimzi documentation for how to properly deploy and configure production-ready Kafka brokers on Kubernetes. You can also try out a fully hosted and managed Kafka service!

For a production-ready Apicurio Schema Registry, please see the Apicurio Registry Operator documentation. You can also try out a fully hosted and managed Schema Registry service!

Description Image Tag OpenShift Descriptor Minikube Descriptor Kubernetes Descriptor KNative Descriptor
JVM Java 17 java17-latest java17-openshift.yml java17-minikube.yml java17-kubernetes.yml java17-knative.yml
Native native-latest native-openshift.yml native-minikube.yml native-kubernetes.yml native-knative.yml

Monitoring

There are also Kubernetes deployment descriptors for monitoring with OpenTelemetry, Prometheus, and Jaeger in the deploy/k8s directory (monitoring-openshift.yml, monitoring-minikube.yml, monitoring-kubernetes.yml). Each descriptor contains the resources necessary to monitor and gather metrics and traces from all of the applications in the system. Deploy the appropriate descriptor to your cluster if you want it.

The OpenShift descriptor will automatically create Routes for Prometheus and Jaeger. On Kubernetes/Minikube you may need to expose the Prometheus and Jaeger services in order to access them from outside your cluster, either by using an Ingress or by using kubectl port-forward. On Minikube, the Prometheus and Jaeger Services are also exposed as a NodePort.

NOTE: These descriptors are NOT considered to be production-ready. They are basic enough to deploy Prometheus, Jaeger, and the OpenTelemetry Collector with as little configuration as possible. They are not highly-available and does not use any Kubernetes operators for management or monitoring. They also only uses ephemeral storage.

For production-ready Prometheus instances, please see the Prometheus Operator documentation for how to properly deploy and configure production-ready instances.

For production-ready Jaeger instances, please see the Jaeger Operator documentation for how to properly deploy and configure production-ready instances.

For production-ready OpenTelemetry Collector instances, please see the OpenTelemetry Operator documentation for how to properly deploy and configure production-ready instances.

Jaeger

By now you've performed a few battles, so let's analyze the telemetry data. Open the Jaeger UI based on how you are running the system, either through Docker Compose or by deploying the monitoring stack to kubernetes.

Jaeger Filters

Now, let's analyze the traces for when requesting new fighters. When clicking the New Fighters button in the Superheroes UI, the browser makes an HTTP request to the /api/fights/randomfighters endpoint within the rest-fights application. In the Jaeger UI, select rest-fights for the Service and /api/fights/randomfighters for the Operation, then click Find Traces. You should see all the traces corresponding to the request of getting new fighters.

Jaeger Filters

Then, select one trace. A trace consists of a series of spans. Each span is a time interval representing a unit of work. Spans can have a parent/child relationship and form a hierarchy. You can see that each trace contains 14 total spans: six spans in the rest-fights application, four spans in the rest-heroes application, and four spans in the rest-villains application. Each trace also provides the total round-trip time of the request into the /api/fights/randomfighters endpoint within the rest-fights application and the total time spent within each unit of work.

Jaeger Filters

More Repositories

1

quarkus

Quarkus: Supersonic Subatomic Java.
Java
13,620
star
2

quarkus-quickstarts

Quarkus quickstart code
Java
1,949
star
3

quarkus-workshops

Hosts Quarkus related workshops
HTML
178
star
4

quarkusio.github.io

Website for Quarkus project
HTML
160
star
5

quarkus-platform

Quarkus Platform aggregates extensions from Quarkus Core and those developed by the community into a single compatible and versioned set that application developers can reference from their applications to align the dependency versions
Java
119
star
6

code.quarkus.io

Code Quarkus - Start coding with Quarkus
Java
117
star
7

quarkus-images

Set of container images delivered for Quarkus
Java
115
star
8

gizmo

Java
50
star
9

qson

QSON is an object to JSON mapper
Java
32
star
10

quarkus-http

Java
31
star
11

ja.quarkus.io

Japanese localization project for https://github.com/quarkusio/quarkusio.github.io
HTML
27
star
12

quarkus-github-bot

A Quarkus-powered GitHub App to simplify issues and pull requests management in the Quarkus project.
Java
24
star
13

quarkus-ecosystem-ci

Repository used for orchestrating cross-CI builds of extensions part of Quarkiverse - Quarkus ecosystem of extensions.
Shell
23
star
14

cn.quarkus.io

(in-progress) Chinese localization project for https://github.com/quarkusio/quarkusio.github.io
HTML
16
star
15

pt.quarkus.io

Portuguese Brazilian localization project for https://github.com/quarkusio/quarkusio.github.io
HTML
15
star
16

virtual-threads-demos

A set of Quarkus applications utilizing virtual threads
Java
15
star
17

quarkus-extension-catalog

Quarkus Extension Catalog
Shell
13
star
18

registry.quarkus.io

Quarkus Extension Registry application
Java
10
star
19

quarkus-updates

OpenRewrite recipes to update Quarkus projects
Java
10
star
20

todo-demo-app

JavaScript
9
star
21

quarkus-buildpacks

Shell
9
star
22

quarkus-platform-bom-generator

Quarkus platform BOM generating tools
Java
9
star
23

es.quarkus.io

(incubating) Spanish localization project for https://github.com/quarkusio/quarkusio.github.io
HTML
8
star
24

quarkus-insights

Java
7
star
25

jbang-catalog

Collection of JBang scripts related to Quarkus and its subprojects
Java
7
star
26

quarkus-github-lottery

A Quarkus-powered application that regularly sends short lists of GitHub issues for triagers/maintainers to consider
Java
6
star
27

quarkus-security

The Quarkus core security implementation
Java
6
star
28

extensions

The source of https://quarkus.io/extensions
JavaScript
6
star
29

quarkus-web-lab

CMS with a Markdown Editor and comments
Java
6
star
30

quarkus-backports

Backporting Application for the Quarkus Project
Java
5
star
31

qute

Qute has been included in the main Quarkus repository.
Java
5
star
32

qlue

Quarkus Qlue, the step wiring framework
Java
4
star
33

quarkus-spring-data-api

Java
4
star
34

quarkus-spring-api

Extract of the Spring APIs used by the Quarkus Spring compatibility layer
Java
4
star
35

quarkus-langchain4j-workshop

Quarkus Langchain4J Workshop
Java
4
star
36

status.quarkus.io

Application centralizing the status of the Quarkus project
Java
3
star
37

homebrew-tap

Ruby
2
star
38

chocolatey-bucket

Chocolatey manifests for Quarkus CLI
PowerShell
2
star
39

search.quarkus.io

Search backend for Quarkus websites
Java
2
star
40

resteasy-reactive-testsuite

Java
2
star
41

quarkus-devtools-compat

repo to test cross version compatabiilty of Quarkus dev tools (cli, build plugins etc)
Java
2
star
42

conversational-release-action

Release Quarkus by conversing with a GitHub Action
Java
2
star
43

quarkus-spring-boot-api

Java
2
star
44

action-build-reporter

A GitHub action posting a build report in the job summary
Java
2
star
45

quarkus-fs-util

Utility classes to work efficiently with the FileSystem API
Java
1
star
46

quarkus-router

A lightweight Netty based HTTP router to allow different Netty based HTTP frameworks to share a socket
Java
1
star
47

quarkus-upstream-roadmap

Used to import upstream issues and track them in the organization roadmap
1
star
48

opentracing-quickstart-migration

HTML
1
star
49

quarkus-release

Release scripts for Quarkus
Java
1
star
50

action-helpers

Various GitHub Actions helping with the Quarkus project
Java
1
star
51

quarkus-keycloak-adapter

A temporary keycloak adaptor for quarkus-http
Java
1
star
52

get-contributors

Extract contributors from the Quarkus repositories
Java
1
star
53

build-reporter

Build reporting tools composed of a Maven extension and a build reporter consumable by Quarkus GitHub Apps and Quarkus GitHub Actions.
Java
1
star
54

quarkus-spring-security-api

Java
1
star
55

quarkus-kafka-broker-image

A container image exposing a Kafka broker suitable for the Quarkus Dev Services
1
star
56

quarkus-zulip-bot

Quarkus Zulip Bot
Java
1
star
57

monitor-artifact-publication-action

Monitor artifact publication to Maven Central
Java
1
star