Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 406a9796 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Update weblogic 14c plan to run without exposing ports

parent 8799a499
No related branches found
No related tags found
No related merge requests found
Pipeline #132520 failed
Showing
with 192 additions and 150 deletions
......@@ -2,7 +2,7 @@ version: "3.0"
services:
smp-oracle-db:
# image: container-registry.oracle.com/database/express:21.3.0-xe
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_BD_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
hostname: smp-database.local
environment:
- ORACLE_CHARACTERSET=AL32UTF8 # set database encoding
......
smp.security.folder=/data/smp/security
smp.jdbc.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
smp.datasource.jndi=jdbc/eDeliverySmpDs
......
#!/bin/bash
#!/usr/bin/env bash
# This is build script clean starting the docker compose containers for weblogic and oracle db integration tests.
# The script is used for local development and CI integration testing only.
#
# IMPORTANT NOTE: The script clears all old containers, volumes and bind volumes and then starts the docker compose containers.
# init plan variables
WORKDIR="$(cd -P $(dirname ${BASH_SOURCE[0]} ) && pwd)"
WORKDIR="$(cd -P $(dirname "${BASH_SOURCE[0]}" ) && pwd)"
source "${WORKDIR}/../../functions/run-test.functions"
initializeVariables
......@@ -20,8 +26,8 @@ ORA_VERSION="11.2.0.2"
ORA_EDITION="xe"
ORA_SERVICE="xe"
SMP_DB_USERNAME=smp;
SMP_DB_PASSWORD=test;
SMP_DB_USERNAME="smp"
SMP_DB_PASSWORD="test"
SMP_DB_SCRIPTS=./properties/db-scripts
# READ arguments
......@@ -31,6 +37,7 @@ do
in
i) SMP_INIT_DATABASE_DATA=${OPTARG};;
v) SMP_VERSION=${OPTARG};;
*) echo "Unknown option [${option}].\nUsage: $0 [-i] [-v]"; exit 1;;
esac
done
......@@ -41,12 +48,11 @@ echo "SMP version: $SMP_VERSION"
echo "Init sql data: ${SMP_INIT_DATABASE_DATA}"
echo "Working Directory: ${WORKDIR}"
echo "*************************************************************************"
cd "$WORKDIR"
cd "$WORKDIR" || exit 1
echo "Create folder (if not exist) for database scripts ${SMP_DB_SCRIPTS}"
[ -d ${SMP_DB_SCRIPTS} ] || mkdir -p "${SMP_DB_SCRIPTS}"
function createDatabaseSchemaForUser() {
echo "Clear file [$3] to recreate schema for user creation!"
......@@ -67,24 +73,24 @@ function createDatabaseSchemaForUser() {
} >>"$3"
}
function clearOldContainers {
# clear old containers mounted volume ./data
function clearMoundDataVolume() {
: "${$WORKDIR?"Need to set $WORKDIR non-empty!"}"
echo "Clear container data ${WORKDIR}/data/"
rm -rf ${WORKDIR}/data/upload/*.*
rm -rf ${WORKDIR}/data/smp/config/*.*
rm -rf ${WORKDIR}/data/smp/security/*.*
rm -rf ${WORKDIR}/data/weblogic/keystores/*.*
rm -rf ${WORKDIR}/data/weblogic/security.properties
rm -rf ${WORKDIR}/data/*.*
rm -rf ${WORKDIR}/data
mkdir -p ${WORKDIR}/data/upload
mkdir -p ${WORKDIR}/data/smp/config
mkdir -p ${WORKDIR}/data/smp/security
mkdir -p ${WORKDIR}/data/weblogic/keystores
}
clearMoundDataVolume
createDatabaseSchemaForUser $SMP_DB_USERNAME $SMP_DB_PASSWORD "${SMP_DB_SCRIPTS}/01_create_user.sql"
# create database init script from
echo "CONNECT ${SMP_DB_USERNAME}/${SMP_DB_PASSWORD}@//localhost:1521/${ORA_SERVICE};" > "${SMP_DB_SCRIPTS}/02_oracle10g.sql"
cat "${SMP_INIT_DATABASE}" >> "${SMP_DB_SCRIPTS}/02_oracle10g.sql"
# copy init database data for SMP
if [ ! -f "${SMP_INIT_DATABASE_DATA}" ]
then
......
.gitignore is excluded when sharing artifacts on bamboo
http://ant.apache.org/manual/dirtasks.html
And we want this folder to be shared in order to keep the project structure.
\ No newline at end of file
# Ignore everything in this directory
..
# Except the following
!.gitignore
!.disable_default_excludes
\ No newline at end of file
.gitignore is excluded when sharing artifacts on bamboo
http://ant.apache.org/manual/dirtasks.html
And we want this folder to be shared in order to keep the project structure.
\ No newline at end of file
# Ignore everything in this directory
..
# Except the following
!.gitignore
!.disable_default_excludes
\ No newline at end of file
.gitignore is excluded when sharing artifacts on bamboo
http://ant.apache.org/manual/dirtasks.html
And we want this folder to be shared in order to keep the project structure.
\ No newline at end of file
# Ignore everything in this directory
..
# Except the following
!.gitignore
!.disable_default_excludes
\ No newline at end of file
.gitignore is excluded when sharing artifacts on bamboo
http://ant.apache.org/manual/dirtasks.html
And we want this folder to be shared in order to keep the project structure.
\ No newline at end of file
# Ignore everything in this directory
..
# Except the following
!.gitignore
!.disable_default_excludes
\ No newline at end of file
version: '3.8'
services:
##
## API Tests
##
testapi:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_TESTS}:${SMP_VERSION}
environment:
- TEST_PLAN=api
- TEST_URL=http://smp-httpd/smp/
networks:
- test-network
networks:
test-network:
external:
name: ${DOCKER_NETWORK_NAME:-domismp-tomcat-mysql_default}
version: "3.0"
services:
smp-oracle-db:
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_BD_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
hostname: smp-database.local
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_DB_ORACLE}-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
hostname: smp-oracle-db
shm_size: '1gb'
environment:
- ORACLE_CHARACTERSET=AL32UTF8 # set database encoding
- NLS_LANG=.AL32UTF8 # set sqlplus encoding for starting up scripts
volumes:
- ./properties/db-scripts:/docker-entrypoint-initdb.d/startup # init script.
- ./status-folder:/u01/status/
ports:
- 1821:1521
shm_size: '1gb'
#ports:
# - 1821:1521
smp-wls-admin:
depends_on:
- smp-oracle-db
command: [bash, -c, "rm -rf /u01/status/wls-admin.started;for i in `seq 150`; do timeout 1 bash -c 'echo \" $$(ls /u01/status/)\"'; if [ -f '/u01/status/database.status' ] && [ \"$$( cat /u01/status/database.status )\" == 'DATABASE IS READY TO USE!' ] ; then break;fi; echo \"$$i. Wait for database!\"; sleep 10; done; /u01/oracle/startAdminServer.sh"]
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC14}:${SMP_VERSION}
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC141}:${SMP_VERSION}
hostname: smp-wls-admin
depends_on:
smp-oracle-db:
condition: service_healthy
environment:
- JAVA_OPTIONS="-Dweblogic.webservice.i18n.charset=utf-8"
- WL_START_ADMIN=true
- WL_PRODUCTION_MODE_ENABLED=true # to enable production deployment
- WL_DEPLOYMENT_TARGET=smp-cluster
ports:
- 7801:7001
volumes:
- ./properties/weblogic-init:/u01/init/
- ./data:/data
- ./status-folder:/u01/status/
# ports:
# - 7801:7001
smp-node-01:
# depend of the startup of the db
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC141}:${SMP_VERSION}
depends_on:
- smp-wls-admin
command: [bash, -c, "for i in `seq 200`; do timeout 1 bash -c 'echo \" $$(ls /u01/status/)\"'; if [ -f '/u01/status/wls-admin.started' ] ; then break;fi; echo \"$$i. Wait for admin server!\"; sleep 10; done; /u01/oracle/startManagedServer.sh"]
smp-wls-admin:
condition: service_healthy
environment:
- WL_START_ADMIN=false
- WL_ADMIN_HOST=smp-wls-admin
- WL_MANAGED_SERV_NAME=smp-node-1
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC14}:${SMP_VERSION}
volumes:
- ./data:/data
# - ./status-folder:/u01/status/
# ports:
# - "18453:8453"
# - "18001:8001"
volumes:
- ./data:/data
- ./status-folder:/u01/status/
smp-node-02:
# depend of the startup of the db
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC141}:${SMP_VERSION}
depends_on:
- smp-wls-admin
command: [bash, -c, "for i in `seq 200`; do timeout 1 bash -c 'echo \" $$(ls /u01/status/)\"'; if [ -f '/u01/status/wls-admin.started' ] ; then break;fi; echo \"$$i. Wait for admin server!\"; sleep 10; done; /u01/oracle/startManagedServer.sh"]
smp-wls-admin:
condition: service_healthy
command: [bash, -c, "/u01/oracle/startServer.sh"]
environment:
- WL_START_ADMIN=false
- WL_ADMIN_HOST=smp-wls-admin
- WL_MANAGED_SERV_NAME=smp-node-2
- WL_DELAY_STARTUP_IN_S=20 # delay startup to allow node 01 to initialize the database, truststore and keystore
image: ${IMAGE_TAG:-edeliverytest}/${IMAGE_SMP_WEBLOGIC14}:${SMP_VERSION}
volumes:
- ./data:/data
# ports:
# - "18453:8453"
# - "18001:8001"
volumes:
- ./data:/data
- ./status-folder:/u01/status/
smp-httpd:
depends_on:
- smp-node-01
- smp-node-02
image: ${IMAGE_TAG:-edeliverytest}/smp-httpd:${SMP_VERSION}
depends_on:
- smp-node-01
- smp-node-02
environment:
- VHOST_CORNER_HOSTNAME=smp.edelivery.eu
- NODES_COUNT=2
- NODE_HOSTNAMES=smp-node-01,smp-node-02
- NODE_PORT_NUMBERS=8001,8001
- AllowEncodedSlashes=NoDecode
ports:
- "7880:80"
restart: always
#ports:
# - "7880:80"
.gitignore is excluded when sharing artifacts on bamboo
http://ant.apache.org/manual/dirtasks.html
And we want this folder to be shared in order to keep the project structure.
\ No newline at end of file
# Ignore everything in this directory
..
# Except the following
!.gitignore
!.disable_default_excludes
\ No newline at end of file
smp.security.folder=/data/smp/security
smp.jndi.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
smp.datasource.jndi=jdbc/eDeliverySmpDs
......
#!/bin/bash
# This is build script clean starting the docker compose containers for weblogic and oracle db integration tests.
# The script is used for local development and CI integration testing only.
#
# IMPORTANT NOTE: The script clears all old containers, volumes and bind volumes and then starts the docker compose containers.
# init plan variables
WORKDIR="$(cd -P $(dirname ${BASH_SOURCE[0]} ) && pwd)"
WORKDIR="$(cd -P $(dirname "${BASH_SOURCE[0]}" ) && pwd)"
source "${WORKDIR}/../../functions/run-test.functions"
initializeVariables
SMP_INIT_DATABASE="${SMP_PROJECT_FOLDER}/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl"
#SMP_INIT_DATABASE_DATA="${SMP_PROJECT_FOLDER}/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-data.sql"
SMP_INIT_DATABASE_DATA="${SMP_PROJECT_FOLDER}/smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql"
# soap ui data
SMP_VERSION=
SMP_INIT_DATABASE_DATA="${SMP_PROJECT_FOLDER}/domismp-tests/domismp-tests-api/groovy/oracle-4.1_integration_test_data.sql"
#ORA_VERSION="19.3.0"
......@@ -20,8 +24,8 @@ ORA_VERSION="11.2.0.2"
ORA_EDITION="xe"
ORA_SERVICE="xe"
SMP_DB_USERNAME=smp;
SMP_DB_PASSWORD=test;
SMP_DB_USERNAME="smp"
SMP_DB_PASSWORD="test"
SMP_DB_SCRIPTS=./properties/db-scripts
# READ arguments
......@@ -34,28 +38,45 @@ do
esac
done
discoverApplicationVersion
echo "*************************************************************************"
echo "SMP version: $SMP_VERSION"
echo "Init sql data: ${SMP_INIT_DATABASE_DATA}"
echo "Working Directory: ${WORKDIR}"
echo "*************************************************************************"
cd "$WORKDIR"
echo "Create folder (if not exist) for database scripts ${SMP_DB_SCRIPTS}"
[ -d ${SMP_DB_SCRIPTS} ] || mkdir -p "${SMP_DB_SCRIPTS}"
cd "$WORKDIR" || exit 1
# clear old containers mounted volume ./data
function clearMoundDataVolume() {
: "${WORKDIR?"Need to set $WORKDIR non-empty!"}"
: "${SMP_DB_SCRIPTS?"Need to set SMP_DB_SCRIPTS non-empty!"}"
echo "Clear container data ${WORKDIR}/data/"
rm -rf "${WORKDIR}/data"
rm -rf "${SMP_DB_SCRIPTS}"
mkdir -p ${WORKDIR}/data/upload
mkdir -p ${WORKDIR}/data/smp/config
mkdir -p ${WORKDIR}/data/smp/security
mkdir -p ${WORKDIR}/data/weblogic/keystores
# create database init scripts
mkdir -p "${SMP_DB_SCRIPTS}"
}
# method creates init scripts for application oracle database initialization from scratch!
# - 01_create_user.sql - recreate user and schema
# - 02_oracle10g.sql - init database script
# - 03_oracle10g-data.sql - init database data script
function createDatabaseSchemaForUser() {
: "${1?"Need to set Database user as first parameter non-empty!"}"
: "${2?"Need to set Database user password as second parameter non-empty!"}"
: "${3?"Need to set Database script folder as third parameter non-empty!"}"
: "${SMP_INIT_DATABASE?"Need to set init Database script SMP_INIT_DATABASE as variable non-empty!"}"
: "${SMP_INIT_DATABASE_DATA?"Need to set init-data Database script SMP_INIT_DATABASE as variable non-empty!"}"
echo "Clear file [$3] to recreate schema for user creation!"
echo "" > "$3"
echo "Create database schema/user: $1"
if [ -n "$ORACLE_PDB" ]; then
echo "ALTER SESSION SET CONTAINER=$ORACLE_PDB;" >>"$3"
fi
echo "Create file [$3]/01_create_user.sql to recreate schema/user [$1]!"
{
if [ -n "$ORACLE_PDB" ]; then
echo "ALTER SESSION SET CONTAINER=$ORACLE_PDB;"
fi
# magic with double quotes - first end " then put '"' and then add variable to "$Var" and repeat the stuff :)
echo "CREATE USER $1 IDENTIFIED BY "'"'"$2"'"'" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users; "
echo "GRANT CREATE SESSION TO $1;"
......@@ -64,34 +85,27 @@ function createDatabaseSchemaForUser() {
echo "GRANT CREATE SEQUENCE TO $1;"
echo "GRANT SELECT ON PENDING_TRANS$ TO $1;"
echo ""
} >>"$3"
}
createDatabaseSchemaForUser $SMP_DB_USERNAME $SMP_DB_PASSWORD "${SMP_DB_SCRIPTS}/01_create_user.sql"
# create database init script from
echo "CONNECT ${SMP_DB_USERNAME}/${SMP_DB_PASSWORD}@//localhost:1521/${ORA_SERVICE};" > "${SMP_DB_SCRIPTS}/02_oracle10g.sql"
cat "${SMP_INIT_DATABASE}" >> "${SMP_DB_SCRIPTS}/02_oracle10g.sql"
# copy init database data for SMP
if [ ! -f "${SMP_INIT_DATABASE_DATA}" ]
then
echo "SMP sql init data '${SMP_INIT_DATABASE_DATA} not found!!"
exit 1;
else
# copy artefact to docker build folder
echo "CONNECT ${SMP_DB_USERNAME}/${SMP_DB_PASSWORD}@//localhost:1521/${ORA_SERVICE};" > "${SMP_DB_SCRIPTS}/03_oracle10g-data.sql"
cat "${SMP_INIT_DATABASE_DATA}" >> "${SMP_DB_SCRIPTS}/03_oracle10g-data.sql"
fi
} > "$3/01_create_user.sql"
# create database init script from
echo "CONNECT ${1}/${2}@//localhost:1521/${ORA_SERVICE};" > "${3}/02_oracle10g.sql"
cat "${SMP_INIT_DATABASE}" >> "${3}/02_oracle10g.sql"
# copy init database data for SMP
if [ ! -f "${SMP_INIT_DATABASE_DATA}" ]
then
echo "SMP sql init data '${SMP_INIT_DATABASE_DATA} not found!!"
exit 1;
else
# copy artefact to docker build folder
echo "CONNECT ${1}/${2}@//localhost:1521/${ORA_SERVICE};" > "${3}/03_oracle10g-data.sql"
cat "${SMP_INIT_DATABASE_DATA}" >> "${3}/03_oracle10g-data.sql"
fi
}
# Because statuses are synchronized through folder: ./status-folder it could contain a state from a previous start.
# Set content of the file database.status to "Database starting"!
echo "Database starting" > ./status-folder/database.status
# start
# start
export SMP_VERSION
export ORA_VERSION
export ORA_EDITION
......@@ -99,11 +113,9 @@ export SMP_VERSION
echo "Clear old containers"
stopAndClearTestContainers
clearMoundDataVolume
createDatabaseSchemaForUser $SMP_DB_USERNAME $SMP_DB_PASSWORD "${SMP_DB_SCRIPTS}"
# start "
echo "Start containers"
startTestContainers
# wait until service is up
for i in `seq 200`; do timeout 10 bash -c ' curl --silent --fail http://localhost:7880/smp/'; if [ $? -eq 0 ] ; then break;fi; echo "$i. Wait for weblogic to start!"; sleep 10; done;
#!/bin/bash
# init plan variables
WORKDIR="$(cd -P $(dirname "${BASH_SOURCE[0]}" ) && pwd)"
source "${WORKDIR}/../../functions/run-test.functions"
initializeVariables
RESULT_FOLDER="${WORKDIR}/results"
# clear old results
rm -rf "${RESULT_FOLDER}"
mkdir -p "${RESULT_FOLDER}"
# define network to connect the tests
DOCKER_NETWORK_NAME="${PLAN_PREFIX}_default"
export DOCKER_NETWORK_NAME
# Starting Docker Compose TEST (in specific project to avoid orphan container warning)
docker compose -f docker-compose.test-api.yml -p "run-${PLAN_PREFIX}" up
docker cp "run-${PLAN_PREFIX}-testapi-1:/data/results/soapui-reports" ./results
......@@ -23,8 +23,8 @@ function exportImageNames() {
export IMAGE_SMP_SPRINGBOOT_MYSQL=domismp-springboot-mysql
export IMAGE_SMP_TOMCAT_MYSQL=domismp-tomcat-mysql
export IMAGE_SMP_WEBLOGIC122=domismp-weblogic122
export IMAGE_SMP_WEBLOGIC14=domismp-weblogic141
export IMAGE_SMP_BD_ORACLE=domismp-oradb
export IMAGE_SMP_WEBLOGIC141=domismp-weblogic141
export IMAGE_SMP_DB_ORACLE=domismp-oradb
export IMAGE_SMP_TESTS=domismp-tests
}
......@@ -40,7 +40,9 @@ function initializeCommonVariables() {
# by default image tag is edeliverytest but on bamboo is tagged as build unique plan key in the form PROJECT-PLAN,
# e.g. BAM-MAIN ( we use this because it must be the same for all plan jobs)
export IMAGE_TAG=$(echo "${bamboo_planKey:-$bamboo_DOCKER_USER}" | tr '[:upper:]' '[:lower:]')
IMAGE_TAG=$(echo "${bamboo_planKey:-$bamboo_DOCKER_USER}" | tr '[:upper:]' '[:lower:]')
export IMAGE_TAG
export PLAN_PREFIX
}
################################################################
......@@ -72,3 +74,36 @@ discoverApplicationVersion(){
: "${SMP_VERSION:?SMP version can not be discovered!}"
export SMP_VERSION
}
################################################################
# Method copies the external resources to build artefact folder
buildPrepareSMPArtefacts(){
: "${1:?Need to set build artefact folder as first variable non-empty!}"
: "${SMP_VERSION:?Need to set SMP version non-empty!}"
: "${SMP_ARTEFACTS:?Need to set SMP_ARTEFACTS non-empty!}"
echo "Copy SMP artefacts to build artefact folder ${1}"
if [[ ! -d "${SMP_PLUGIN_EXAMPLE}" ]]; then
echo "SMP SPI plugin '${SMP_PLUGIN_EXAMPLE}' not found. copy from artefacts ${SMP_ARTEFACTS}!"
cp "${SMP_ARTEFACTS}/smp-spi-payload-validation-example-$SMP_VERSION.jar" "${1}"/smp-spi-payload-validation-example.jar
else
cp "${SMP_PLUGIN_EXAMPLE}/smp-spi-payload-validation-example-$SMP_VERSION.jar" "${1}"/smp-spi-payload-validation-example.jar
fi
if [[ ! -f "${SMP_ARTEFACTS}/smp.war" ]]; then
echo "SMP artefact '${SMP_ARTEFACTS}/smp.war' not found. Was project built?"
exit 1
else
# for mysql tomcat
cp "${SMP_ARTEFACTS}/smp.war" "${1}"/smp.war
fi
if [[ ! -f "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ]]; then
echo "SMP bundle artefact '${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip' not found!"
exit 1
else
# for mysql data
cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" "${1}"/smp-setup.zip
fi
}
......@@ -9,7 +9,7 @@
function initializeVariables() {
: "${WORKDIR?"Need to set WORKDIR"}"
FUNCTION_FOLDER="$(cd -P $(dirname ${BASH_SOURCE[0]} ) && pwd)"
FUNCTION_FOLDER="$(cd -P $(dirname "${BASH_SOURCE[0]}" ) && pwd)"
# project folder
SMP_PROJECT_FOLDER=$(readlink -e "${FUNCTION_FOLDER}/../../..")
#load common functions
......@@ -35,7 +35,8 @@ function stopAndClearTestContainers() {
################################################################
# Function exports the logs to file and stop and clear containers
function startTestContainers() {
echo "Start containers with prefix ${PLAN_PREFIX}"
: "${SMP_VERSION?"Need to set SMP_VERSION non-empty!"}"
echo "Start containers with prefix ${PLAN_PREFIX} for version ${SMP_VERSION}"
docker compose -p "${PLAN_PREFIX}" up -d --force-recreate --wait --wait-timeout 300
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment