Setup

This section provides guidance on how to set up your local computer to host a OpenShift Serverless Logic development environment.

It’s recommended to execute this section with a reliable connection. Avoid running this part of the lab together with other people because of the bandwidth required. Moreover, some tasks will take a long time to download resources.

Prerequisite tools

The following CLI tools are required for running the exercises in this tutorial. Please have them installed and configured before you get started with any of the tutorial chapters.

Tool Fedora MacOS Windows

git

dnf install -y git

Download

Download

Visual Studio Code

Download or Install from the provided USB Stick Resources

Download or Install from the provided USB Stick Resources

Download or Install from the provided USB Stick Resources

OpenJDK v11 or v17

dnf install -y java-17-openjdk-devel

Mac Version Download

Windows Download

Apache Maven

dnf install -y maven

Download

Download

podman

Check the detailed instructions below under the proper tab

If you have already installed Docker in your environment, or you feel more comfortable with it, feel free to replace Podman with Docker.

Instructions to install Podman and configure Quarkus (Testcontainer) to rely on it:

  • Fedora

  • Mac

  • Mac (Apple M1)

  • Windows

Issue the following commands:

sudo dnf install -y podman podman-docker
systemctl --user enable podman.socket --now

Configure Testcontainers through the following commands:

echo "docker.host = unix:///run/user/$(id -u)/podman/podman.sock" > ~/.testcontainers.properties
echo "ryuk.container.privileged = true" >>  ~/.testcontainers.properties

For more information and troubleshooting refer to https://quarkus.io/guides/podman#linux

Leverage Homebrew to install Podman and its required dependencies:

brew install podman

Create your Podman machine, set it to run rootful containers, then start it:

podman machine init
podman machine set --rootful
podman machine start

Configure Testcontainers through the following commands:

echo "ryuk.container.privileged = true" >  ~/.testcontainers.properties

Leverage Homebrew to install Podman and its required dependencies:

brew install podman

Create your Podman machine, set it to run rootful containers, then start it:

podman machine init
podman machine set --rootful
podman machine start

Add support for running x86_64-based containers on a Mac with an M1 chip with the following commands

podman machine ssh
sudo -i
rpm-ostree install qemu-user-static
systemctl reboot

Configure Testcontainers through the following commands:

echo "ryuk.container.privileged = true" >  ~/.testcontainers.properties

Before starting the Podman machine, set it to prefer rootful container execution:

podman machine set --rootful

USB Stick Resources

If you had no time to prepare upfront your environment, the lab instructors will provide you with a USB Stick to significantly reduce the network usage during the lab execution:

  1. Copy on your laptop the folder swf-lab, unplug the USB Stick, and pass it on to another attendee or the instructor.

  2. Load the images:

    podman image load --input swf-lab/oci-images-backup.tar
  3. Load the maven repository:

    cd ~
    tar xvzf swf-lab/m2-repository.tar.gz
  4. Install the Visual Studio Code using the provided binaries in the swf-lab folder

Visual Studio Code Extensions

Launch Visual Studio Code to install the following extensions:

  • Language Support for Java™ by Red Hat

  • Kogito Serverless Workflow Editor

  • REST Client (from Huachao Mao)

There are 2 ways:

  1. Click on the Extensions icon in the Activity Bar on the side of VS Code, search and install.

    extensions view icon
  2. Launch VS Code Quick Open (Ctrl+P), paste the following commands, and press enter:

    • ext install vscjava.vscode-java-pack

    • ext install redhat.vscode-extension-serverless-workflow-editor

    • ext install humao.rest-client

Configure Visual Studio Code

Open the Command Palette:

  • Hit F1 or select from the menu View > Command Palette…​

Type Pref and select Preferences: Open User Settings (JSON)

Add the following configuration key and close it:

"kogito.swf.svgFilePath": "${workspaceFolder}/src/main/resources/META-INF/processSVG/"
Add the comma as required by JSON rules (before or after depending on the key/value pair position)

Pull the serverless data index image

In order to run and test locally the Serverless Workflow project, you need the data index container image, it will be started behind the scene by Quarkus. However, since it’s distributed through the Red Hat official registry you have to login before pulling the image.

Find here the instruction on how to create / retrieve your credentials: Registry Authentication

Login to registry.redhat.io with your Red Hat credentials;

podman login registry.redhat.io

Pull the serverless data index image:

podman pull --platform linux/amd64 registry.redhat.io/openshift-serverless-1-tech-preview/logic-data-index-ephemeral-rhel8:1.25
The parameter --platform linux/amd64 is important when you run it on a Mac with an M1 chip (which has a different processor architecture)

Clone and build the startup project

Get your local copy of the start-up project:

Enter in the project folder and start Quarkus in dev mode.

cd order-swf
mvn quarkus:dev
The first time you launch maven on this project, it is going to take a considerable amount of time because it has to download all the dependencies from the Internet.