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:
-
Login in OpenShift from command line.
-
Create the
swf-shared
project:oc new-project swf-shared
-
Clone this repository.
-
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:
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
Follow this guide for the podman installation: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md
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 |
---|---|---|---|
|
|
||
Download or Install from the provided USB Stick Resources |
Download or Install from the provided USB Stick Resources |
||
OpenJDK v11 |
|
||
|
|
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:
-
Click on the Extensions icon in the Activity Bar on the side of VS Code, search and install.
-
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
-