pefernan commented on code in PR #1979: URL: https://github.com/apache/incubator-kie-kogito-examples/pull/1979#discussion_r1675438790
########## kogito-quarkus-examples/process-instance-migration-quarkus/README.md: ########## @@ -0,0 +1,278 @@ +# Process Instance Migration (PIM) example + +## Description + +This example showcases the Process Instance Migration (PIM) functionality. This feature can be used to migrate +active process instances from one process definition (v1) to another (v2). + +This example is using the *Compact Architecture* that is based on simplified communication among the different +*Kogito* services without the need of events (Kafka/HTTP) between them. Note that this design choice is unrelated +to the Process Instance Migration functionality. + +## The test processes + +### The original BPMN Process + +<div style="text-align:center"> + <figure> + <img width=75% src="docs/images/simple.png" alt="Simple Process Diagram"> + <figcaption>Simple Process Diagram</figcaption> + </figure> +</div> + +The process follows a very basic design with two script tasks and a catching signal event in between to act as a wait state. + +<div style="text-align:center"> + <figure> + <img width=75% src="docs/images/modified.png" alt="Modified Process Diagram"> + <figcaption>Modified Process Diagram</figcaption> + </figure> +</div> + +The modified version of this simple process has own additional script task **after** the wait state. + + +## Running the example +### Prerequisites + +* Java 17+ installed +* Environment variable JAVA_HOME set accordingly +* Maven 3.9.3+ installed +* Docker and Docker Compose to run the required example infrastructure. + +And when using native image compilation, you will also need: +- GraalVM 20.3+ installed +- Environment variable GRAALVM_HOME set accordingly +- GraalVM native image needs as well native-image extension: https://www.graalvm.org/reference-manual/native-image/ +- Note that GraalVM native image compilation typically requires other packages (glibc-devel, zlib-devel and gcc) to be installed too, please refer to GraalVM installation documentation for more details. + +### Infrastructure Services + +This quickstart provides a docker compose template that starts all the required services. This setup ensures that all services are connected with a default configuration. + +- PostgreSQL: 5432 +- Data Index: 8180 Review Comment: @martinweiler shouldn't we be using the compact setup? ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml: ########## @@ -0,0 +1,83 @@ +version: '3' + +services: + postgres: + container_name: postgres + image: postgres:16.1-alpine3.19 + profiles: [ "infra", "example", "full" ] + ports: + - "5432:5432" + volumes: + - ./sql:/docker-entrypoint-initdb.d:Z + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-d", "kogito", "-U", "kogito-user" ] + timeout: 45s + interval: 10s + retries: 50 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:8.2 + profiles: [ "infra", "example", "full" ] + ports: + - 8055:80 + depends_on: + - postgres + volumes: + - ./pgadmin/servers.json:/pgadmin4/servers.json + - ./pgadmin/pgpass:/pgadmin4/pgpass + entrypoint: > + /bin/sh -c " + cp -f /pgadmin4/pgpass /var/lib/pgadmin/; + chmod 600 /var/lib/pgadmin/pgpass; + /entrypoint.sh + " + environment: + PGADMIN_DEFAULT_EMAIL: [email protected] + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: 'False' + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False' + GUNICORN_ACCESS_LOGFILE: '/dev/null' + + data-index: Review Comment: No needed with compact setup ########## kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/addedtask-svg.svg: ########## Review Comment: We may not need this if we don't have consoles ########## kogito-quarkus-examples/process-instance-migration-quarkus/pom.xml: ########## @@ -0,0 +1,214 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.kie.kogito.examples</groupId> + <artifactId>kogito-quarkus-examples</artifactId> + <version>999-SNAPSHOT</version> + </parent> + <artifactId>process-instance-migration-quarkus</artifactId> + <name>Kogito Example :: Process Instance Migration Quarkus</name> + <description>Process Instance Migration example - Quarkus</description> + <properties> + <quarkus-plugin.version>3.8.4</quarkus-plugin.version> + <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> + <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> + <quarkus.platform.version>3.8.4</quarkus.platform.version> + <kogito.bom.group-id>org.kie.kogito</kogito.bom.group-id> + <kogito.bom.artifact-id>kogito-bom</kogito.bom.artifact-id> + <kogito-apps.bom.artifact-id>kogito-apps-bom</kogito-apps.bom.artifact-id> + <version.org.kie.kogito>999-SNAPSHOT</version.org.kie.kogito> + </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>${quarkus.platform.group-id}</groupId> + <artifactId>${quarkus.platform.artifact-id}</artifactId> + <version>${quarkus.platform.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>${kogito.bom.group-id}</groupId> + <artifactId>${kogito.bom.artifact-id}</artifactId> + <version>${version.org.kie.kogito}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>${kogito.bom.group-id}</groupId> + <artifactId>${kogito-apps.bom.artifact-id}</artifactId> + <version>${version.org.kie.kogito}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy-jackson</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-smallrye-openapi</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-smallrye-health</artifactId> + </dependency> + + <dependency> + <groupId>org.jbpm</groupId> + <artifactId>jbpm-with-drools-quarkus</artifactId> + </dependency> + + <dependency> + <groupId>org.jbpm</groupId> + <artifactId>jbpm-quarkus</artifactId> + </dependency> + + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-process-management</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kogito-addons-quarkus-jobs-management</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-process-svg</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-source-files</artifactId> + </dependency> + + <!-- Persistence --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-jdbc-postgresql</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-agroal</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-persistence-jdbc</artifactId> + </dependency> + + <!-- Data Index Persistence --> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kogito-addons-quarkus-data-index-persistence-postgresql</artifactId> Review Comment: Change this to the data-index component ```suggestion <artifactId>kogito-addons-quarkus-data-index-postgresql</artifactId> ``` ########## kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties: ########## @@ -0,0 +1,49 @@ +# Packaging +#quarkus.package.type=fast-jar + +#https://quarkus.io/guides/openapi-swaggerui +quarkus.http.cors=true +quarkus.smallrye-openapi.path=/docs/openapi.json +quarkus.swagger-ui.always-include=true +quarkus.kogito.data-index.graphql.ui.always-include=true +quarkus.http.test-port=0 + +# Kogito-service +kogito.service.url=http://localhost:8080 + +#Job-service +kogito.jobs-service.url=http://localhost:8080 + +# to be reachable from the container running job-service +kogito.dataindex.http.url=http://localhost:8180 Review Comment: ```suggestion kogito.dataindex.http.url=http://localhost:8080 ``` ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/README.md: ########## @@ -0,0 +1,49 @@ +# Kogito and Infrastructure services + +To allow a quick setup of all services required to run this demo, we provide a docker compose template that starts the following services: +- Postgresql +- PgAdmin +- Kogito Data Index +- Kogito Process Instance Migration Service (Only available if the example has been compiled using the `container` mvn profile eg: ```mvn cleanp package -Dcontainer```) + +The docker compose template provides three profiles to enable starting only the set of services you want to use. The profiles are: +- **infra**: Starts only the minimal infrastructure to run the example (Postgresql, pgadmin, Kogito Data Index) +- **example**: Starts the services in *infra* profile and the Kogito Example Service. Requires the example to be compiled using the `container` mvn profile eg: ```mvn cleanp package -Dcontainer```. + +> NOTE: In order to use it, please ensure you have Docker Compose installed on your machine, otherwise follow the instructions available +in [here](https://docs.docker.com/compose/install/). + +## Starting the services + +Use the `startServices.sh` passing the docker profile you want to use as an argument. If no profile is provided the script will default to **full**. + +Eg: +```shell +sh startServices.sh example +``` + +Once the services are started (depending on the profile), the following ports will be assigned on your local machine: +- Postgresql: 5432 +- PgAdmin: 8055 +- Kogito Data Index: 8180 Review Comment: Not needed ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/sql/init.sql: ########## @@ -0,0 +1,33 @@ +CREATE ROLE "kogito-user" WITH + LOGIN + SUPERUSER + INHERIT + CREATEDB + CREATEROLE + NOREPLICATION + PASSWORD 'kogito-pass'; + +CREATE DATABASE kogito + WITH + OWNER = "kogito-user" + ENCODING = 'UTF8' + LC_COLLATE = 'en_US.utf8' + LC_CTYPE = 'en_US.utf8' + TABLESPACE = pg_default + CONNECTION LIMIT = -1; + +CREATE DATABASE keycloak + WITH + OWNER = "kogito-user" + ENCODING = 'UTF8' + LC_COLLATE = 'en_US.utf8' + LC_CTYPE = 'en_US.utf8' + TABLESPACE = pg_default + CONNECTION LIMIT = -1; + +GRANT ALL PRIVILEGES ON DATABASE postgres TO "kogito-user"; +GRANT ALL PRIVILEGES ON DATABASE kogito TO "kogito-user"; +GRANT ALL PRIVILEGES ON DATABASE kogito TO postgres; + +GRANT ALL PRIVILEGES ON DATABASE keycloak TO "kogito-user"; Review Comment: same ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/sql/init.sql: ########## @@ -0,0 +1,33 @@ +CREATE ROLE "kogito-user" WITH + LOGIN + SUPERUSER + INHERIT + CREATEDB + CREATEROLE + NOREPLICATION + PASSWORD 'kogito-pass'; + +CREATE DATABASE kogito + WITH + OWNER = "kogito-user" + ENCODING = 'UTF8' + LC_COLLATE = 'en_US.utf8' + LC_CTYPE = 'en_US.utf8' + TABLESPACE = pg_default + CONNECTION LIMIT = -1; + +CREATE DATABASE keycloak Review Comment: Not needed if we don't have consoles ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml: ########## @@ -0,0 +1,83 @@ +version: '3' + +services: + postgres: + container_name: postgres + image: postgres:16.1-alpine3.19 + profiles: [ "infra", "example", "full" ] + ports: + - "5432:5432" + volumes: + - ./sql:/docker-entrypoint-initdb.d:Z + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-d", "kogito", "-U", "kogito-user" ] + timeout: 45s + interval: 10s + retries: 50 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:8.2 + profiles: [ "infra", "example", "full" ] + ports: + - 8055:80 + depends_on: + - postgres + volumes: + - ./pgadmin/servers.json:/pgadmin4/servers.json + - ./pgadmin/pgpass:/pgadmin4/pgpass + entrypoint: > + /bin/sh -c " + cp -f /pgadmin4/pgpass /var/lib/pgadmin/; + chmod 600 /var/lib/pgadmin/pgpass; + /entrypoint.sh + " + environment: + PGADMIN_DEFAULT_EMAIL: [email protected] + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: 'False' + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False' + GUNICORN_ACCESS_LOGFILE: '/dev/null' + + data-index: + container_name: data-index + image: quay.io/kiegroup/kogito-data-index-postgresql-nightly:${KOGITO_VERSION} + profiles: [ "infra", "example", "full" ] + ports: + - "8180:8080" + depends_on: + postgres: + condition: service_healthy + environment: + QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_USERNAME: kogito-user + QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + KOGITO_DATA_INDEX_QUARKUS_PROFILE: "http-events-support" + extra_hosts: + - "${DOCKER_GATEWAY_HOST}:host-gateway" + + kogito-process-instance-migration-service: + container_name: kogito-process-instance-migration-service + image: dev.local/${USER}/kogito-process-instance-migration-service:1.0-SNAPSHOT + profiles: ["example", "full"] + ports: + - "8080:8080" + depends_on: + data-index: + condition: service_started + environment: + QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_REACTIVE_URL: "postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_USERNAME: kogito-user + QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_DATASOURCE_DB_KIND: postgresql + KOGITO_JOBS_SERVICE_URL: http://${DOCKER_GATEWAY_HOST}:8080 + KOGITO_SERVICE_URL: http://${DOCKER_GATEWAY_HOST}:8080 + KOGITO_DATAINDEX_HTTP_URL: http://${DOCKER_GATEWAY_HOST}:8180 Review Comment: ```suggestion KOGITO_DATAINDEX_HTTP_URL: http://${DOCKER_GATEWAY_HOST}:8080 ``` ########## kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/resources/index.html: ########## @@ -0,0 +1,150 @@ +<!-- Review Comment: Do we need this page? ########## kogito-quarkus-examples/process-instance-migration-quarkus/pom.xml: ########## @@ -0,0 +1,214 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.kie.kogito.examples</groupId> + <artifactId>kogito-quarkus-examples</artifactId> + <version>999-SNAPSHOT</version> + </parent> + <artifactId>process-instance-migration-quarkus</artifactId> + <name>Kogito Example :: Process Instance Migration Quarkus</name> + <description>Process Instance Migration example - Quarkus</description> + <properties> + <quarkus-plugin.version>3.8.4</quarkus-plugin.version> + <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> + <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> + <quarkus.platform.version>3.8.4</quarkus.platform.version> + <kogito.bom.group-id>org.kie.kogito</kogito.bom.group-id> + <kogito.bom.artifact-id>kogito-bom</kogito.bom.artifact-id> + <kogito-apps.bom.artifact-id>kogito-apps-bom</kogito-apps.bom.artifact-id> + <version.org.kie.kogito>999-SNAPSHOT</version.org.kie.kogito> + </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>${quarkus.platform.group-id}</groupId> + <artifactId>${quarkus.platform.artifact-id}</artifactId> + <version>${quarkus.platform.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>${kogito.bom.group-id}</groupId> + <artifactId>${kogito.bom.artifact-id}</artifactId> + <version>${version.org.kie.kogito}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>${kogito.bom.group-id}</groupId> + <artifactId>${kogito-apps.bom.artifact-id}</artifactId> + <version>${version.org.kie.kogito}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy-jackson</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-smallrye-openapi</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-smallrye-health</artifactId> + </dependency> + + <dependency> + <groupId>org.jbpm</groupId> + <artifactId>jbpm-with-drools-quarkus</artifactId> + </dependency> + + <dependency> + <groupId>org.jbpm</groupId> + <artifactId>jbpm-quarkus</artifactId> + </dependency> + + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-process-management</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kogito-addons-quarkus-jobs-management</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-process-svg</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-source-files</artifactId> + </dependency> + + <!-- Persistence --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-jdbc-postgresql</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-agroal</artifactId> + </dependency> + <dependency> + <groupId>org.kie</groupId> + <artifactId>kie-addons-quarkus-persistence-jdbc</artifactId> + </dependency> + + <!-- Data Index Persistence --> Review Comment: ```suggestion <!-- Data Index --> ``` ########## kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml: ########## @@ -0,0 +1,83 @@ +version: '3' + +services: + postgres: + container_name: postgres + image: postgres:16.1-alpine3.19 + profiles: [ "infra", "example", "full" ] + ports: + - "5432:5432" + volumes: + - ./sql:/docker-entrypoint-initdb.d:Z + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-d", "kogito", "-U", "kogito-user" ] + timeout: 45s + interval: 10s + retries: 50 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:8.2 + profiles: [ "infra", "example", "full" ] + ports: + - 8055:80 + depends_on: + - postgres + volumes: + - ./pgadmin/servers.json:/pgadmin4/servers.json + - ./pgadmin/pgpass:/pgadmin4/pgpass + entrypoint: > + /bin/sh -c " + cp -f /pgadmin4/pgpass /var/lib/pgadmin/; + chmod 600 /var/lib/pgadmin/pgpass; + /entrypoint.sh + " + environment: + PGADMIN_DEFAULT_EMAIL: [email protected] + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: 'False' + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False' + GUNICORN_ACCESS_LOGFILE: '/dev/null' + + data-index: + container_name: data-index + image: quay.io/kiegroup/kogito-data-index-postgresql-nightly:${KOGITO_VERSION} + profiles: [ "infra", "example", "full" ] + ports: + - "8180:8080" + depends_on: + postgres: + condition: service_healthy + environment: + QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_USERNAME: kogito-user + QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + KOGITO_DATA_INDEX_QUARKUS_PROFILE: "http-events-support" + extra_hosts: + - "${DOCKER_GATEWAY_HOST}:host-gateway" + + kogito-process-instance-migration-service: + container_name: kogito-process-instance-migration-service + image: dev.local/${USER}/kogito-process-instance-migration-service:1.0-SNAPSHOT + profiles: ["example", "full"] + ports: + - "8080:8080" + depends_on: + data-index: Review Comment: not needed -- 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]
