Prepare all scripts to deploy spring

authorization server
This commit is contained in:
Marcial Rosales 2025-06-06 17:11:01 +02:00
parent b3700ca6d9
commit 832fe78373
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
SPRING_DOCKER_IMAGE=pivotalrabbitmq/spring-authorization-server
ensure_spring() {
if docker ps | grep spring &> /dev/null; then
print "spring already running ..."
else
start_spring
fi
}
init_spring() {
SPRING_CONFIG_PATH=${SPRING_CONFIG_PATH:-oauth/spring}
SPRING_CONFIG_DIR=$(realpath ${TEST_DIR}/${SPRING_CONFIG_PATH})
SPRING_URL=${SPRING_URL:-OAUTH_PROVIDER_URL}
print "> SPRING_CONFIG_DIR: ${SPRING_CONFIG_DIR}"
print "> SPRING_URL: ${SPRING_URL}"
print "> SPRING_DOCKER_IMAGE: ${SPRING_DOCKER_IMAGE}"
generate-ca-server-client-kpi spring $SPRING_CONFIG_DIR
}
start_spring() {
begin "Starting spring ..."
init_spring
kill_container_if_exist spring
MOUNT_SPRING_CONF_DIR=$CONF_DIR/spring
mkdir -p $MOUNT_SPRING_CONF_DIR
# ${BIN_DIR}/gen-spring-yml ${SPRINGCONFIG_DIR} "test-realm" $ENV_FILE $MOUNT_KEYCLOAK_CONF_DIR/test-realm.json
print "> EFFECTIVE SPRING_CONFIG_FILE: $MOUNT_SPRING_CONF_DIR/application.yml"
cp ${SPRING_CONFIG_DIR}/*.pem $MOUNT_SPRING_CONF_DIR
docker run \
--detach \
--name spring \
--net ${DOCKER_NETWORK} \
--publish 8081:8080 \
--publish 8443:8443 \
-v ${MOUNT_SPRING_CONF_DIR}:/opt/spring/data/import/ \
${SPRING_DOCKER_IMAGE}
wait_for_oidc_endpoint spring $SPRING_URL $MOUNT_SPRING_CONF_DIR/ca_spring_certificate.pem
end "spring is ready"
}

20
selenium/bin/gen-spring-yml Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#set -x
SPRING_PATH=${1:?First parameter is the directory env and config files are relative to}
ENV_FILE=${2:?Second parameter is a comma-separated list of .env file which has exported template variables}
FINAL_CONFIG_FILE=${3:?Forth parameter is the name of the final config file. It is relative to where this script is run from}
source $ENV_FILE
parentdir="$(dirname "$FINAL_CONFIG_FILE")"
mkdir -p $parentdir
echo "" > $FINAL_CONFIG_FILE
for f in $($SCRIPT/find-template-files "${PROFILES}" $SPRING_PATH "application" "yml")
do
envsubst < $f >> $FINAL_CONFIG_FILE
done

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TEST_CASES_PATH=/oauth/with-sp-initiated
TEST_CONFIG_PATH=/oauth
PROFILES="spring-authz-server spring-oauth-provider spring-mgt-oauth-provider tls"
source $SCRIPT/../../bin/suite_template $@
runWith spring-authz-server