crw-quarkus-ocp

CodeReady and Quarkus In A Box

This repo is related to a slide deck and a series of videos that will guide the user through a workshop to achieve the following:

Prerequisites and Operating Environment

It is assumed that you have access to an OpenShift cluster.

This demo is operating system agnostic; you can use macOS, Linux or Windows, since you’ll be using a web browser exclusively.

Prepare for Quarkus in OpenShift with CodeReady Workspaces

Create cluster

  1. Create an OpenShift cluster
  2. Log into dashboard as administrator

Create a project for our workshop.

Now that we have a cluster and a project, we’re going to install some operators in the project, including CodeReady Workspaces.

Install AMQ Streams Operator from OperatorHub

Create Kafka Instance

“The host isn’t listed”

That’s because it may take a few minutes for the kafka instance to start. Wait a few minutes and reload the YAML. Repeat this until the host appears.

Example: my-cluster-kafka-bootstrap.openshift-operators.svc

Install CodeReady Workspaces from OperatorHub

Create Che Cluster

This will take several minutes.

If you get the “Application is not available” error, that means the CodeReady Workspaces installation isn’t 100 percent complete. Wait a bit a keep refreshing the browser until it is ready. It may take as long at ten minutes.

(That’s fine; this is a one-time setup. That is: Once you have CodeReady Workspaces up and running, your developers will not wait for it; it will always be only a URL away.)

Quarkus with CodeReady Workspaces

Now the hardest part of this demo: Creating the custom stack.

Create Java + Quarkus + odo stack

Creating a custom stack involves copying and pasting some JSON.

${CHE_HOST}/swagger/#!/stack/createStack

Create Java + Quarkus + odo workspace

After a few minutes, your workspace will be ready. IF YOU GET AN ERROR, simply click on the link supplied to try again.

Import Quarkus project from Github

Now that the workspace is running and open, we can import the project from Github.

Start Live Coding

See results in browser

*If the page does not display, wait a few seconds and refresh the browser. Continue this until you see a page similar to the following:

web app

Change code

Quarkus has a feature known as “Live Coding”, where the output will update in seconds as you code in CodeReady Workspaces.

Now that the code is running and generating events, we can change the code and Quarkus will, on-the-fly, update the results.

See results updated almost immediately

new axis

## Recap

In this demo/workshop, we have:

  1. Created a Kafka instance in OpenShift
  2. Created a CodeReady Workspaces (CRW) instance in OpenShift
  3. Created a Custom Stack in CRW.
  4. Created a Workspace in CRW using our Custom Stack.
  5. Imported a Github project into our workspace.
  6. Launched the Quarkus application from within CRW in a Live Coding environment.
  7. Altered the Quarkus application source code and viewed the instant results.