Setup

There are several ways to develop on OpenShift Serverless Logic:

  • Pure Cloud: using Serverless Logic Web Tools and OpenShift as the runtime engine.

  • Browser with local runtime: using Serverless Logic Web Tools and kn-workflow command line (which leverages a local container engine, e.g. podman, docker)

  • Full-fledged local development workstation: using Visual Studio Code and Quarkus.

This tutorial suggests the first option to minimize the workstation preparation work.

Deploy the supplier microservice

As you progress through this tutorial, you’ll find out how to call an external OpenAPI, and the following Quarkus project will provide a simple API to call from within the workflow.

Deployment instructions:

  1. Login in OpenShift from command line.

  2. Create the swf-shared project:

    oc new-project swf-shared
  3. Clone this repository.

  4. Build and deploy the application:

    ./mvnw install -Pnative -Dquarkus.kubernetes.deploy=true

Local Runtime

kn-workflow is a handy tool for deploying your project in OpenShift, but it can also be used to run the workflow locally in a container (so you don’t need to configure Java and Quarkus).

Download the latest tar archive suitable for your environment, from the Serverless Logic download mirror page.

Podman Installation and configuration

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

Make sure that you have installed the 4.3.1 version or later, issuing podman --version:

podman version 4.3.1

Enable podman socket listener:

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

Make sure that you have installed the 4.3.1 version or later, issuing podman --version:

podman version 4.3.1

Install podman helper:

sudo /usr/local/Cellar/podman/4.3.1/bin/podman-mac-helper install

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

Make sure that you have installed the 4.3.1 version or later, issuing podman --version:

podman version 4.3.1

Install podman helper:

sudo /usr/local/Cellar/podman/4.3.1/bin/podman-mac-helper install

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

Make sure that you have installed the 4.3.1 version or later, issuing podman --version:

podman version 4.3.1

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

podman machine set --rootful

Pull the Serverless Workflow devmode image

In order to run and test the Serverless Workflow project locally, you need a container image which is lauched behind the scene by kn-workflow. However, as it’s distributed through the official Red Hat registry, you’ll need 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 image:

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

Prerequisite tools

It is recommended that you complete this section using a reliable connection. Avoid doing this part of the lab on a shared connection because of the bandwidth requirements. Also, some tasks will take a long time to download resources.

Here the tools to install:

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

dnf install -y java-11-openjdk-devel

Mac Version Download

Windows Download

Apache Maven

dnf install -y maven

Download

Download

Visual Studio Code Extensions

The remaining part of this tutorial does not need Visual Studio Code. However, if you prefer to use it, here you’ll find some directions.

Launch Visual Studio Code to install the following extensions:

  • KIE Serverless Workflow Editor

  • Language Support for Java™ by Red Hat - only required if you need to write Java code along with Serverless Workflow.

  • REST Client (from Huachao Mao) - this is optional but quite useful.

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 kie-group.swf-vscode-extension

    • ext install vscjava.vscode-java-pack

    • ext install humao.rest-client

Quarkus project

If you are interested in running the workflow within a Quarkus project: please, select another edition of this tutorial for detailed guidance.

At the bottom of the navigation bar, there is a drawer to select the tutorial edition.