diff --git a/.env b/.env index 4e5b70a0..14076c1d 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -NUSSKNACKER_VERSION=1.16.3 +NUSSKNACKER_VERSION=1.17.0 diff --git a/docker-compose.yml b/docker-compose.yml index 43793b29..042a19d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,16 +4,28 @@ services: ### Quickstart setup container quickstart-setup: - build: - context: quickstart-setup/ - dockerfile: Dockerfile + image: touk/nussknacker-example-scenarios-library:latest depends_on: nginx: condition: service_healthy + designer: + condition: service_healthy + kafka: + condition: service_healthy + schema-registry: + condition: service_healthy + environment: + NU_DESIGNER_ADDRESS: "nginx:8080" + NU_REQUEST_RESPONSE_OPEN_API_SERVICE_ADDRESS: "nginx:8181" + KAFKA_ADDRESS: "kafka:9092" + SCHEMA_REGISTRY_ADDRESS: "schema-registry:8081" + volumes: + - nussknacker_designer_shared_configuration:/opt/nussknacker/conf/ deploy: resources: limits: - memory: 128M + memory: 256M + cpus: '0.5' ### Nussknacker-related services @@ -46,7 +58,8 @@ services: image: touk/nussknacker:${NUSSKNACKER_VERSION:?NUSSKNACKER_VERSION must be defined}_scala-2.12 restart: unless-stopped environment: - CONFIG_FILE: "/opt/nussknacker/conf/application.conf,/opt/nussknacker/conf/application-customizations.conf" + EXAMPLE_SCENARIOS_LIBRARY_SERVICE_NAME: quickstart-setup + CONFIG_FILE: "/opt/nussknacker/conf/application.conf,/opt/nussknacker/conf/additional-configuration.conf,/opt/nussknacker/conf/application-customizations.conf" DB_URL: "jdbc:postgresql://postgres:5432/nu-db" DB_DRIVER: "org.postgresql.Driver" DB_USER: "nu" @@ -71,13 +84,14 @@ services: condition: service_healthy flink-taskmanager: condition: service_started - expose: + expose: - 8181 healthcheck: test: [ "CMD-SHELL", "curl localhost:8080/api/app/healthCheck" ] interval: 10s retries: 10 volumes: + - nussknacker_designer_shared_configuration:/opt/nussknacker/conf - ./designer/application-customizations.conf:/opt/nussknacker/conf/application-customizations.conf volumes_from: - flink-jobmanager @@ -216,6 +230,7 @@ services: context: ./flink/ args: FLINK_VERSION: "1.18.1-scala_2.12-java11" + no_cache: true restart: unless-stopped command: jobmanager environment: @@ -232,6 +247,7 @@ services: context: ./flink/ args: FLINK_VERSION: "1.18.1-scala_2.12-java11" + no_cache: true restart: unless-stopped command: taskmanager environment: @@ -265,5 +281,7 @@ services: volumes: nussknacker_designer_data: name: nussknacker_designer_data + nussknacker_designer_shared_configuration: + name: nussknacker_designer_shared_configuration nussknacker_flink_data: name: nussknacker_flink_data diff --git a/flink/Dockerfile b/flink/Dockerfile index a0782c97..a3e33a4e 100644 --- a/flink/Dockerfile +++ b/flink/Dockerfile @@ -1,4 +1,11 @@ -ARG FLINK_VERSION=undefined-flink-version +ARG FLINK_VERSION="FLINK_VERSION_IS_UNDEFINED" + +FROM curlimages/curl:8.9.1 AS lib_provider + +# Adding custom libraries ('add other libraries' section): +# https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/resource-providers/standalone/docker/#further-customization +WORKDIR /libs +RUN curl -k --output /libs/postgresql-42.6.0.jar https://repo1.maven.org/maven2/org/postgresql/postgresql/42.6.0/postgresql-42.6.0.jar FROM flink:${FLINK_VERSION} @@ -6,6 +13,7 @@ USER root RUN echo '#!/bin/sh' > /ex-docker-entrypoint.sh && \ echo 'export FLINK_PROPERTIES=$(cat /opt/flink/conf/flink-properties.yml) && /docker-entrypoint.sh "$@"' >> /ex-docker-entrypoint.sh && \ chmod +x /ex-docker-entrypoint.sh +COPY --from=lib_provider /libs/ /opt/flink/lib/ USER flink COPY flink-properties.yml /opt/flink/conf/ diff --git a/quickstart-setup/Dockerfile b/quickstart-setup/Dockerfile deleted file mode 100644 index 1d630bc3..00000000 --- a/quickstart-setup/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM bitnami/kafka:3.7.0 - -USER root - -RUN apt update && \ - apt install -y curl jq kafkacat less && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /app - -COPY entrypoint.sh / -COPY scripts/ /app/scripts/ -COPY data/ /app/data/ -COPY setup/ /app/setup/ - -HEALTHCHECK --interval=10s --timeout=1s --retries=12 CMD /bin/bash -c 'test -f "/app/healthy"' - -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/quickstart-setup/data/http/generate-requests/loan.sh b/quickstart-setup/data/http/generate-requests/loan.sh deleted file mode 100755 index 768c704f..00000000 --- a/quickstart-setup/data/http/generate-requests/loan.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -source ../../../scripts/utils/lib.sh - -ID="$(random_4digit_number)" -AMOUNT="$(random_4digit_number)" -REQUEST_TYPE="$(pick_randomly "loan" "mortgage" "insurance")" -CITY="$(pick_randomly "Warszawa" "Berlin" "Gdańsk" "Kraków", "Poznań", "Praga")" - -echo "{\"customerId\": \"$ID\", \"requestedAmount\": $AMOUNT, \"requestType\": \"$REQUEST_TYPE\", \"location\": { \"city\": \"$CITY\", \"street\": \"\" }}" \ No newline at end of file diff --git a/quickstart-setup/data/http/slugs.txt b/quickstart-setup/data/http/slugs.txt deleted file mode 100644 index 41d9961f..00000000 --- a/quickstart-setup/data/http/slugs.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Request-Response OpenAPI services slugs the static and generated requests should be sent to -loan diff --git a/quickstart-setup/data/http/static-requests/loan.txt b/quickstart-setup/data/http/static-requests/loan.txt deleted file mode 100644 index 9b667512..00000000 --- a/quickstart-setup/data/http/static-requests/loan.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Example Request-Response OpenAPI service requests (request payload per line) -#{"customerId": "anon", "requestedAmount": 1555, "requestType": "mortgage", "location": { "city": "Warszawa", "street": "Marszałkowska" }} -#{"customerId": "anon", "requestedAmount": 86, "requestType": "loan", "location": { "city": "Lublin", "street": "Głęboka" }} -#{"customerId": "1", "requestedAmount": 1000, "requestType": "loan", "location": { "city": "Warszawa", "street": "Marszałkowska" }} -#{"customerId": "1", "requestedAmount": 500, "requestType": "savings", "location": { "city": "London", "street": "Kensington" }} -#{"customerId": "4", "requestedAmount": 2000, "requestType": "mortgage", "location": { "city": "Lublin", "street": "Lipowa" }} -#{"customerId": "3", "requestedAmount": 2000, "requestType": "loan", "location": { "city": "Lublin", "street": "Głęboka" }} diff --git a/quickstart-setup/data/kafka/generate-messages/transactions.sh b/quickstart-setup/data/kafka/generate-messages/transactions.sh deleted file mode 100755 index d0527d84..00000000 --- a/quickstart-setup/data/kafka/generate-messages/transactions.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -source ../../../scripts/utils/lib.sh - -ID=$((1 + $(random_4digit_number) % 5)) -AMOUNT=$((1 + $(random_4digit_number) % 30)) -TIME=$(($(now) - $(random_4digit_number) % 20)) - -echo "{ \"clientId\": \"Client$ID\", \"amount\": $AMOUNT, \"eventDate\": $TIME}" \ No newline at end of file diff --git a/quickstart-setup/data/kafka/static-messages/transactions.txt b/quickstart-setup/data/kafka/static-messages/transactions.txt deleted file mode 100644 index 65a41522..00000000 --- a/quickstart-setup/data/kafka/static-messages/transactions.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Example messages below (message per line) -#{ "clientId": "Client1", "amount": 100, "eventDate": 1720166429}" -#{ "clientId": "Client2", "amount": 1000, "eventDate": 1720166429}" diff --git a/quickstart-setup/data/kafka/topics.txt b/quickstart-setup/data/kafka/topics.txt deleted file mode 100644 index 05a70cee..00000000 --- a/quickstart-setup/data/kafka/topics.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Topic name the static and generated messages should be sent to -Transactions diff --git a/quickstart-setup/entrypoint.sh b/quickstart-setup/entrypoint.sh deleted file mode 100755 index a73aedaa..00000000 --- a/quickstart-setup/entrypoint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -e - -rm -fr /app/healthy - -while IFS= read -r script; do - "$script" -done < <(find /app/scripts/auto-executed -type f -name '*.sh' | sort) - -echo "Setup done!" - -touch /app/healthy - -# loop forever (you can use manually called utils scripts now) -tail -f /dev/null diff --git a/quickstart-setup/scripts/auto-executed/001-setup-schemas.sh b/quickstart-setup/scripts/auto-executed/001-setup-schemas.sh deleted file mode 100755 index 9320786c..00000000 --- a/quickstart-setup/scripts/auto-executed/001-setup-schemas.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function createJsonSchema() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) schema name, 2) schema file path" - exit 11 - fi - - set -e - - local SCHEMA_NAME=$1 - local SCHEMA_FILE=$2 - - echo "Creating schema '$SCHEMA_NAME' ..." - ESCAPED_JSON_SCHEMA=$(awk 'BEGIN{ORS="\\n"} {gsub(/"/, "\\\"")} 1' < "$SCHEMA_FILE") - - local REQUEST_BODY="{ - \"schema\": \"$ESCAPED_JSON_SCHEMA\", - \"schemaType\": \"JSON\", - \"references\": [] - }" - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X POST "http://schema-registry:8081/subjects/${SCHEMA_NAME}/versions" \ - -H "Content-Type: application/vnd.schemaregistry.v1+json" -d "$REQUEST_BODY" - ) - - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - - if [[ "$HTTP_STATUS" != 200 ]] ; then - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - echo -e "Error: Cannot create schema $SCHEMA_NAME.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 12 - fi - - echo "Schema '$SCHEMA_NAME' created!" -} - -echo "Starting to add preconfigured schemas ..." - -while IFS= read -r SCHEMA_FILENAME; do - - if [[ $SCHEMA_FILENAME == "#"* ]]; then - continue - fi - - SCHEMA_NAME="$(basename "$SCHEMA_FILENAME" ".schema.json")-value" - createJsonSchema "$SCHEMA_NAME" "$(realpath ../../setup/schema-registry/schemas/"$SCHEMA_FILENAME")" - -done < "../../setup/schema-registry/active-schemas.txt" - - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/002-setup-topics.sh b/quickstart-setup/scripts/auto-executed/002-setup-topics.sh deleted file mode 100755 index 1e2d2953..00000000 --- a/quickstart-setup/scripts/auto-executed/002-setup-topics.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function createTopic() { - if [ "$#" -ne 1 ]; then - echo "Error: One parameter required: 1) topic name" - exit 11 - fi - - set -e - local TOPIC_NAME=$1 - - echo "Creating topic '$TOPIC_NAME'" - ../utils/kafka/create-topic-idempotently.sh "$TOPIC_NAME" -} - -echo "Starting to create preconfigured topics ..." - -while IFS= read -r TOPIC_NAME; do - - if [[ $TOPIC_NAME == "#"* ]]; then - continue - fi - - createTopic "$TOPIC_NAME" - -done < "../../setup/kafka/topics.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/003-import-and-deploy-example-scenarios.sh b/quickstart-setup/scripts/auto-executed/003-import-and-deploy-example-scenarios.sh deleted file mode 100755 index 67b53420..00000000 --- a/quickstart-setup/scripts/auto-executed/003-import-and-deploy-example-scenarios.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function importAndDeployScenario() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) scenario name, 2) example scenario file path" - exit 11 - fi - - set -e - - local EXAMPLE_SCENARIO_NAME=$1 - local EXAMPLE_SCENARIO_FILE=$2 - - ../utils/nu/load-scenario-from-json-file.sh "$EXAMPLE_SCENARIO_NAME" "$EXAMPLE_SCENARIO_FILE" - ../utils/nu/deploy-scenario-and-wait-for-running-state.sh "$EXAMPLE_SCENARIO_NAME" -} - -echo "Starting to import and deploy example scenarios ..." - -while IFS= read -r EXAMPLE_SCENARIO_FILENAME; do - - if [[ $EXAMPLE_SCENARIO_FILENAME == "#"* ]]; then - continue - fi - - EXAMPLE_SCENARIO_NAME=$(basename "$EXAMPLE_SCENARIO_FILENAME" ".json") - - importAndDeployScenario "$EXAMPLE_SCENARIO_NAME" "$(realpath ../../setup/nu/scenarios/"$EXAMPLE_SCENARIO_FILENAME")" - -done < "../../setup/nu/examples.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/004-send-kafka-static-messages.sh b/quickstart-setup/scripts/auto-executed/004-send-kafka-static-messages.sh deleted file mode 100755 index 0e5d2eba..00000000 --- a/quickstart-setup/scripts/auto-executed/004-send-kafka-static-messages.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function sendMessage() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) topic name, 2) message" - exit 11 - fi - - set -e - - local TOPIC_NAME=$1 - local MSG=$2 - - echo "Sending message $MSG to '$TOPIC_NAME'" - ../utils/kafka/send-to-topic.sh "$TOPIC_NAME" "$MSG" - echo "Message sent!" -} - -echo "Starting to send preconfigured messages ..." - -while IFS= read -r TOPIC_NAME; do - - if [[ $TOPIC_NAME == "#"* ]]; then - continue - fi - - MESSAGES_FILE=$(find ../../data/kafka/static-messages -iname "$TOPIC_NAME.txt" | head) - - if [[ -f "$MESSAGES_FILE" ]]; then - while IFS= read -r MSG; do - if [[ $MSG == "#"* ]]; then - continue - fi - - sendMessage "$TOPIC_NAME" "$MSG" - done < "$MESSAGES_FILE" - fi - -done < "../../data/kafka/topics.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/005-send-http-static-requests.sh b/quickstart-setup/scripts/auto-executed/005-send-http-static-requests.sh deleted file mode 100755 index f5e476f8..00000000 --- a/quickstart-setup/scripts/auto-executed/005-send-http-static-requests.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function sendRequest() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) Request-Response OpenAPI service slug, 2) request body" - exit 11 - fi - - set -e - - local OPENAPI_SERVICE_SLUG=$1 - local REQUEST_BODY=$2 - - echo "Sending request '$REQUEST_BODY' to Request-Response '$OPENAPI_SERVICE_SLUG' OpenAPI service ..." - local RESPONSE - RESPONSE=$(../utils/http/send-request-to-nu-openapi-service.sh "$OPENAPI_SERVICE_SLUG" "$REQUEST_BODY") - echo "Response: $RESPONSE" -} - -echo "Starting to send preconfigured Request-Response OpenAPI service requests ..." - -while IFS= read -r OPENAPI_SERVICE_SLUG; do - - if [[ $OPENAPI_SERVICE_SLUG == "#"* ]]; then - continue - fi - - MESSAGES_FILE=$(find ../../data/http/static-requests -iname "$OPENAPI_SERVICE_SLUG.txt" | head) - - if [[ -f "$MESSAGES_FILE" ]]; then - while IFS= read -r REQUEST_BODY; do - if [[ $REQUEST_BODY == "#"* ]]; then - continue - fi - - sendRequest "$OPENAPI_SERVICE_SLUG" "$REQUEST_BODY" - done < "$MESSAGES_FILE" - fi - -done < "../../data/http/slugs.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/006-continuously-send-kafka-generated-messages.sh b/quickstart-setup/scripts/auto-executed/006-continuously-send-kafka-generated-messages.sh deleted file mode 100755 index 9ee573e1..00000000 --- a/quickstart-setup/scripts/auto-executed/006-continuously-send-kafka-generated-messages.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function runMessageSending() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) topic name, 2) message generator script" - exit 11 - fi - - set -e - - local TOPIC_NAME=$1 - local MSG_GENERATOR_SCRIPT=$2 - - echo "Starting to send to '$TOPIC_NAME' messages generated by '$MSG_GENERATOR_SCRIPT' generator script" - - mkdir -p /var/log/continuously-send-to-topic - nohup ../utils/kafka/continuously-send-to-topic.sh "$TOPIC_NAME" "$MSG_GENERATOR_SCRIPT" > /var/log/continuously-send-to-topic/output.log 2>&1 & -} - -echo "Starting to send generated messages ..." - -while IFS= read -r TOPIC_NAME; do - - if [[ $TOPIC_NAME == "#"* ]]; then - continue - fi - - MSG_GENERATION_SCRIPT=$(find ../../data/kafka/generate-messages -iname "$TOPIC_NAME.sh" | head) - - if [[ -f "$MSG_GENERATION_SCRIPT" ]]; then - runMessageSending "$TOPIC_NAME" "$(realpath $MSG_GENERATION_SCRIPT)" - fi - -done < "../../data/kafka/topics.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/auto-executed/007-continuously-send-http-generated-requests.sh b/quickstart-setup/scripts/auto-executed/007-continuously-send-http-generated-requests.sh deleted file mode 100755 index 6558ef1e..00000000 --- a/quickstart-setup/scripts/auto-executed/007-continuously-send-http-generated-requests.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -function runRequestSending() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) OpenAPI service slug, 2) request generator script" - exit 11 - fi - - set -e - - local OPENAPI_SERVICE_SLUG=$1 - local REQUEST_GENERATOR_SCRIPT=$2 - - echo "Starting to send to '$OPENAPI_SERVICE_SLUG' OpenAPI service, requests generated by '$REQUEST_GENERATOR_SCRIPT' generator script" - - mkdir -p /var/log/continuously-send-http-requests - nohup ../utils/http/continuously-send-http-requests.sh "$OPENAPI_SERVICE_SLUG" "$REQUEST_GENERATOR_SCRIPT" > /var/log/continuously-send-http-requests/output.log 2>&1 & -} - -echo "Starting to send generated requests to Nu OpenAPI services ..." - -while IFS= read -r OPENAPI_SERVICE_SLUG; do - - if [[ $OPENAPI_SERVICE_SLUG == "#"* ]]; then - continue - fi - - REQUEST_GENERATOR_SCRIPT=$(find ../../data/http/generate-requests -iname "$OPENAPI_SERVICE_SLUG.sh" | head) - - if [[ -f "$REQUEST_GENERATOR_SCRIPT" ]]; then - runRequestSending "$OPENAPI_SERVICE_SLUG" "$(realpath $REQUEST_GENERATOR_SCRIPT)" - fi - -done < "../../data/http/slugs.txt" - -echo -e "DONE!\n\n" diff --git a/quickstart-setup/scripts/utils/http/continuously-send-http-requests.sh b/quickstart-setup/scripts/utils/http/continuously-send-http-requests.sh deleted file mode 100755 index 1a7f4a8a..00000000 --- a/quickstart-setup/scripts/utils/http/continuously-send-http-requests.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 2 ]; then - echo "Two parameters required: 1) OpenAPI service slug, 2) request generator script path" - exit 1 -fi - -cd "$(dirname "$0")" - -source ../lib.sh - -OPENAPI_SERVICE_SLUG=$1 -REQUEST_GENERATOR_SCRIPT=$2 - -verifyBashScript "$REQUEST_GENERATOR_SCRIPT" - -while true; do - sleep 0.1 - ./send-request-to-nu-openapi-service.sh "$OPENAPI_SERVICE_SLUG" "$($REQUEST_GENERATOR_SCRIPT)" > /dev/null || true -done diff --git a/quickstart-setup/scripts/utils/http/send-request-to-nu-openapi-service.sh b/quickstart-setup/scripts/utils/http/send-request-to-nu-openapi-service.sh deleted file mode 100755 index debbd89c..00000000 --- a/quickstart-setup/scripts/utils/http/send-request-to-nu-openapi-service.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 2 ]; then - echo "Two parameters required: 1) Nu OpenAPI service slug, 2) request payload" - exit 1 -fi - -cd "$(dirname "$0")" - -OPENAPI_SERVICE_SLUG=$1 -REQUEST_BODY=$2 - -RESPONSE=$(curl -s -L -w "\n%{http_code}" \ - -X POST "http://nginx:8181/scenario/$OPENAPI_SERVICE_SLUG" \ - -H "Content-Type: application/json" -d "$REQUEST_BODY" -) - -HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) -RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - -if [[ "$HTTP_STATUS" != 200 ]] ; then - echo -e "'$OPENAPI_SERVICE_SLUG' OpenAPI service unexpected response.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 12 -fi - -echo "$RESPONSE_BODY" \ No newline at end of file diff --git a/quickstart-setup/scripts/utils/kafka/continuously-send-to-topic.sh b/quickstart-setup/scripts/utils/kafka/continuously-send-to-topic.sh deleted file mode 100755 index c96959ba..00000000 --- a/quickstart-setup/scripts/utils/kafka/continuously-send-to-topic.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 2 ]; then - echo "Two parameters required: 1) topic name, 2) generator script path" - exit 1 -fi - -cd "$(dirname "$0")" - -source ../lib.sh - -TOPIC=$1 -GENERATOR_SCRIPT=$2 - -verifyBashScript "$GENERATOR_SCRIPT" - -while true; do - sleep 0.1 - ./send-to-topic.sh "$TOPIC" "$($GENERATOR_SCRIPT)" || true -done diff --git a/quickstart-setup/scripts/utils/kafka/create-topic-idempotently.sh b/quickstart-setup/scripts/utils/kafka/create-topic-idempotently.sh deleted file mode 100755 index 198d4147..00000000 --- a/quickstart-setup/scripts/utils/kafka/create-topic-idempotently.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 1 ]; then - echo "One parameter required: 1) topic name" - exit 1 -fi - -cd "$(dirname "$0")" - -TOPIC_NAME=$1 - -/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server kafka:9092 --if-not-exists --topic "$TOPIC_NAME" \ No newline at end of file diff --git a/quickstart-setup/scripts/utils/kafka/purge-topic.sh b/quickstart-setup/scripts/utils/kafka/purge-topic.sh deleted file mode 100755 index c925330e..00000000 --- a/quickstart-setup/scripts/utils/kafka/purge-topic.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 1 ]; then - echo "One parameter required: 1) topic name" - exit 1 -fi - -cd "$(dirname "$0")" - -TOPIC_NAME=$1 -DELETE_TOPIC_ORDER_FILE="/tmp/delete-$TOPIC_NAME.json" - -trap 'rm "$DELETE_TOPIC_ORDER_FILE"' EXIT - -echo "{ \"partitions\": [{ \"topic\": \"$TOPIC_NAME\", \"partition\": 0, \"offset\": -1 }], \"version\": 1 }" > "$DELETE_TOPIC_ORDER_FILE" - -/opt/bitnami/kafka/bin/kafka-delete-records.sh --bootstrap-server kafka:9092 -offset-json-file "$DELETE_TOPIC_ORDER_FILE" diff --git a/quickstart-setup/scripts/utils/kafka/read-from-topic.sh b/quickstart-setup/scripts/utils/kafka/read-from-topic.sh deleted file mode 100755 index 7501eb07..00000000 --- a/quickstart-setup/scripts/utils/kafka/read-from-topic.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 1 ]; then - echo "One parameter required: 1) topic name" - exit 1 -fi - -cd "$(dirname "$0")" - -TOPIC_NAME=$1 - -kcat -C -b kafka:9092 -t "$TOPIC_NAME" -o beginning -e -q diff --git a/quickstart-setup/scripts/utils/kafka/send-to-topic.sh b/quickstart-setup/scripts/utils/kafka/send-to-topic.sh deleted file mode 100755 index 0d387168..00000000 --- a/quickstart-setup/scripts/utils/kafka/send-to-topic.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -e - -if [ "$#" -ne 2 ]; then - echo "Two parameters required: 1) topic name, 2) message" - exit 1 -fi - -cd "$(dirname "$0")" - -TOPIC=$1 -MESSAGE=$2 - -echo "$MESSAGE" | /opt/bitnami/kafka/bin/kafka-console-producer.sh --topic "$TOPIC" --bootstrap-server kafka:9092 diff --git a/quickstart-setup/scripts/utils/lib.sh b/quickstart-setup/scripts/utils/lib.sh deleted file mode 100755 index 00d7e439..00000000 --- a/quickstart-setup/scripts/utils/lib.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -e - -function verifyBashScript() { - local FILE=$1 - - if [[ -f "$FILE" ]]; then - if [[ $(head -n 1 "$FILE") =~ ^#!/bin/bash ]]; then - return 0 - else - echo "$FILE exists but is not a Bash script." - return 1 - fi - else - echo "$FILE does not exist." - return 2 - fi -} - -function random_4digit_number() { - od -An -t d -N 2 /dev/urandom | head -n 1 | tr -d ' ' | head -c 4 -} - -function random_3digit_number() { - random_4digit_number | head -c 3 -} - -function now() { - echo "$(date +%s)$(random_3digit_number)" -} - -function pick_randomly() { - local options=("$@") - local count=${#options[@]} - local random_index=$((RANDOM % count)) - echo "${options[$random_index]}" -} \ No newline at end of file diff --git a/quickstart-setup/scripts/utils/nu/deploy-scenario-and-wait-for-running-state.sh b/quickstart-setup/scripts/utils/nu/deploy-scenario-and-wait-for-running-state.sh deleted file mode 100755 index 17f3a67c..00000000 --- a/quickstart-setup/scripts/utils/nu/deploy-scenario-and-wait-for-running-state.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -if [ "$#" -lt 1 ]; then - echo "Error: One parameter required: 1) scenario name" - exit 1 -fi - -SCENARIO_NAME=$1 -TIMEOUT_SECONDS=${2:-60} -WAIT_INTERVAL=5 - -function deployScenario() { - if [ "$#" -ne 1 ]; then - echo "Error: One parameter required: 1) scenario name" - exit 11 - fi - - set -e - - local SCENARIO_NAME=$1 - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X POST "http://nginx:8080/api/processManagement/deploy/$SCENARIO_NAME" - ) - - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - - if [ "$HTTP_STATUS" != "200" ]; then - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - echo -e "Error: Cannot run scenario $SCENARIO_NAME deployment.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 12 - fi - - echo "Scenario $SCENARIO_NAME deployment started ..." -} - -function checkDeploymentStatus() { - if [ "$#" -ne 1 ]; then - echo "Error: One parameter required: 1) scenario name" - exit 21 - fi - - set -e - - local SCENARIO_NAME=$1 - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X GET "http://nginx:8080/api/processes/$SCENARIO_NAME/status" - ) - - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - - if [ "$HTTP_STATUS" != "200" ]; then - echo -e "Error: Cannot check scenario $SCENARIO_NAME deployment status.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 22 - fi - - local SCENARIO_STATUS - SCENARIO_STATUS=$(echo "$RESPONSE_BODY" | jq -r '.status.name') - echo "$SCENARIO_STATUS" -} - -echo "Deploying scenario $SCENARIO_NAME ..." - -START_TIME=$(date +%s) -END_TIME=$((START_TIME + TIMEOUT_SECONDS)) - -deployScenario "$SCENARIO_NAME" - -while true; do - DEPLOYMENT_STATUS=$(checkDeploymentStatus "$SCENARIO_NAME") - - if [ "$DEPLOYMENT_STATUS" == "RUNNING" ]; then - break - fi - - CURRENT_TIME=$(date +%s) - if [ $CURRENT_TIME -gt $END_TIME ]; then - echo "Error: Timeout for waiting for the RUNNING state of $SCENARIO_NAME deployment reached!" - exit 2 - fi - - echo "$SCENARIO_NAME deployment state is $DEPLOYMENT_STATUS. Checking again in $WAIT_INTERVAL seconds..." - sleep $WAIT_INTERVAL -done - -echo "Scenario $SCENARIO_NAME is RUNNING!" diff --git a/quickstart-setup/scripts/utils/nu/load-scenario-from-json-file.sh b/quickstart-setup/scripts/utils/nu/load-scenario-from-json-file.sh deleted file mode 100755 index e5e0378a..00000000 --- a/quickstart-setup/scripts/utils/nu/load-scenario-from-json-file.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -if [ "$#" -lt 2 ]; then - echo "Error: Two parameters required: 1) scenario name, 2) scenario file path" - exit 1 -fi - -SCENARIO_NAME=$1 -SCENARIO_FILE_PATH=$2 -CATEGORY=${3:-"Default"} - -if [ ! -f "$SCENARIO_FILE_PATH" ]; then - echo "Error: Cannot find file $SCENARIO_FILE_PATH with scenario" - exit 2 -fi - -function createEmptyScenario() { - if [ "$#" -ne 4 ]; then - echo "Error: Four parameters required: 1) scenario name, 2) processing mode, 3) category, 4) engine" - exit 11 - fi - - set -e - - local SCENARIO_NAME=$1 - local PROCESSING_MODE=$2 - local CATEGORY=$3 - local ENGINE=$4 - - local REQUEST_BODY="{ - \"name\": \"$SCENARIO_NAME\", - \"processingMode\": \"$PROCESSING_MODE\", - \"category\": \"$CATEGORY\", - \"engineSetupName\": \"$ENGINE\", - \"isFragment\": false - }" - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X POST "http://nginx:8080/api/processes" \ - -H "Content-Type: application/json" -d "$REQUEST_BODY" - ) - - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - - if [ "$HTTP_STATUS" == "400" ]; then - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - - if [[ "$RESPONSE_BODY" == *"already exists"* ]]; then - echo "Scenario already exists." - exit 0 - else - echo -e "Error: Cannot create empty scenario $SCENARIO_NAME.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 12 - fi - elif [ "$HTTP_STATUS" != "201" ]; then - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - echo -e "Error: Cannot create empty scenario $SCENARIO_NAME.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 12 - fi - - echo "Empty scenario $SCENARIO_NAME created successfully." -} - -function importScenarioFromFile() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) scenario name, 2) scenario file path" - exit 21 - fi - - set -e - - local SCENARIO_NAME=$1 - local SCENARIO_FILE=$2 - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X POST "http://nginx:8080/api/processes/import/$SCENARIO_NAME" \ - -F "process=@$SCENARIO_FILE" - ) - - # Check response body and status code - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - - if [ "$HTTP_STATUS" == "200" ]; then - local SCENARIO_GRAPH - SCENARIO_GRAPH=$(echo "$RESPONSE_BODY" | jq '.scenarioGraph') - echo "$SCENARIO_GRAPH" - else - echo -e "Error: Cannot import scenario $SCENARIO_NAME.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 22 - fi -} - -function saveScenario() { - if [ "$#" -ne 2 ]; then - echo "Error: Two parameters required: 1) scenario name, 2) scenario graph JSON representation" - exit 31 - fi - - set -e - - local SCENARIO_NAME=$1 - local SCENARIO_GRAPH_JSON=$2 - - local REQUEST_BODY="{ - \"scenarioGraph\": $SCENARIO_GRAPH_JSON, - \"comment\": \"\" - }" - - local RESPONSE - RESPONSE=$(curl -s -L -w "\n%{http_code}" -u admin:admin \ - -X PUT "http://nginx:8080/api/processes/$SCENARIO_NAME" \ - -H "Content-Type: application/json" -d "$REQUEST_BODY" - ) - - local HTTP_STATUS - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - - if [ "$HTTP_STATUS" != "200" ]; then - local RESPONSE_BODY - RESPONSE_BODY=$(echo "$RESPONSE" | sed \$d) - echo -e "Error: Cannot save scenario $SCENARIO_NAME.\nHTTP status: $HTTP_STATUS, response body: $RESPONSE_BODY" - exit 32 - fi - - echo "Scenario $SCENARIO_NAME saved successfully." -} - -META_DATA_TYPE=$(jq -r .metaData.additionalFields.metaDataType < "$SCENARIO_FILE_PATH") -case "$META_DATA_TYPE" in - "StreamMetaData") - ENGINE="Flink" - PROCESSING_MODE="Unbounded-Stream" - ;; - "LiteStreamMetaData") - ENGINE="Lite Embedded" - PROCESSING_MODE="Unbounded-Stream" - ;; - "RequestResponseMetaData") - ENGINE="Lite Embedded" - PROCESSING_MODE="Request-Response" - ;; - *) - echo "Error: Cannot import scenario with metadata type: $META_DATA_TYPE" - exit 2 - ;; -esac - -createEmptyScenario "$SCENARIO_NAME" "$PROCESSING_MODE" "$CATEGORY" "$ENGINE" -SCENARIO_GRAPH=$(importScenarioFromFile "$SCENARIO_NAME" "$SCENARIO_FILE_PATH") -saveScenario "$SCENARIO_NAME" "$SCENARIO_GRAPH" diff --git a/quickstart-setup/scripts/utils/nu/load-scenario-from-json.sh b/quickstart-setup/scripts/utils/nu/load-scenario-from-json.sh deleted file mode 100755 index 8e80c5e7..00000000 --- a/quickstart-setup/scripts/utils/nu/load-scenario-from-json.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e - -cd "$(dirname "$0")" - -if [ "$#" -lt 2 ]; then - echo "Error: Two parameters required: 1) scenario name, 2) scenario JSON" - exit 1 -fi - -SCENARIO_NAME=$1 -SCENARIO_JSON=$2 -SCENARIO_JSON_FILE="/tmp/scenario-$SCENARIO_NAME.json" - -echo "$SCENARIO_JSON" > "$SCENARIO_JSON_FILE" -trap 'rm "$SCENARIO_JSON_FILE"' EXIT - -./load-scenario-from-json-file.sh "$SCENARIO_NAME" "$SCENARIO_JSON_FILE" diff --git a/quickstart-setup/setup/kafka/topics.txt b/quickstart-setup/setup/kafka/topics.txt deleted file mode 100644 index adc69ddf..00000000 --- a/quickstart-setup/setup/kafka/topics.txt +++ /dev/null @@ -1,5 +0,0 @@ -# List of topics that should be created -Customers -ProcessedTransactions -SmsesWithOffer -Transactions diff --git a/quickstart-setup/setup/nu/examples.txt b/quickstart-setup/setup/nu/examples.txt deleted file mode 100644 index 3cb0625d..00000000 --- a/quickstart-setup/setup/nu/examples.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Scenarios to put as examples (file with scenario from the scenarios folder per line) -DetectLargeTransactions.json -#DetermineOfferedPlan.json -LoanRequest.json diff --git a/quickstart-setup/setup/nu/scenarios/DetectLargeTransactions.json b/quickstart-setup/setup/nu/scenarios/DetectLargeTransactions.json deleted file mode 100644 index 5523b1af..00000000 --- a/quickstart-setup/setup/nu/scenarios/DetectLargeTransactions.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "metaData": { - "id": "DetectLargeTransactions", - "additionalFields": { - "description": null, - "properties": { - "parallelism": "1", - "spillStateToDisk": "true" - }, - "metaDataType": "StreamMetaData" - } - }, - "nodes": [ - { - "id": "transactions", - "ref": { - "typ": "kafka", - "parameters": [ - { - "name": "Topic", - "expression": { - "language": "spel", - "expression": "'Transactions'" - } - }, - { - "name": "Schema version", - "expression": { - "language": "spel", - "expression": "'latest'" - } - } - ] - }, - "additionalFields": { - "description": null, - "layoutData": { - "x": 0, - "y": 0 - } - }, - "type": "Source" - }, - { - "nextFalse": [ - ], - "id": "only large ones", - "expression": { - "language": "spel", - "expression": "#input.amount > 20" - }, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 0, - "y": 180 - } - }, - "type": "Filter" - }, - { - "id": "send for audit", - "ref": { - "typ": "kafka", - "parameters": [ - { - "name": "Topic", - "expression": { - "language": "spel", - "expression": "'ProcessedTransactions'" - } - }, - { - "name": "Schema version", - "expression": { - "language": "spel", - "expression": "'latest'" - } - }, - { - "name": "Key", - "expression": { - "language": "spel", - "expression": "" - } - }, - { - "name": "Raw editor", - "expression": { - "language": "spel", - "expression": "true" - } - }, - { - "name": "Value validation mode", - "expression": { - "language": "spel", - "expression": "'strict'" - } - }, - { - "name": "Value", - "expression": { - "language": "spel", - "expression": "#input" - } - } - ] - }, - "endResult": null, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 0, - "y": 360 - } - }, - "type": "Sink" - } - ], - "additionalBranches": [ - ] -} diff --git a/quickstart-setup/setup/nu/scenarios/DetermineOfferedPlan.json b/quickstart-setup/setup/nu/scenarios/DetermineOfferedPlan.json deleted file mode 100644 index c73aad21..00000000 --- a/quickstart-setup/setup/nu/scenarios/DetermineOfferedPlan.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "metaData" : { - "id" : "DetermineOfferedPlan", - "additionalFields": { - "description": null, - "properties": { - "parallelism": "1", - "spillStateToDisk": "true" - }, - "metaDataType": "StreamMetaData" - } - }, - "nodes" : [ - { - "id" : "Customers", - "ref" : { - "typ" : "kafka", - "parameters" : [ - { - "name" : "Topic", - "expression" : { - "language" : "spel", - "expression" : "'Customers'" - } - }, - { - "name" : "Schema version", - "expression" : { - "language" : "spel", - "expression" : "'latest'" - } - } - ] - }, - "additionalFields" : { - "description" : null, - "layoutData" : { - "x" : 181, - "y" : 10 - } - }, - "type" : "Source" - }, - { - "id" : "DecisionTable", - "service" : { - "id" : "decision-table", - "parameters" : [ - { - "name" : "Decision Table", - "expression" : { - "language" : "tabularDataDefinition", - "expression" : "{\n \"rows\": [\n [\n null,\n \"17\",\n null,\n null,\n \"Junior Package\"\n ],\n [\n \"18\",\n \"30\",\n \"Male\",\n \"true\",\n \"Premium Data Plan\"\n ],\n [\n \"18\",\n \"30\",\n \"Male\",\n \"false\",\n \"Standard Data Plan\"\n ],\n [\n \"18\",\n \"30\",\n \"Female\",\n \"true\",\n \"Premium Data Plan\"\n ],\n [\n \"18\",\n \"30\",\n \"Female\",\n \"false\",\n \"Standard Data Plan\"\n ],\n [\n \"31\",\n \"50\",\n \"Male\",\n \"true\",\n \"Family Package\"\n ],\n [\n \"31\",\n \"50\",\n null,\n \"false\",\n \"Standard Data Plan\"\n ],\n [\n \"51\",\n null,\n null,\n null,\n \"Senior Citizen Plan\"\n ]\n ],\n \"columns\": [\n {\n \"name\": \"MinAge\",\n \"type\": \"java.lang.Integer\"\n },\n {\n \"name\": \"MaxAge\",\n \"type\": \"java.lang.Integer\"\n },\n {\n \"name\": \"Gender\",\n \"type\": \"java.lang.String\"\n },\n {\n \"name\": \"IsBigSpender\",\n \"type\": \"java.lang.Boolean\"\n },\n {\n \"name\": \"OfferedPlan\",\n \"type\": \"java.lang.String\"\n }\n ]\n}" - } - }, - { - "name" : "Match condition", - "expression" : { - "language" : "spel", - "expression" : "(#ROW.MinAge != null ? #input.age > #ROW.MinAge : true) && \n(#ROW.MaxAge != null ? #input.age <= #ROW.MaxAge : true) && \n(#ROW.Gender != null ? #input.gender == #ROW.Gender : true) && \n(#ROW.IsBigSpender != null ? #input.isBigSpender == #ROW.IsBigSpender : true)" - } - } - ] - }, - "output" : "offeredPlans", - "additionalFields" : { - "description" : "Plans assigned to customers", - "layoutData" : { - "x" : 180, - "y" : 180 - } - }, - "type" : "Enricher" - }, - { - "id" : "OfferedPlansOutput", - "varName" : "outputVar", - "value" : { - "language" : "spel", - "expression" : "#offeredPlans" - }, - "additionalFields" : { - "description" : "list of cars that need service", - "layoutData" : { - "x" : 180, - "y" : 360 - } - }, - "type" : "Variable" - }, - { - "nextFalse" : [ - { - "id" : "SendPremiumPlanSMS", - "ref" : { - "typ" : "kafka", - "parameters" : [ - { - "name" : "Topic", - "expression" : { - "language" : "spel", - "expression" : "'SmsesWithOffer'" - } - }, - { - "name" : "Schema version", - "expression" : { - "language" : "spel", - "expression" : "'latest'" - } - }, - { - "name" : "Key", - "expression" : { - "language" : "spel", - "expression" : "" - } - }, - { - "name" : "Raw editor", - "expression" : { - "language" : "spel", - "expression" : "false" - } - }, - { - "name" : "assignedOffer", - "expression" : { - "language" : "spel", - "expression" : "#offeredPlans[0].OfferedPlan" - } - }, - { - "name" : "name", - "expression" : { - "language" : "spel", - "expression" : "#input.name" - } - } - ] - }, - "endResult" : null, - "isDisabled" : null, - "additionalFields" : { - "description" : null, - "layoutData" : { - "x" : 446, - "y" : 708 - } - }, - "type" : "Sink" - } - ], - "id" : "IsStandardPlan", - "expression" : { - "language" : "spel", - "expression" : "#offeredPlans[0].OfferedPlan == \"Standard Data Plan\"" - }, - "isDisabled" : null, - "additionalFields" : { - "description" : null, - "layoutData" : { - "x" : 180, - "y" : 540 - } - }, - "type" : "Filter" - }, - { - "id" : "dead-end", - "ref" : { - "typ" : "dead-end", - "parameters" : [ - ] - }, - "endResult" : null, - "isDisabled" : null, - "additionalFields" : { - "description" : null, - "layoutData" : { - "x" : -73, - "y" : 714 - } - }, - "type" : "Sink" - } - ], - "additionalBranches" : [ - ] -} diff --git a/quickstart-setup/setup/nu/scenarios/LoanRequest.json b/quickstart-setup/setup/nu/scenarios/LoanRequest.json deleted file mode 100644 index a18e4079..00000000 --- a/quickstart-setup/setup/nu/scenarios/LoanRequest.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "metaData": { - "id": "LoanRequest", - "additionalFields": { - "description": null, - "properties": { - "inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"customerId\": {\n \"type\": \"string\"\n },\n \"location\": {\n \"type\": \"object\",\n \"properties\": {\n \"city\": {\n \"type\": \"string\"\n },\n \"street\": {\n \"type\": \"string\"\n }\n }\n },\n \"requestType\": {\n \"type\": \"string\"\n },\n \"requestedAmount\": {\n \"type\": \"number\"\n }\n },\n \"required\": [\"customerId\", \"location\", \"requestType\", \"requestedAmount\"],\n \"additionalProperties\": false\n}", - "outputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"acceptedAmount\": {\n \"type\": \"number\",\n \"description\": \"Accepted amount\"\n },\n \"message\": {\n \"type\": \"string\",\n \"description\": \"Additional message\"\n }\n },\n \"required\": [\"acceptedAmount\", \"message\"],\n \"additionalProperties\": false\n}", - "slug": "loan" - }, - "metaDataType": "RequestResponseMetaData" - } - }, - "nodes": [ - { - "id": "request", - "ref": { - "typ": "request", - "parameters": [ - ] - }, - "additionalFields": { - "description": null, - "layoutData": { - "x": 360, - "y": 0 - } - }, - "type": "Source" - }, - { - "defaultNext": [ - ], - "nexts": [ - { - "expression": { - "language": "spel", - "expression": "#input.requestType == 'loan'" - }, - "nodes": [ - { - "id": "loan response", - "ref": { - "typ": "response", - "parameters": [ - { - "name": "acceptedAmount", - "expression": { - "language": "spel", - "expression": "50" - } - }, - { - "name": "message", - "expression": { - "language": "spel", - "expression": "'only small amount available'" - } - } - ] - }, - "endResult": null, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 0, - "y": 360 - } - }, - "type": "Sink" - } - ] - }, - { - "expression": { - "language": "spel", - "expression": "#input.requestType == 'mortgage'" - }, - "nodes": [ - { - "defaultNext": [ - ], - "nexts": [ - { - "expression": { - "language": "spel", - "expression": "#input.location.city == 'Warszawa'" - }, - "nodes": [ - { - "id": "Warsaw mortgage", - "ref": { - "typ": "response", - "parameters": [ - { - "name": "acceptedAmount", - "expression": { - "language": "spel", - "expression": "1000" - } - }, - { - "name": "message", - "expression": { - "language": "spel", - "expression": "'Large sum for Warszawa'" - } - } - ] - }, - "endResult": null, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 180, - "y": 540 - } - }, - "type": "Sink" - } - ] - }, - { - "expression": { - "language": "spel", - "expression": "true" - }, - "nodes": [ - { - "id": "Other city mortgage", - "ref": { - "typ": "response", - "parameters": [ - { - "name": "Raw editor", - "expression": { - "language": "spel", - "expression": "false" - } - }, - { - "name": "acceptedAmount", - "expression": { - "language": "spel", - "expression": "100" - } - }, - { - "name": "message", - "expression": { - "language": "spel", - "expression": "'Large sum for other city'" - } - } - ] - }, - "endResult": null, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 540, - "y": 540 - } - }, - "type": "Sink" - } - ] - } - ], - "id": "switch", - "additionalFields": { - "description": null, - "layoutData": { - "x": 360, - "y": 360 - } - }, - "type": "Switch" - } - ] - }, - { - "expression": { - "language": "spel", - "expression": "true" - }, - "nodes": [ - { - "id": "unknown", - "ref": { - "typ": "response", - "parameters": [ - { - "name": "acceptedAmount", - "expression": { - "language": "spel", - "expression": "0" - } - }, - { - "name": "message", - "expression": { - "language": "spel", - "expression": "'Unknown loan type'" - } - } - ] - }, - "endResult": null, - "isDisabled": null, - "additionalFields": { - "description": null, - "layoutData": { - "x": 720, - "y": 360 - } - }, - "type": "Sink" - } - ] - } - ], - "id": "loan type", - "additionalFields": { - "description": null, - "layoutData": { - "x": 360, - "y": 180 - } - }, - "type": "Switch" - } - ], - "additionalBranches": [ - ] - } \ No newline at end of file diff --git a/quickstart-setup/setup/schema-registry/active-schemas.txt b/quickstart-setup/setup/schema-registry/active-schemas.txt deleted file mode 100644 index 493e59d5..00000000 --- a/quickstart-setup/setup/schema-registry/active-schemas.txt +++ /dev/null @@ -1,5 +0,0 @@ -# JSON schemas to load (JSON schema file name from the schemas folder per line) -#Customers.schema.json -ProcessedTransactions.schema.json -#SmsesWithOffer.schema.json -Transactions.schema.json diff --git a/quickstart-setup/setup/schema-registry/schemas/Customers.schema.json b/quickstart-setup/setup/schema-registry/schemas/Customers.schema.json deleted file mode 100644 index 109af2e1..00000000 --- a/quickstart-setup/setup/schema-registry/schemas/Customers.schema.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "type": "object", - "title": "Person", - "$schema": "http://json-schema.org/draft-07/schema#", - "required": [ - "name" - ], - "properties": { - "gender": { - "description": "The person's gender", - "type": "string", - "enum": [ - "Male", - "Female" - ] - }, - "name": { - "type": "string", - "description": "The person's full name" - }, - "isBigSpender": { - "description": "Indicates if the person is a big spender", - "type": "boolean" - }, - "age": { - "type": "integer", - "description": "The person's age in years" - } - } -} diff --git a/quickstart-setup/setup/schema-registry/schemas/ProcessedTransactions.schema.json b/quickstart-setup/setup/schema-registry/schemas/ProcessedTransactions.schema.json deleted file mode 100644 index ca3c0d02..00000000 --- a/quickstart-setup/setup/schema-registry/schemas/ProcessedTransactions.schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "type": "object", - "properties": { - "clientId": { "type": "string" }, - "amount": { "type": "integer" }, - "isLast": { "type": "boolean", "default": false }, - "eventDate": { "type": "integer" } - }, - "required": ["clientId", "amount"], - "additionalProperties": false -} diff --git a/quickstart-setup/setup/schema-registry/schemas/SmsesWithOffer.schema.json b/quickstart-setup/setup/schema-registry/schemas/SmsesWithOffer.schema.json deleted file mode 100644 index 7a928e75..00000000 --- a/quickstart-setup/setup/schema-registry/schemas/SmsesWithOffer.schema.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "object", - "title": "OfferAssignment", - "$schema": "http://json-schema.org/draft-07/schema#", - "required": [ - "assignedOffer", - "name" - ], - "properties": { - "assignedOffer": { - "type": "string", - "description": "The assigned offer for the person" - }, - "name": { - "type": "string", - "description": "The person's full name" - } - } -} diff --git a/quickstart-setup/setup/schema-registry/schemas/Transactions.schema.json b/quickstart-setup/setup/schema-registry/schemas/Transactions.schema.json deleted file mode 100644 index ca3c0d02..00000000 --- a/quickstart-setup/setup/schema-registry/schemas/Transactions.schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "type": "object", - "properties": { - "clientId": { "type": "string" }, - "amount": { "type": "integer" }, - "isLast": { "type": "boolean", "default": false }, - "eventDate": { "type": "integer" } - }, - "required": ["clientId", "amount"], - "additionalProperties": false -} diff --git a/start.bat b/start.bat index 0265b47d..7660bf03 100644 --- a/start.bat +++ b/start.bat @@ -2,29 +2,29 @@ chcp 65001 >nul setlocal enabledelayedexpansion -echo Running Nussknacker Quickstart ... +echo Running Nussknacker Quickstart... echo. docker --version >nul 2>&1 if errorlevel 1 ( - echo No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/ + echo ERROR: No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/ exit /b 1 ) docker compose version >nul 2>&1 if errorlevel 1 ( - echo No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ + echo ERROR: No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ exit /b 2 ) docker compose config >nul 2>&1 if errorlevel 1 ( - echo Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ + echo ERROR: Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ exit /b 3 ) -docker compose up -d --build --wait +docker compose up -d --build --remove-orphans --wait echo. echo Nussknacker and its dependencies are up and running. -echo Open http://localhost:8080 and log in as admin:admin ... +echo Open http://localhost:8080 and log in as admin:admin... diff --git a/start.sh b/start.sh index d8924e9f..e0cb5293 100755 --- a/start.sh +++ b/start.sh @@ -15,26 +15,26 @@ echo -e " " -echo "Running Nussknacker Quickstart ..." +echo "Running Nussknacker Quickstart..." echo "" if ! docker version &>/dev/null; then - echo "No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/" + echo "ERROR: No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/" exit 1 fi if ! docker compose version &>/dev/null; then - echo "No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" + echo "ERROR: No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" exit 2 fi if ! docker compose config > /dev/null; then - echo "Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" + echo "ERROR: Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" exit 3 fi -docker compose up -d --build --wait +docker compose up -d --build --remove-orphans --wait echo "" echo "Nussknacker and its dependencies are up and running." -echo "Open http://localhost:8080 and log in as admin:admin ..." +echo "Open http://localhost:8080 and log in as admin:admin..." diff --git a/stop-and-clean.bat b/stop-and-clean.bat index 9fb2e1f0..a89fffd1 100644 --- a/stop-and-clean.bat +++ b/stop-and-clean.bat @@ -3,24 +3,24 @@ setlocal enabledelayedexpansion cd /d "%~dp0" -echo Running Nussknacker Quickstart clean up ... +echo Running Nussknacker Quickstart clean up... echo. docker --version >nul 2>&1 if errorlevel 1 ( - echo No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/ + echo ERROR: No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/ exit /b 1 ) docker compose version >nul 2>&1 if errorlevel 1 ( - echo No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ + echo ERROR: No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ exit /b 2 ) docker compose config >nul 2>&1 if errorlevel 1 ( - echo Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ + echo ERROR: Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/ exit /b 3 ) diff --git a/stop-and-clean.sh b/stop-and-clean.sh index 4d65bb9e..5f4153a7 100755 --- a/stop-and-clean.sh +++ b/stop-and-clean.sh @@ -3,21 +3,21 @@ set -e cd "$(dirname "$0")" -echo "Running Nussknacker Quickstart clean up ..." +echo "Running Nussknacker Quickstart clean up... " echo "" if ! docker version &>/dev/null; then - echo "No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/" + echo "ERROR: No Docker found. Docker is required to run this Quickstart. See https://docs.docker.com/engine/install/" exit 1 fi if ! docker compose version &>/dev/null; then - echo "No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" + echo "ERROR: No docker compose found. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" exit 2 fi if ! docker compose config > /dev/null; then - echo "Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" + echo "ERROR: Cannot validate docker compose configuration. It seems you have to upgrade your Docker installation. See https://docs.docker.com/engine/install/" exit 3 fi