From 5b4e65e7b05ff9c340df7f331b31078d48b30ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Thu, 19 Sep 2024 16:17:09 +0200 Subject: [PATCH 1/5] incubator-kie-issues#1483: Create a common Kie Flyway initializer for Kie Modules --- .../docker-compose/startServices.sh | 4 +- .../src/main/resources/application.properties | 6 +- .../docker-compose/docker-compose.yml | 34 +++++++--- .../docker-compose/pgadmin/pgpass | 2 + .../docker-compose/pgadmin/servers.json | 14 +++++ .../docker-compose/sql/init.sql | 2 +- .../src/main/resources/application.properties | 5 +- .../docker-compose-postgresql.yml | 62 ++++++++++++------- .../docker-compose/pgadmin/pgpass | 2 + .../docker-compose/pgadmin/servers.json | 14 +++++ .../docker-compose/sql/init.sql | 13 ++++ .../docker-compose/startServices.sh | 4 +- .../src/main/resources/application.properties | 2 +- .../README.md | 6 +- .../docker-compose/docker-compose.yml | 36 +++++++---- .../docker-compose/pgadmin/pgpass | 2 + .../docker-compose/pgadmin/servers.json | 14 +++++ .../docker-compose/sql/init.sql | 2 +- .../src/main/resources/application.properties | 6 +- 19 files changed, 167 insertions(+), 63 deletions(-) create mode 100644 kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/pgpass create mode 100644 kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/servers.json create mode 100644 kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/pgpass create mode 100644 kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/servers.json create mode 100644 kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/pgpass create mode 100644 kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/servers.json diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh index 8b0c6f4348..ecfa6633d3 100755 --- a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh @@ -31,9 +31,9 @@ echo "Kogito Image version: ${KOGITO_VERSION}" echo "KOGITO_VERSION=${KOGITO_VERSION}" > ".env" echo "COMPOSE_PROFILES='${PROFILE}'" >> ".env" -if [ "$(uname)" == "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then echo "DOCKER_GATEWAY_HOST=kubernetes.docker.internal" >> ".env" -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then +elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then echo "DOCKER_GATEWAY_HOST=172.17.0.1" >> ".env" fi diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties index 077d6091e0..b9a0d64ef3 100644 --- a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties @@ -19,11 +19,7 @@ kogito.dataindex.http.url=http://localhost:8080 kogito.dataindex.ws.url=ws://localhost:8080 # run create tables scripts -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true -quarkus.flyway.baseline-version=0.0 -quarkus.flyway.locations=classpath:/db/migration,classpath:/db/jobs-service,classpath:/db/data-audit/postgresql -quarkus.flyway.table=FLYWAY_RUNTIME_SERVICE +kie.flyway.enabled=true kogito.persistence.type=jdbc quarkus.datasource.db-kind=postgresql diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/docker-compose.yml b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/docker-compose.yml index 4aa58ffa91..0a5bcb72e0 100644 --- a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/docker-compose.yml +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/docker-compose.yml @@ -21,29 +21,47 @@ version: "3" services: postgres-compose: - image: postgres:13.4-alpine3.14 + image: postgres:16.1-alpine3.19 + container_name: postgres environment: - POSTGRES_PASSWORD: pass + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres ports: - 5432:5432 volumes: - ./sql:/docker-entrypoint-initdb.d/ + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-d", "kogito", "-U", "kogito-user" ] + timeout: 45s + interval: 10s + retries: 50 networks: - postgres-compose-network - container_name: postgres-container pgadmin-compose: - image: dpage/pgadmin4:5.0 - environment: - PGADMIN_DEFAULT_EMAIL: user@user.org - PGADMIN_DEFAULT_PASSWORD: pass + image: dpage/pgadmin4:8.2 + container_name: pgadmin ports: - 8055:80 depends_on: - postgres-compose + 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: user@kogito.org + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" + GUNICORN_ACCESS_LOGFILE: "/dev/null" networks: - postgres-compose-network - container_name: pgadmin-container networks: postgres-compose-network: diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/pgpass b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/pgpass new file mode 100644 index 0000000000..2e0fbd6a33 --- /dev/null +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/pgpass @@ -0,0 +1,2 @@ +postgres:5432:kogito:kogito-user:kogito-pass +postgres:5432:postgres:kogito-user:kogito-pass \ No newline at end of file diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/servers.json b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/servers.json new file mode 100644 index 0000000000..caafe268c0 --- /dev/null +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "kogito", + "Group": "Servers", + "Host": "postgres", + "Port": 5432, + "MaintenanceDB": "kogito", + "Username": "kogito-user", + "SSLMode": "disable", + "PassFile": "/var/lib/pgadmin/pgpass" + } + } +} diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/sql/init.sql b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/sql/init.sql index 8cfbe001cd..8246ed59ce 100644 --- a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/sql/init.sql +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/docker-compose/sql/init.sql @@ -24,7 +24,7 @@ CREATE ROLE "kogito-user" WITH CREATEDB CREATEROLE NOREPLICATION - ENCRYPTED PASSWORD 'md54adb613a8ffdd707e032c918d791e2e5'; + PASSWORD 'kogito-pass'; CREATE DATABASE kogito WITH diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/main/resources/application.properties b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/main/resources/application.properties index 8919fc3679..9a96b0fb1e 100644 --- a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/main/resources/application.properties +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/main/resources/application.properties @@ -24,4 +24,7 @@ quarkus.datasource.db-kind=postgresql %prod.quarkus.datasource.username=kogito-user %prod.quarkus.datasource.password=kogito-pass %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/kogito -quarkus.flyway.migrate-at-start=true + +kie.flyway.enabled=true + +%dev.quarkus.kogito.devservices.enabled=false diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml index cab2129fee..8cf7c6eeb2 100755 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml @@ -17,11 +17,11 @@ # under the License. # -version: '2.1' +version: '3' services: postgres: - image: postgres:13.4-alpine3.14 + image: postgres:16.1-alpine3.19 ports: - "5432:5432" volumes: @@ -32,19 +32,30 @@ services: interval: 10s retries: 50 environment: - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres - pgadmin-compose: - image: dpage/pgadmin4:5.0 - environment: - PGADMIN_DEFAULT_EMAIL: user@user.org - PGADMIN_DEFAULT_PASSWORD: pass + pgadmin: + image: dpage/pgadmin4:8.2 ports: - 8055:80 depends_on: - postgres - container_name: pgadmin-container + 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: user@kogito.org + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" + GUNICORN_ACCESS_LOGFILE: "/dev/null" zookeeper: container_name: zookeeper @@ -95,7 +106,7 @@ services: environment: DB_VENDOR: POSTGRES DB_ADDR: postgres - DB_DATABASE: kogito + DB_DATABASE: keycloak DB_USER: kogito-user DB_SCHEMA: public DB_PASSWORD: kogito-pass @@ -105,7 +116,7 @@ services: data-index: container_name: data-index - image: quay.io/kiegroup/kogito-data-index-postgresql:${KOGITO_VERSION} + image: docker.io/apache/incubator-kie-kogito-data-index-postgresql:${KOGITO_VERSION} ports: - "8180:8080" depends_on: @@ -125,7 +136,7 @@ services: jobs-service: container_name: jobs-service - image: quay.io/kiegroup/kogito-jobs-service-postgresql:${KOGITO_VERSION} + image: docker.io/apache/incubator-kie-kogito-jobs-service-postgresql:${KOGITO_VERSION} ports: - "8580:8080" depends_on: @@ -146,7 +157,7 @@ services: management-console: container_name: management-console - image: quay.io/kiegroup/kogito-management-console:${KOGITO_VERSION} + image: docker.io/apache/incubator-kie-kogito-management-console:${KOGITO_VERSION} ports: - "8280:8080" depends_on: @@ -159,15 +170,16 @@ services: volumes: - ../target/classes/META-INF/processSVG/:/home/kogito/data/svg/ environment: - KOGITO_DATAINDEX_HTTP_URL: http://${DOCKER_GATEWAY_HOST:-host.docker.internal}:8180/graphql - QUARKUS_HTTP_CORS_ORIGINS: "/.*/" - KOGITO_MANAGEMENT_CONSOLE_PROPS: -Dkogito.consoles.keycloak.config.url=http://localhost:8480/auth - -Dkogito.consoles.keycloak.config.health-check-url=http://localhost:8480/auth/realms/kogito/.well-known/openid-configuration - -Dkogito.svg.folder.path=/home/kogito/data/svg + RUNTIME_TOOLS_MANAGEMENT_CONSOLE_KOGITO_ENV_MODE: "PROD" + RUNTIME_TOOLS_MANAGEMENT_CONSOLE_DATA_INDEX_ENDPOINT: http://${DOCKER_GATEWAY_HOST:-host.docker.internal}:8180/graphql + KOGITO_CONSOLES_KEYCLOAK_HEALTH_CHECK_URL: http://localhost:8480/auth/realms/kogito/.well-known/openid-configuration + KOGITO_CONSOLES_KEYCLOAK_URL: http://localhost:8480/auth + KOGITO_CONSOLES_KEYCLOAK_REALM: kogito + KOGITO_CONSOLES_KEYCLOAK_CLIENT_ID: kogito-console-quarkus task-console: container_name: task-console - image: quay.io/kiegroup/kogito-task-console:${KOGITO_VERSION} + image: docker.io/apache/incubator-kie-kogito-task-console:${KOGITO_VERSION} ports: - "8380:8080" depends_on: @@ -176,7 +188,9 @@ services: keycloak: condition: service_healthy environment: - KOGITO_DATAINDEX_HTTP_URL: http://${DOCKER_GATEWAY_HOST:-host.docker.internal}:8180/graphql - QUARKUS_HTTP_CORS_ORIGINS: "/.*/" - KOGITO_TASK_CONSOLE_PROPS: -Dkogito.consoles.keycloak.config.url=http://localhost:8480/auth - -Dkogito.consoles.keycloak.config.health-check-url=http://localhost:8480/auth/realms/kogito/.well-known/openid-configuration + RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_ENV_MODE: "PROD" + RUNTIME_TOOLS_TASK_CONSOLE_DATA_INDEX_ENDPOINT: http://${DOCKER_GATEWAY_HOST:-host.docker.internal}:8180/graphql + KOGITO_CONSOLES_KEYCLOAK_HEALTH_CHECK_URL: http://localhost:8480/auth/realms/kogito/.well-known/openid-configuration + KOGITO_CONSOLES_KEYCLOAK_URL: http://localhost:8480/auth + KOGITO_CONSOLES_KEYCLOAK_REALM: kogito + KOGITO_CONSOLES_KEYCLOAK_CLIENT_ID: kogito-console-quarkus diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/pgpass b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/pgpass new file mode 100644 index 0000000000..2e0fbd6a33 --- /dev/null +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/pgpass @@ -0,0 +1,2 @@ +postgres:5432:kogito:kogito-user:kogito-pass +postgres:5432:postgres:kogito-user:kogito-pass \ No newline at end of file diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/servers.json b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/servers.json new file mode 100644 index 0000000000..caafe268c0 --- /dev/null +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "kogito", + "Group": "Servers", + "Host": "postgres", + "Port": 5432, + "MaintenanceDB": "kogito", + "Username": "kogito-user", + "SSLMode": "disable", + "PassFile": "/var/lib/pgadmin/pgpass" + } + } +} diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/sql/init.sql b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/sql/init.sql index ee1a94650d..92ea9b4e5c 100644 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/sql/init.sql +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/sql/init.sql @@ -16,5 +16,18 @@ CREATE DATABASE kogito 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"; +GRANT ALL PRIVILEGES ON DATABASE keycloak TO postgres; \ No newline at end of file diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/startServices.sh b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/startServices.sh index 70fccff021..ad8e9bfb6b 100755 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/startServices.sh +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/startServices.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -27,7 +27,7 @@ echo "Project version: ${PROJECT_VERSION}" if [[ $PROJECT_VERSION == *SNAPSHOT ]]; then - KOGITO_VERSION="latest" + KOGITO_VERSION="main" else KOGITO_VERSION=${PROJECT_VERSION%.*} fi diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/src/main/resources/application.properties b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/src/main/resources/application.properties index 932e513803..0fb8c5fa1e 100644 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/src/main/resources/application.properties +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/src/main/resources/application.properties @@ -62,8 +62,8 @@ kogito.jobs-service.url=http://localhost:8580 %postgresql.quarkus.datasource.username=kogito-user %postgresql.quarkus.datasource.password=kogito-pass %postgresql.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/kogito +%postgresql.kie.flyway.enabled=true %postgresql.quarkus.kogito.devservices.enabled=false -%postgresql.quarkus.flyway.migrate-at-start=true %infinispan.kogito.persistence.type=infinispan %infinispan.quarkus.infinispan-client.hosts=localhost:11222 diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/README.md b/kogito-springboot-examples/process-postgresql-persistence-springboot/README.md index bc76d6d71d..238fd4c17d 100644 --- a/kogito-springboot-examples/process-postgresql-persistence-springboot/README.md +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/README.md @@ -146,7 +146,7 @@ To make use of this application it is as simple as putting a sending request to Complete curl command can be found below: -``` +```bash curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name" : "my fancy deal", "traveller" : { "firstName" : "John", "lastName" : "Doe", "email" : "jon.doe@example.com", "nationality" : "American","address" : { "street" : "main street", "city" : "Boston", "zipCode" : "10005", "country" : "US" }}}' http://localhost:8080/deals ``` @@ -156,13 +156,13 @@ this will then trigger the review user task that you can work with. First you can display all active reviews of deals -``` +```bash curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews ``` based on the response you can select one of the reviews to see more details -``` +```bash curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john ``` diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/docker-compose.yml b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/docker-compose.yml index 8a810481bd..bc79f106f2 100644 --- a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/docker-compose.yml +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/docker-compose.yml @@ -20,31 +20,41 @@ version: "3" services: - postgres-compose: - image: postgres:13.4-alpine3.14 - environment: - POSTGRES_PASSWORD: pass + postgres: + image: postgres:16.1-alpine3.19 ports: - 5432:5432 volumes: - - ${HOME}/postgresql/data:/var/lib/postgresql/data - ./sql:/docker-entrypoint-initdb.d/ + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres networks: - postgres-compose-network - container_name: postgres-container - pgadmin-compose: - image: dpage/pgadmin4:5.0 - environment: - PGADMIN_DEFAULT_EMAIL: user@user.org - PGADMIN_DEFAULT_PASSWORD: pass + pgadmin: + image: dpage/pgadmin4:8.2 ports: - 8055:80 depends_on: - - postgres-compose + - 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: user@kogito.org + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" + GUNICORN_ACCESS_LOGFILE: "/dev/null" networks: - postgres-compose-network - container_name: pgadmin-container networks: postgres-compose-network: diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/pgpass b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/pgpass new file mode 100644 index 0000000000..2e0fbd6a33 --- /dev/null +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/pgpass @@ -0,0 +1,2 @@ +postgres:5432:kogito:kogito-user:kogito-pass +postgres:5432:postgres:kogito-user:kogito-pass \ No newline at end of file diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/servers.json b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/servers.json new file mode 100644 index 0000000000..caafe268c0 --- /dev/null +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "kogito", + "Group": "Servers", + "Host": "postgres", + "Port": 5432, + "MaintenanceDB": "kogito", + "Username": "kogito-user", + "SSLMode": "disable", + "PassFile": "/var/lib/pgadmin/pgpass" + } + } +} diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/sql/init.sql b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/sql/init.sql index 5b483ec23d..e9ceb0033b 100644 --- a/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/sql/init.sql +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/docker-compose/sql/init.sql @@ -5,7 +5,7 @@ CREATE ROLE "kogito-user" WITH CREATEDB CREATEROLE NOREPLICATION - ENCRYPTED PASSWORD 'md54adb613a8ffdd707e032c918d791e2e5'; + PASSWORD 'kogito-pass'; CREATE DATABASE kogito WITH diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/application.properties b/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/application.properties index a3ac58a919..143f097075 100644 --- a/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/application.properties +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/application.properties @@ -20,8 +20,10 @@ server.address=0.0.0.0 #run create tables scripts during the application startup -spring.flyway.enabled=true -spring.flyway.locations=classpath:db/{vendor} +kie.flyway.enabled=true + +#Disabling Spring-Boot Flyway to avoid unnecessary Data Base initialization +spring.flyway.enabled=false #jdbc kogito.persistence.type=jdbc From 77d51787aa2db0c2f9fb69d11cf02c8b2fc168c5 Mon Sep 17 00:00:00 2001 From: Pere Fernandez Date: Fri, 20 Sep 2024 10:17:01 +0200 Subject: [PATCH 2/5] - swf test fixes --- .../src/main/resources/application.properties | 3 ++- .../src/main/resources/application.properties | 3 ++- .../src/test/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 4 +--- .../src/main/resources/application.properties | 3 ++- .../src/test/resources/application.properties | 1 - .../loanbroker-flow/src/main/resources/application.properties | 2 +- .../src/main/resources/application-knative.properties | 2 +- .../src/main/resources/application-knative.properties | 2 +- .../src/main/resources/application-persistence.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application-knative.properties | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/src/main/resources/application.properties index b01f42ee59..d5feef9860 100644 --- a/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/src/main/resources/application.properties @@ -29,8 +29,9 @@ quarkus.rest-client.callback_yaml.url=http://localhost:8181/ kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false quarkus.datasource.db-kind=postgresql + #run create tables scripts -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.native.native-image-xmx=8g diff --git a/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/main/resources/application.properties index 05736d7b90..58758db2d8 100644 --- a/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/main/resources/application.properties @@ -61,8 +61,9 @@ mp.messaging.outgoing.kogito-processdefinitions-events.value.serializer=org.apac kogito.persistence.type=jdbc quarkus.datasource.db-kind=postgresql kogito.persistence.proto.marshaller=false + #run create tables scripts -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.native.native-image-xmx=8g diff --git a/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/test/resources/application.properties b/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/test/resources/application.properties index abb20a3c7f..aa62062ff2 100644 --- a/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/test/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-callback-quarkus/src/test/resources/application.properties @@ -19,5 +19,5 @@ quarkus.kogito.devservices.enabled=false -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.datasource.db-kind=postgresql diff --git a/serverless-workflow-examples/serverless-workflow-compensation-quarkus/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-compensation-quarkus/src/main/resources/application.properties index 34043ef3dd..654ba0b374 100644 --- a/serverless-workflow-examples/serverless-workflow-compensation-quarkus/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-compensation-quarkus/src/main/resources/application.properties @@ -22,7 +22,7 @@ quarkus.native.native-image-xmx=8g %persistence.quarkus.devservices.enabled=false -%persistence.quarkus.flyway.migrate-at-start=true +%persistence.kie.flyway.enabled=true %persistence.quarkus.datasource.db-kind=postgresql # profile to pack this example into a container, to use it execute activate the maven container profile, -Dcontainer diff --git a/serverless-workflow-examples/serverless-workflow-correlation-quarkus/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-correlation-quarkus/src/main/resources/application.properties index 307953b261..7a9f24ce65 100644 --- a/serverless-workflow-examples/serverless-workflow-correlation-quarkus/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-correlation-quarkus/src/main/resources/application.properties @@ -87,7 +87,7 @@ mp.messaging.incoming.validatedAccountEmail.auto.offset.reset=earliest kogito.persistence.type=jdbc #run create tables scripts -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.datasource.db-kind=postgresql %prod.quarkus.datasource.username=postgres diff --git a/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/src/main/resources/application.properties index 0542e7832c..74efbe9153 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/src/main/resources/application.properties @@ -10,9 +10,7 @@ quarkus.datasource.db-kind=postgresql %container.quarkus.datasource.password=postgres %container.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/kogito -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true -quarkus.hibernate-orm.database.generation=update +kie.flyway.enabled=true kogito.service.url=http://localhost:8080 diff --git a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/main/resources/application.properties index 5a65acb07b..bdb9623e63 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/main/resources/application.properties @@ -46,8 +46,9 @@ quarkus.http.test-port=0 kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false quarkus.datasource.db-kind=postgresql + #run create tables scripts -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.kubernetes-client.devservices.enabled=false quarkus.native.native-image-xmx=8g diff --git a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/resources/application.properties b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/resources/application.properties index e0723a1fac..5d92be7766 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/src/test/resources/application.properties @@ -18,4 +18,3 @@ # quarkus.kogito.devservices.enabled=true -quarkus.flyway.table=test_flyway \ No newline at end of file diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties index 6f28b4ce8a..5119511406 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties @@ -56,7 +56,7 @@ quarkus.knative.max-scale=1 %persistence.quarkus.container-image.build=true %persistence.quarkus.datasource.db-kind=postgresql -%persistence.quarkus.flyway.migrate-at-start=true +%persistence.kie.flyway.enabled=true %persistence.kogito.persistence.type=jdbc %persistence.kogito.persistence.proto.marshaller=false %persistence.kogito.persistence.query.timeout.millis=10000 diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties index 8ce2a74312..ebe362b111 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties @@ -24,7 +24,7 @@ kogito.service.url=${knative:services.v1.serving.knative.dev/newsletter-showcase # When the application is generated with the knative profile, it'll require a PostgreSQL database. # Kogito persistence configurations for enabling the serverless workflow persistence quarkus.datasource.db-kind=postgresql -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false kogito.persistence.query.timeout.millis=10000 diff --git a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-knative.properties b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-knative.properties index 8ffd4e9069..22a58bf066 100644 --- a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-knative.properties +++ b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-knative.properties @@ -24,7 +24,7 @@ quarkus.log.category."org.kie".level=DEBUG quarkus.datasource.db-kind=postgresql kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true kogito.persistence.query.timeout.millis=10000 # DB configuration, also used by the PostgreSqlQueryRecordRepository diff --git a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-persistence.properties b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-persistence.properties index 54f49a9f6e..44accd2593 100644 --- a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-persistence.properties +++ b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/src/main/resources/application-persistence.properties @@ -28,7 +28,7 @@ quarkus.datasource.db-kind=postgresql kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false kogito.persistence.query.timeout.millis=10000 -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true # DB configuration, also used by the PostgreSqlQueryRecordRepository %prod.quarkus.datasource.reactive.url=postgresql://localhost:5432/postgres diff --git a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/src/main/resources/application.properties index 370f3de745..98ef9ccbbf 100644 --- a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/src/main/resources/application.properties @@ -32,7 +32,7 @@ kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false kogito.persistence.query.timeout.millis=10000 quarkus.datasource.db-kind=postgresql -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true # Configuration for the incoming cloud events received by the serverless workflows. mp.messaging.incoming.kogito_incoming_stream.connector=quarkus-http diff --git a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/src/main/resources/application-knative.properties b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/src/main/resources/application-knative.properties index 72672f738c..64090f51e7 100644 --- a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/src/main/resources/application-knative.properties +++ b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/src/main/resources/application-knative.properties @@ -22,7 +22,7 @@ kogito.persistence.type=jdbc kogito.persistence.proto.marshaller=false kogito.persistence.query.timeout.millis=10000 quarkus.datasource.db-kind=postgresql -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true # This env var will be generated with the quarkus-kubernetes plugin. See below. quarkus.datasource.jdbc.url=jdbc:postgresql://${POSTGRES_HOST:localhost}:5432/postgres From a759489d7c36d98dc765daafc09a9a18d2c21a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Fri, 20 Sep 2024 13:34:07 +0200 Subject: [PATCH 3/5] - fix import order --- .../java/org/acme/travels/quarkus/ApprovalsProcessTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kogito-quarkus-examples/process-usertasks-quarkus/src/test/java/org/acme/travels/quarkus/ApprovalsProcessTest.java b/kogito-quarkus-examples/process-usertasks-quarkus/src/test/java/org/acme/travels/quarkus/ApprovalsProcessTest.java index 289bd19767..b4a1690b2d 100644 --- a/kogito-quarkus-examples/process-usertasks-quarkus/src/test/java/org/acme/travels/quarkus/ApprovalsProcessTest.java +++ b/kogito-quarkus-examples/process-usertasks-quarkus/src/test/java/org/acme/travels/quarkus/ApprovalsProcessTest.java @@ -36,12 +36,12 @@ import io.quarkus.test.junit.QuarkusTest; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import jakarta.inject.Inject; import jakarta.inject.Named; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + @QuarkusTest public class ApprovalsProcessTest { From 9bd92fecfff6238dfba2cdd9941866108ed450a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Mon, 23 Sep 2024 19:19:29 +0200 Subject: [PATCH 4/5] - adding kie-flyway config --- .../docker-compose/docker-compose-postgresql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml index 8cf7c6eeb2..a765bbe726 100755 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml @@ -132,7 +132,7 @@ services: QUARKUS_DATASOURCE_PASSWORD: kogito-pass KAFKA_BOOTSTRAP_SERVERS: kafka:29092 QUARKUS_HTTP_CORS_ORIGINS: "/.*/" - KOGITO_DATA_INDEX_PROPS: -Dquarkus.hibernate-orm.database.generation=update + KIE_FLYWAY_ENABLED: true jobs-service: container_name: jobs-service @@ -149,11 +149,11 @@ services: QUARKUS_DATASOURCE_REACTIVE_URL: "postgresql://postgres:5432/kogito" QUARKUS_DATASOURCE_USERNAME: kogito-user QUARKUS_DATASOURCE_PASSWORD: kogito-pass - QUARKUS_FLYWAY_BASELINE_ON_MIGRATE: "true" KAFKA_BOOTSTRAP_SERVERS: kafka:29092 QUARKUS_PROFILE: events-support QUARKUS_HTTP_PORT: 8580 QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + KIE_FLYWAY_ENABLED: true management-console: container_name: management-console From 9dc1cf43542bee3e73ba2cd1c54cf255cb923182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Fri, 27 Sep 2024 11:31:13 +0200 Subject: [PATCH 5/5] - restoring platform flyway setup for Data Index & Jobs Service containers --- .../docker-compose/docker-compose-postgresql.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml index a765bbe726..e7055af034 100755 --- a/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml +++ b/kogito-quarkus-examples/process-usertasks-timer-quarkus-with-console/docker-compose/docker-compose-postgresql.yml @@ -130,9 +130,11 @@ services: QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" QUARKUS_DATASOURCE_USERNAME: kogito-user QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_FLYWAY_MIGRATE_AT_START: "true" + QUARKUS_FLYWAY_BASELINE_ON_MIGRATE: "true" + QUARKUS_FLYWAY_TABLE: FLYWAY_DATA_INDEX KAFKA_BOOTSTRAP_SERVERS: kafka:29092 QUARKUS_HTTP_CORS_ORIGINS: "/.*/" - KIE_FLYWAY_ENABLED: true jobs-service: container_name: jobs-service @@ -149,11 +151,13 @@ services: QUARKUS_DATASOURCE_REACTIVE_URL: "postgresql://postgres:5432/kogito" QUARKUS_DATASOURCE_USERNAME: kogito-user QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_FLYWAY_MIGRATE_AT_START: "true" + QUARKUS_FLYWAY_BASELINE_ON_MIGRATE: "true" + QUARKUS_FLYWAY_TABLE: FLYWAY_JOBS_SERVICE KAFKA_BOOTSTRAP_SERVERS: kafka:29092 QUARKUS_PROFILE: events-support QUARKUS_HTTP_PORT: 8580 QUARKUS_HTTP_CORS_ORIGINS: "/.*/" - KIE_FLYWAY_ENABLED: true management-console: container_name: management-console