wmedvede commented on code in PR #1839: URL: https://github.com/apache/incubator-kie-kogito-examples/pull/1839#discussion_r1419178554
########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/platforms/dataindex_platform/01-sonataflow_platform.yaml: ########## @@ -0,0 +1,16 @@ +apiVersion: sonataflow.org/v1alpha08 +kind: SonataFlowPlatform +metadata: + name: sonataflow-platform +spec: + build: +# kogito-swf-builder and kogito-swf-builder-nightly images already adds: +# kogito-addons-quarkus-events-process and kogito-addons-quarkus-process-management +# we shouldn't need to add them again, unless we want to protect from future changes on these images. +# template: +# buildArgs: +# - name: QUARKUS_EXTENSIONS +# value: org.kie.kogito:kogito-addons-quarkus-events-process:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-process-management:2.0.0-SNAPSHOT Review Comment: now that these extensions are provided by the default swf-builder this platform is providing no value. We can just remove it. I'll do the same in the techpreview2 corresponding usecase see: https://github.com/flows-examples/techpreview2/pull/9 ########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/README.md: ########## @@ -0,0 +1,415 @@ +# SonataFlow Data Index Use Cases + +Collection of artifacts to test SonataFlow Use Cases TP2. + +## Prereqs for all the use cases + +1. Minikube installed + +We recommend that you start Minikube with the following parameters, note that the `registry` addon must be enabled. + +```shell +minikube start --cpus 4 --memory 10240 --addons registry --addons metrics-server --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000" +``` + +To verify that the registry addon was property added you can execute this command: + +```shell +minikube addons list | grep registry +``` + +``` +| registry | minikube | enabled ✅ | Google | +| registry-aliases | minikube | disabled | 3rd party (unknown) | +| registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) | +``` + + +2. kubectl installed + +3. SonataFlow operator installed if workflows are deployed + +To install the operator you can see [SonataFlow Installation](https://sonataflow.org/serverlessworkflow/latest/cloud/operator/install-serverless-operator.html). + +## Use cases + +This is the list of available use cases: + +| Use case | Description | +|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Deploy Data Index Locally](#deploy-data-index-locally) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> | +| [Use case 1](#use-case-1) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> * The `greeting` workflow (no persistence) configured to register the process events on the Data Index Service. | +| [Use case 2](#use-case-2) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> * The `greeting` workflow (no persistence) <br/> * The `helloworkflow` (no persistence)<br/> * Workflows are configured to register the process events on the Data Index Service. | + +> **NOTE:** To facilitate the switch between use cases, it's strongly recommended to install each use case in a dedicated namespace. + +## Deploy Data Index locally + +Example of how to deploy Data Index on Kubernetes that uses a Postgresql DB. + +> **NOTE:** The workflow related use cases that needs a data index service already includes this step. + +### Procedure + +Open a terminal and run the following commands: + +1. Create the namespace: + +```shell +kubectl create namespace data-index-usecase +``` + +2. Deploy the Data Index Service: + +```shell +kubectl kustomize infra/dataindex | kubectl apply -f - -n data-index-usecase +``` + +``` +configmap/dataindex-properties-hg9ff8bff5 created +secret/postgres-secrets-22tkgc2dt7 created +service/data-index-service-postgresql created +service/postgres created +persistentvolumeclaim/postgres-pvc created +deployment.apps/data-index-service-postgresql created +deployment.apps/postgres created +``` + +This will deploy a Data Index for you in the `data-index-usecase` namespace. (If you don't use a namespace the `default` is used instead) +Data Index will be backed by a Postgres Data Base deployment. **This setup is not intended for production environments** since this simple Postgres Deployment does not scale well. Please see the [Postgres Operator](https://github.com/zalando/postgres-operator) for more information. + + +To check that the data index is running you can execute this command. + +```shell +kubectl get pod -n data-index-usecase +``` + +``` +data-index-service-postgresql-5d76dc4468-69hm6 1/1 Running 0 2m11s +postgres-7f78499688-j6282 1/1 Running 0 2m11s +``` + +To access the Data Index, using Minikube you can run: + +```shell +minikube service data-index-service-postgresql --url -n data-index-usecase +``` + +Example output: +``` +http://192.168.49.2:30352 +``` +The output is the Data Index URL, so you can access the GraphiQL UI by using a url like this http://192.168.49.2:30352/grpahiql/ (host and por might be different in your installation.) + +For more information about Data Index and this deployment see [Data Index standalone service](https://sonataflow.org/serverlessworkflow/latest/data-index/data-index-service.html) in SonataFlow guides. + +To execute queries see: [Querying Index Queries](#querying-data-index) + +3. Clean the use case: + +```shell +kubectl delete namespace data-index-usecase +``` + +## Use case 1 + +This use case is intended to represent an installation with: + +* A singleton Data Index Service with PostgreSQL persistence +* The `greeting` workflow (no persistence), that is configured to register events to the Data Index Service. + +### Procedure + +Open a terminal and run the following commands: + +1. Create the namespace: + +```shell +kubectl create namespace usecase1 +``` + +2. Deploy the Data Index Service: +```shell +kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase1 +``` + +``` +configmap/dataindex-properties-hg9ff8bff5 created +secret/postgres-secrets-22tkgc2dt7 created +service/data-index-service-postgresql created +service/postgres created +persistentvolumeclaim/postgres-pvc created +deployment.apps/data-index-service-postgresql created +deployment.apps/postgres created + +``` + +Give some time for the data index to start, you can check that it's running by executing. + +```shell +kubectl get pod -n usecase1 +``` + +``` +NAME READY STATUS RESTARTS AGE +data-index-service-postgresql-5d76dc4468-lb259 1/1 Running 0 2m11s +postgres-7f78499688-lc8n6 1/1 Running 0 2m11s +``` + +3. Deploy the workflow: + +```shell + kubectl kustomize usecases/usecase1 | kubectl apply -f - -n usecase1 + ``` + +``` +configmap/greeting-props created +sonataflow.sonataflow.org/greeting created +sonataflowplatform.sonataflow.org/sonataflow-platform created Review Comment: this line don't go anymore. ########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/README.md: ########## @@ -0,0 +1,415 @@ +# SonataFlow Data Index Use Cases + +Collection of artifacts to test SonataFlow Use Cases TP2. + +## Prereqs for all the use cases + +1. Minikube installed + +We recommend that you start Minikube with the following parameters, note that the `registry` addon must be enabled. + +```shell +minikube start --cpus 4 --memory 10240 --addons registry --addons metrics-server --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000" +``` + +To verify that the registry addon was property added you can execute this command: + +```shell +minikube addons list | grep registry +``` + +``` +| registry | minikube | enabled ✅ | Google | +| registry-aliases | minikube | disabled | 3rd party (unknown) | +| registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) | +``` + + +2. kubectl installed + +3. SonataFlow operator installed if workflows are deployed + +To install the operator you can see [SonataFlow Installation](https://sonataflow.org/serverlessworkflow/latest/cloud/operator/install-serverless-operator.html). + +## Use cases + +This is the list of available use cases: + +| Use case | Description | +|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Deploy Data Index Locally](#deploy-data-index-locally) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> | +| [Use case 1](#use-case-1) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> * The `greeting` workflow (no persistence) configured to register the process events on the Data Index Service. | +| [Use case 2](#use-case-2) | This use case deploys: <br/> * PostgreSQL Service<br/> * Data Index Service + postgresdb<br/> * The `greeting` workflow (no persistence) <br/> * The `helloworkflow` (no persistence)<br/> * Workflows are configured to register the process events on the Data Index Service. | + +> **NOTE:** To facilitate the switch between use cases, it's strongly recommended to install each use case in a dedicated namespace. + +## Deploy Data Index locally + +Example of how to deploy Data Index on Kubernetes that uses a Postgresql DB. + +> **NOTE:** The workflow related use cases that needs a data index service already includes this step. + +### Procedure + +Open a terminal and run the following commands: + +1. Create the namespace: + +```shell +kubectl create namespace data-index-usecase +``` + +2. Deploy the Data Index Service: + +```shell +kubectl kustomize infra/dataindex | kubectl apply -f - -n data-index-usecase +``` + +``` +configmap/dataindex-properties-hg9ff8bff5 created +secret/postgres-secrets-22tkgc2dt7 created +service/data-index-service-postgresql created +service/postgres created +persistentvolumeclaim/postgres-pvc created +deployment.apps/data-index-service-postgresql created +deployment.apps/postgres created +``` + +This will deploy a Data Index for you in the `data-index-usecase` namespace. (If you don't use a namespace the `default` is used instead) +Data Index will be backed by a Postgres Data Base deployment. **This setup is not intended for production environments** since this simple Postgres Deployment does not scale well. Please see the [Postgres Operator](https://github.com/zalando/postgres-operator) for more information. + + +To check that the data index is running you can execute this command. + +```shell +kubectl get pod -n data-index-usecase +``` + +``` +data-index-service-postgresql-5d76dc4468-69hm6 1/1 Running 0 2m11s +postgres-7f78499688-j6282 1/1 Running 0 2m11s +``` + +To access the Data Index, using Minikube you can run: + +```shell +minikube service data-index-service-postgresql --url -n data-index-usecase +``` + +Example output: +``` +http://192.168.49.2:30352 +``` +The output is the Data Index URL, so you can access the GraphiQL UI by using a url like this http://192.168.49.2:30352/grpahiql/ (host and por might be different in your installation.) + +For more information about Data Index and this deployment see [Data Index standalone service](https://sonataflow.org/serverlessworkflow/latest/data-index/data-index-service.html) in SonataFlow guides. + +To execute queries see: [Querying Index Queries](#querying-data-index) + +3. Clean the use case: + +```shell +kubectl delete namespace data-index-usecase +``` + +## Use case 1 + +This use case is intended to represent an installation with: + +* A singleton Data Index Service with PostgreSQL persistence +* The `greeting` workflow (no persistence), that is configured to register events to the Data Index Service. + +### Procedure + +Open a terminal and run the following commands: + +1. Create the namespace: + +```shell +kubectl create namespace usecase1 +``` + +2. Deploy the Data Index Service: +```shell +kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase1 +``` + +``` +configmap/dataindex-properties-hg9ff8bff5 created +secret/postgres-secrets-22tkgc2dt7 created +service/data-index-service-postgresql created +service/postgres created +persistentvolumeclaim/postgres-pvc created +deployment.apps/data-index-service-postgresql created +deployment.apps/postgres created + +``` + +Give some time for the data index to start, you can check that it's running by executing. + +```shell +kubectl get pod -n usecase1 +``` + +``` +NAME READY STATUS RESTARTS AGE +data-index-service-postgresql-5d76dc4468-lb259 1/1 Running 0 2m11s +postgres-7f78499688-lc8n6 1/1 Running 0 2m11s +``` + +3. Deploy the workflow: + +```shell + kubectl kustomize usecases/usecase1 | kubectl apply -f - -n usecase1 + ``` + +``` +configmap/greeting-props created +sonataflow.sonataflow.org/greeting created +sonataflowplatform.sonataflow.org/sonataflow-platform created +``` + +Give some time for the sonataflow operator to build and deploy the workflow. +To check that the workflow is ready you can use this command. + +```shell +kubectl get workflow -n usecase1 +``` + +``` +NAME PROFILE VERSION URL READY REASON +greeting 0.0.1 True +``` + +4. Expose the workflow and get the url: + +```shell +kubectl patch svc greeting -p '{"spec": {"type": "NodePort"}}' -n usecase1 +``` + +```shell + minikube service greeting --url -n usecase1 + ``` + +5. Create a workflow instance: + +You must use the URLs calculated in step 4. + +```shell +curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' http://192.168.49.2:32407/greeting +``` + +**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index) + + +6. Clean the use case: + +```shell +kubectl delete namespace usecase1 +``` + +## Use case 2 + +This use case is intended to represent an installation with: + +* A singleton Data Index Service with PostgreSQL persistence +* The `greeting` workflow (no persistence) +* The `helloworkflow` workflow (no persistence) +* The workflows are configured to register the process events on the Data Index Service. + +### Procedure + +Open a terminal and run the following commands: + +1. Create the namespace: + +```shell +kubectl create namespace usecase2 +``` + +2. Deploy the Data Index Service: +```shell +kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase2 +``` + +``` +configmap/dataindex-properties-hg9ff8bff5 created +secret/postgres-secrets-22tkgc2dt7 created +service/data-index-service-postgresql created +service/postgres created +persistentvolumeclaim/postgres-pvc created +deployment.apps/data-index-service-postgresql created +deployment.apps/postgres created + +``` + +Give some time for the data index to start, you can check that it's running by executing. + +```shell +kubectl get pod -n usecase2 +``` + +``` +NAME READY STATUS RESTARTS AGE +data-index-service-postgresql-5d76dc4468-lb259 1/1 Running 0 2m11s +postgres-7f78499688-lc8n6 1/1 Running 0 2m11s +``` + +3. Deploy the workflows: + +```shell + kubectl kustomize usecases/usecase2 | kubectl apply -f - -n usecase2 + ``` + +``` +configmap/greeting-props created +configmap/helloworld-props created +sonataflow.sonataflow.org/greeting created +sonataflow.sonataflow.org/helloworld created +sonataflowplatform.sonataflow.org/sonataflow-platform created Review Comment: this line don't go anymore ########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/usecases/usecase1/kustomization.yaml: ########## @@ -0,0 +1,4 @@ +resources: +- ../../platforms/dataindex_platform Review Comment: see: https://github.com/flows-examples/techpreview2/pull/9 ########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/platforms/dataindex_platform/kustomization.yaml: ########## @@ -0,0 +1,2 @@ +resources: +- 01-sonataflow_platform.yaml Review Comment: same here, this kustomization.yaml don't apply anymore see: https://github.com/flows-examples/techpreview2/pull/9 ########## serverless-operator-examples/serverless-workflow-dataindex-use-cases/usecases/usecase2/kustomization.yaml: ########## @@ -0,0 +1,5 @@ +resources: +- ../../platforms/dataindex_platform Review Comment: see: https://github.com/flows-examples/techpreview2/pull/9 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
