Skip to content

Commit c28db73

Browse files
GitHub Actionsjmagak
authored andcommitted
Building and Deploying Serverless Workflows
1 parent fe10ba4 commit c28db73

11 files changed

+106
-49
lines changed

assemblies/assembly-building-and-deploying-serverless-workflows.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ ifdef::context[]
77
[id="assembly-building-and-deploying-serverless-workflows"]
88
endif::[]
99
:context: orchestrator-rhdh
10-
= Building and deploying serverless workflows
10+
= Build and deploy serverless workflows
1111

12-
The Orchestrator provides a way to run workflows directly from {product-custom-resource-type} and {product}. This guide takes you through the lifecycle of running a workflow locally on your machine to having it deployed on a cluster and available in the Orchestrator plugin.
12+
The Orchestrator provides a way to run workflows directly from {product-custom-resource-type} and {product}. This guide details the full workflow lifecycle: moving a workflow from your local machine to deployment on a cluster, where it becomes available in the Orchestrator plugin.
1313

14-
The overall process involves the following main steps, which can often be accomplished from a single script:
14+
The overall process involves the following main steps, all of which can often be run using a single script:
1515

1616
* Building workflow images
1717
* Generating workflow manifests
@@ -23,6 +23,9 @@ include::modules/orchestrator/con-why-build-workflow-images.adoc[leveloffset=+1]
2323
// project structure
2424
include::modules/orchestrator/con-project-structure-overview.adoc[leveloffset=+2]
2525

26+
// creating and running workflows locally
27+
include::modules/orchestrator/proc-getting-started.adoc[leveloffset=+1]
28+
2629
// building locally and generating artifacts
2730
include::modules/orchestrator/proc-building-locally.adoc[leveloffset=+1]
2831

