diff --git a/src/local/README.md b/src/local/README.md index 48060d3ccd..34b646c8d4 100644 --- a/src/local/README.md +++ b/src/local/README.md @@ -12,15 +12,20 @@ Downloads all applications needed by `create-containers.sh` from Maven repositor Usage: `download-apps.sh [version]` * `version` is the dataflow-server version like `2.10.3`. Default is `2.11.3-SNAPSHOT` -## `create-containers.sh` -Creates all containers and pushes to local docker registry. +## `launch-dataflow.sh` +Uses docker compose to launch a database, broker, skipper and dataflow server. -This script requires [jib-cli](https://github.com/GoogleContainerTools/jib/tree/master/jib-cli) +## `launch-with-keycloak.sh` +Uses docker compose to launch a database, broker, skipper and dataflow server and a Keycloak server that loads the `dataflow` realm from `./src/local/data` which define a single user named `joe` with password `password` -Usage: `create-containers.sh [version] [jre-version]` -* `version` is the dataflow-server version like `2.9.6`. Default is `2.11.3-SNAPSHOT` -* `jre-version` should be one of 11, 17. Default is 11 +## `stop-dataflow.sh` +Stops docker-compose and all running Java instances based on the pid files. +## `launch-keycloak.sh` +Launches standalone Keycloak and loads the dataflow realm from `./src/local/data` which define a single user named `joe` with password `password` + +## `tail-container-log.sh` +Finds a container with provided name and tails the stdout of the container. ## Testing with Keycloak ### Build with Java 17 @@ -39,4 +44,6 @@ Arguments: `--spring.cloud.dataflow.features.streams-enabled=false --spring.clou ### Run -java -jar spring-cloud-dataflow-server/target/spring-cloud-dataflow-server-3.0.0-SNAPSHOT.jar --spring.cloud.dataflow.features.streams-enabled=false --spring.cloud.dataflow.features.tasks-enabled=true --spring.cloud.dataflow.features.schedules-enabled=false --spring.config.additional-location="src/local/application-dataflow-keycloak.yaml" \ No newline at end of file +```shell +java -jar spring-cloud-dataflow-server/target/spring-cloud-dataflow-server-3.0.0-SNAPSHOT.jar --spring.cloud.dataflow.features.streams-enabled=false --spring.cloud.dataflow.features.tasks-enabled=true --spring.cloud.dataflow.features.schedules-enabled=false --spring.config.additional-location="src/local/application-dataflow-keycloak.yaml" +``` \ No newline at end of file diff --git a/src/local/application-dataflow-keycloak.yaml b/src/local/application-dataflow-keycloak.yaml index f207ab5c59..c0e265fbdd 100644 --- a/src/local/application-dataflow-keycloak.yaml +++ b/src/local/application-dataflow-keycloak.yaml @@ -31,6 +31,7 @@ spring: redirect-uri: '{baseUrl}/login/oauth2/code/{registrationId}' client-id: 'dataflow' client-name: 'dataflow' + # aligns with the realm imported from the data directory client-secret: '090RucamvekrMLyGHMr4lkHX9xhAlsqK' provider: 'keycloak' authorization-grant-type: 'authorization_code' @@ -41,6 +42,7 @@ spring: opaquetoken: introspection-uri: http://localhost:8080/realms/dataflow/protocol/openid-connect/token/introspect client-id: 'dataflow' + # aligns with the realm imported from the data directory client-secret: '090RucamvekrMLyGHMr4lkHX9xhAlsqK' logging: diff --git a/src/local/application-skipper-keycloak.yaml b/src/local/application-skipper-keycloak.yaml index 9d2b936371..93a5f96e54 100644 --- a/src/local/application-skipper-keycloak.yaml +++ b/src/local/application-skipper-keycloak.yaml @@ -31,6 +31,7 @@ spring: redirect-uri: '{baseUrl}/login/oauth2/code/{registrationId}' client-id: 'dataflow' client-name: 'dataflow' + # aligns with the realm imported from the data directory client-secret: '090RucamvekrMLyGHMr4lkHX9xhAlsqK' provider: 'keycloak' authorization-grant-type: 'authorization_code' @@ -41,4 +42,5 @@ spring: opaquetoken: introspection-uri: http://localhost:8080/realms/dataflow/protocol/openid-connect/token/introspect client-id: 'dataflow' + # aligns with the realm imported from the data directory client-secret: '090RucamvekrMLyGHMr4lkHX9xhAlsqK' diff --git a/src/local/create-containers.sh b/src/local/create-containers.sh deleted file mode 100755 index 79b3d4460a..0000000000 --- a/src/local/create-containers.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -if [ -z "$BASH_VERSION" ]; then - echo "This script requires Bash. Use: bash $0 $*" - exit 0 -fi -SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") -SCDIR=$(realpath $SCDIR) -ROOT_DIR=$(realpath $SCDIR/../..) - -# set to specific version -if [ "$1" != "" ]; then - TAG=$1 -else - TAG=2.11.3-SNAPSHOT -fi -if [ "$2" != "" ]; then - v=$2 -else - v=17 -fi -PROCESSOR=$(uname -p) -# export ARCH=arm64v8 for ARM64 image -if [ "$ARCH" == "" ]; then - case $PROCESSOR in - "x86_64") - ARCH=amd64 - ;; - *) - if [[ "$PROCESSOR" == *"arm"* ]]; then - ARCH=arm64v8 - fi - ;; - esac -fi -CRED= -if [ "$DOCKER_USERNAME" != "" ]; then - echo "Using $DOCKER_USERNAME for docker.io" - CRED="--from-username=$DOCKER_USERNAME --from-password=$DOCKER_PASSWORD" -fi -# set with extra option for buildpacks. BP_OPTIONS= -IMAGE="$ARCH/eclipse-temurin:$v-jdk-jammy" -APPS=("spring-cloud-dataflow-server" "spring-cloud-dataflow-composed-task-runner" "spring-cloud-dataflow-single-step-batch-job") -for app in ${APPS[@]}; do - APP_PATH="$ROOT_DIR/$app/target" - if [ ! -f "$APP_PATH/$app-$TAG.jar" ]; then - echo "Cannot find $APP_PATH/$app-$TAG.jar download using download-apps.sh or build using ./mvnw install" - exit 1 - fi - jib jar --from=$IMAGE $CRED --target=docker://springcloud/$app:$TAG $APP_PATH/$app-$TAG.jar - # docker tag springcloud/$app:$TAG springcloud/$app:$ARCH -done -TS_APPS=("spring-cloud-dataflow-tasklauncher-sink-kafka" "spring-cloud-dataflow-tasklauncher-sink-rabbit") -for app in ${TS_APPS[@]}; do - APP_PATH="$ROOT_DIR/spring-cloud-dataflow-tasklauncher/$app/target" - if [ ! -f "$APP_PATH/$app-$TAG.jar" ]; then - echo "Cannot find $APP_PATH/$app-$TAG.jar download using download-apps.sh or build using ./mvnw install" - exit 1 - fi - jib jar --from=$IMAGE $CRED --target=docker://springcloud/$app:$TAG $APP_PATH/$app-$TAG.jar -done - -pushd $ROOT_DIR >/dev/null -docker build -t springcloud/spring-cloud-dataflow-prometheus-local:$TAG src/grafana/prometheus/docker/prometheus-local -popd >/dev/null diff --git a/src/local/launch-with-keycloak.sh b/src/local/launch-with-keycloak.sh index 1abeb22452..2a9a1052b0 100755 --- a/src/local/launch-with-keycloak.sh +++ b/src/local/launch-with-keycloak.sh @@ -89,5 +89,4 @@ echo "$!" > dataflow.pid echo "Waiting for Data Flow Server" wget --retry-connrefused --read-timeout=20 --timeout=15 --tries=10 --continue -q http://localhost:9393 echo "Data flow running" -# docker run -v ${SCDIR}/data:/opt/keycloak/data/import -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin keycloak/keycloak:25.0 start-dev --import-realm --verbose fi \ No newline at end of file