@@ -32,6 +35,9 @@ include::modules/orchestrator/con-build-sh-script-and-its-uses.adoc[leveloffset=
3235
// environment Variables supported by the script
3336
include::modules/orchestrator/con-environment-variables-supported-by-the-build-script.adoc[leveloffset=+2]
3437

38+
// required tools
39+
include::modules/orchestrator/con-required-tools.adoc[leveloffset=+2]
40+
3541
// building the 01_basic workflow
3642
include::modules/orchestrator/proc-building-the-01-basic-workflow.adoc[leveloffset=+2]
3743

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
:_mod-docs-content-type: CONCEPT
22

33
[id="con-build-sh-script-and-its-uses.adoc_{context}"]
4-
= Uses of the `build-sh` script and important flags
4+
= The `build-sh` script functionality and important flags
55

6-
The script does the following in the order provided here:
6+
The `build-sh` script does the following in order:
77

88
* Generates workflow manifests using the `kn-workflow` CLI.
99
* Builds the workflow image using `podman` or `docker`.
1010
* Optional: The script pushes the images to an image registry and deploys the workflow using `kubectl`.
1111

12-
You can check the help menu of the script as shown in the following example:
12+
By reviewing the script help menu, you can see the available flags and their functions:
1313

14-
.Script usage
1514
[source,bash]
1615
----
1716
./scripts/build.sh [flags]
@@ -22,13 +21,15 @@ The following flags are essential for running the script:
2221
[cols="1,3", options="header"]
2322
|===
2423
|Flag |Description
25-
|-i, --image (required) |Full image path, e.g. quay.io/orchestrator/demo:latest
26-
|-w, --workflow-directory |Workflow source directory (default: current directory)
27-
|-m, --manifests-directory |Where to save generated manifests
28-
|--push |Push the image to the registry
29-
|--deploy |Deploy the workflow
30-
|-h, --help |Show help message
24+
|`-i`, `--image` (required) |Full image path, for example, `quay.io/orchestrator/demo:latest`.
25+
|`-w`, `--workflow-directory` |Workflow source directory (default is the current directory).
26+
|`-m`, `--manifests-directory` |Where to save generated manifests.
27+
|`--push` |Push the image to the registry.
28+
|`--deploy` |Deploy the workflow.
29+
|`-h`, `--help` |Show the help message.
3130
|===
3231

3332
[TIP]
34-
The script also supports builder and runtime image overrides, namespace targeting, and persistence flags.
33+
====
34+
The script also supports builder and runtime image overrides, namespace targeting, and persistence flags.
35+
====
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:_mod-docs-content-type: PROCEDURE
1+
:_mod-docs-content-type: CONCEPT
22

33
[id="con-environment-variables-supported-by-the-build-script.adoc_{context}"]
4-
= Environment variables supported by the build script and required tools
4+
= Environment variables supported by the build script
55

66
The `build-sh` script supports the following environment variables to customize the workflow build process without modifying the script itself.
77

@@ -10,7 +10,7 @@ The `build-sh` script supports the following environment variables to customize
1010
The `QUARKUS_EXTENSIONS` variable specifies additional Quarkus extensions required by the workflow.
1111

1212
This variable takes the format of a comma-separated list of fully qualified extension IDs as shown in the following example:
13-
+
13+
1414
[source,yaml]
1515
----
1616
export QUARKUS_EXTENSIONS="io.quarkus:quarkus-smallrye-reactive-messaging-kafka"
@@ -22,19 +22,8 @@ Add Kafka messaging support or other integrations at build time.
2222

2323
The `MAVEN_ARGS_APPEND` variable appends additional arguments to the Maven build command.
2424
This variable takes the format of the string of Maven CLI arguments as shown in the following example:
25-
+
25+
2626
[source,yaml]
2727
----
2828
export MAVEN_ARGS_APPEND="-DmaxYamlCodePoints=35000000"
29-
----
30-
31-
.Required tools
32-
[cols="1,3", options="header"]
33-
|===
34-
|Tool |Conceptual Purpose
35-
|podman or docker |Container runtime required for building the workflow images.
36-
|kubectl |Kubernetes CLI
37-
|yq JSON |processor
38-
|curl, git, find, |which Shell utilities
39-
|kn-workflow |CLI for generating workflow manifests
40-
|===
29+
----

modules/orchestrator/con-generated-workflow-manifests.adoc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:_mod-docs-content-type: PROCEDURE
1+
:_mod-docs-content-type: CONCEPT
22

33
[id="con-generated-workflow-manifests.adoc_{context}"]
44
= Generated workflow manifests
@@ -18,7 +18,7 @@ Here is a quick overview of each of these manifests:
1818

1919
`00-secret_basic-secrets.yaml`::
2020
Contains secrets from `01_basic/src/main/resources/secret.properties`.
21-
Values are not required at this stage as you can set them later (after applying CRs or when using GitOps).
21+
Values are not required at this stage as you can set them later after applying CRs or when using GitOps.
2222

2323
[Important]
2424
====
@@ -31,7 +31,11 @@ Any change to this ConfigMap triggers an automatic Pod restart.
3131

3232
`02-configmap_01-basic-resources-schemas.yaml`::
3333
Contains JSON schemas from src/main/resources/schemas.
34-
Note: When using the GitOps profile, this ConfigMap (and similar ones like specs) does not need to be deployed.
34+
+
35+
[NOTE]
36+
====
37+
You do not need to deploy certain configuration resources when using the GitOps profile.
38+
====
3539

3640
`03-sonataflow_basic.yaml`::
3741
The SonataFlow custom resource (CR) that defines the workflow.
@@ -65,7 +69,6 @@ persistence:
6569
databaseSchema: basic
6670
----
6771

68-
If you need to connect to an external database, you must replace `serviceRef` with a `jdbcUrl`. See link:https://sonataflow.org/serverlessworkflow/latest/cloud/operator/enabling-jobs-service.html#_using_the_persistence_field_defined_in_the_sonataflowplatform_cr[SonataFlow Guides] for more information.
69-
here.
72+
If you must connect to an external database, replace `serviceRef` with a `jdbcUrl`. See the link:https://sonataflow.org/serverlessworkflow/latest/cloud/operator/enabling-jobs-service.html#_using_the_persistence_field_defined_in_the_sonataflowplatform_cr[SonataFlow Guides] for more information.
7073

71-
By default, all the manifests are generated without a namespace. You can specify a namespace to the script by the `--namespace` flag if you know the target namespace in advance. Otherwise, the namespace needs to be provided when applying the manifests to the cluster. See link:https://sonataflow.org/serverlessworkflow/latest/cloud/operator/configuring-workflows.html[Configuring Workflow Services].
74+
By default, the script generates all the manifests without a namespace. You can specify a namespace to the script by using the `--namespace` flag if you know the target namespace in advance. Otherwise, you must provide the namespace when applying the manifests to the cluster. See link:https://sonataflow.org/serverlessworkflow/latest/cloud/operator/configuring-workflows.html[Configuring workflow services].

modules/orchestrator/con-project-structure-overview.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ We focus on a *Quarkus project layout* (Maven project structure), specifically t
2929

3030
The main workflow resources are located under the `src/main/resources/` directory.
3131

32-
The structure of this project was generated using the `kn-workflow CLI`. For more information on the Quarkus project, see link:https://quarkus.io/guides/getting-started[Creating your first application].
32+
The `kn-workflow CLI` generated this project structure. You can try generating the structure yourself by following the _Getting Started guide_. For more information on the Quarkus project, see link:https://quarkus.io/guides/getting-started[Creating your first application].
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:_mod-docs-content-type: CONCEPT
2+
3+
[id="con-required-tools.adoc_{context}"]
4+
= Required tools
5+
6+
To run the `build-sh` script locally and manage the workflow lifecycle, you must install the following command-line tools:
7+
8+
[cols="1,3", options="header"]
9+
|===
10+
|Tool |Conceptual Purpose.
11+
|podman or docker |Container runtime required for building the workflow images.
12+
|`kubectl` |Kubernetes CLI.
13+
|`yq` |YAML processor.
14+
|`jq` |JSON processor.
15+
|`curl`, `git`, `find`, `which`| Shell utilities.
16+
|`kn-workflow` |CLI for generating workflow manifests.
17+
|===

modules/orchestrator/con-why-build-workflow-images.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[id="con-why-build-workflow-images.adoc_{context}"]
44
= Why build workflow images?
55

6-
While the OpenShift Serverless Logic Operator supports building workflows on the fly, this approach is primarily for experimentation. For production deployments, building images is preferred method due to the following reasons:
6+
While the OpenShift Serverless Logic Operator supports the building of workflows dynamically, this approach is primarily for experimentation. For production deployments, building images is the preferred method due to the following reasons:
77

88
* Production readiness: Prebuilt images can be scanned, secured, and tested before going live.
99
* GitOps compatibility: The Orchestrator relies on a central OpenShift Serverless Logic Operator instance to track workflows and their state. To use this tracking service, you must deploy workflows with the `gitops` profile, which expects a prebuilt image.

modules/orchestrator/proc-building-locally.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ cd orchestrator-demo
1717

1818
.Procedure
1919

20-
. You have cloned the project.
20+
. Clone the project.
2121

2222
. Check the help menu of the script:
2323
[source,yaml]
2424
----
2525
./scripts/build.sh --help
2626
----
2727

28-
. Execute the `build.sh` script, providing the required flags: image path (-i), workflow source directory (-w), and manifests output directory (-m).
28+
. Run the `build.sh` script, providing the required flags, for instance, the image path (`-i`), workflow source directory (`-w`), and manifests output directory (`-m`).
2929

3030
[IMPORTANT]
3131
====

modules/orchestrator/proc-building-the-01-basic-workflow.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[id="proc-building-the-01-basic-workflow.adoc_{context}"]
44
= Building the `01_basic` workflow
55

6-
To run the script from the root directory of the repository, use the `-w` flag to point to the workflow directory, and specify the output directory with `-m`.
6+
To run the script from the root directory of the repository, you must use the `-w` flag to point to the workflow directory. Additionally, specify the output directory with the `-m` flag.
77

88
.Prerequisites
99

modules/orchestrator/proc-deploying-workflows-on-a-cluster.adoc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[id="proc-deploying-workflows-on-a-cluster.adoc_{context}"]
44
= Deploying workflows on a cluster
55

6-
You can now deploy the workflow on a cluster, since the image has been pushed to the image registry and the deployment manifests are available.
6+
You can now deploy the workflow on a cluster, since the image has been pushed to the image registry and the deployment manifests have been made available.
77

88
.Prerequisites
99

@@ -14,7 +14,7 @@ You can now deploy the workflow on a cluster, since the image has been pushed to
1414
* OpenShift Serverless `v1.35`
1515
* OpenShift Serverless Logic `v1.35`
1616

17-
For further instructions on installing these components, see {orchestrator-book-link}#con-orchestrator-plugin-components[Orchestrator plugin components on {ocp-short}].
17+
For further instructions on installing these components, see the {orchestrator-book-link}#con-orchestrator-plugin-components[Orchestrator plugin components on {ocp-short}].
1818

1919
* You must apply the workflow manifests in a namespace that contains a `SonataflowPlatform` custom resource (CR), which manages the link:https://sonataflow.org/serverlessworkflow/latest/cloud/operator/supporting-services.html[supporting services]. By default, OpenShift Serverless Logic services are installed in the `sonataflow-infra` namespace.
2020

@@ -55,9 +55,7 @@ Caused by: io.quarkus.runtime.configuration.ConfigurationException: Failed to re
5555
+
5656
The error indicates a missing property: `quarkus.openapi-generator.notifications.auth.BearerToken.bearer-token`.
5757

58-
. In such a case where the logs show the `ConfigurationException: Failed to read configuration properties` error or indicate a missing value, complete the following tasks:
59-
+
60-
* Retrieve the ConfigMap as shown in the following example:
58+
. In such a case where the logs show the `ConfigurationException: Failed to read configuration properties` error or indicate a missing value, retrieve the ConfigMap as shown in the following example:
6159
+
6260
[source,yaml]
6361
----
@@ -71,13 +69,13 @@ The sample output looks as in the following example:
7169
apiVersion: v1
7270
data:
7371
application.properties: |
74-
# Backstage Notifications service
72+
# Backstage notifications service
7573
quarkus.rest-client.notifications.url=${BACKSTAGE_NOTIFICATIONS_URL}
7674
quarkus.openapi-generator.notifications.auth.BearerToken.bearer-token=${NOTIFICATIONS_BEARER_TOKEN}
7775
...
7876
----
7977
+
80-
The placeholders must be resolved using values provided using a Secret.
78+
Resolve the placeholders using values provided using a Secret.
8179

8280
. You must edit the corresponding Secret and provide appropriate base64-encoded values to resolve the placeholders in `application.properties` as shown in the following example:
8381
+
@@ -104,7 +102,7 @@ NAME READY STATUS RESTARTS AGE
104102
basic-f7c6ff455-grkxd 1/1 Running 0 47s
105103
----
106104

107-
. Once the pod is in the `Running` state, the workflow now appears in the Orchestrator plugin inside {product}.
105+
. Once the pod is in the `Running` state, the workflow now appears in the Orchestrator plugin inside the {product}.
108106

109107
.Next steps
110108
* Inspect the provided build script to extract the actual steps and implement them in your preferred CI/CD tool for example GitHub Actions, GitLab CI, Jenkins and Tekton.

0 commit comments

Comments
 (0)