diff options
author | Ramesh Murugan Iyer <ramesh.murugan.iyer@est.tech> | 2024-07-22 08:09:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-07-22 08:09:33 +0000 |
commit | 4e38c5a0df50fe4fff97dd88ddf776cffb58dcc3 (patch) | |
tree | 4ec1176a84864e81ea682ff4c9206644ffa78f8d /compose | |
parent | 6e5018fa5717eeefdb2a0319d0dad7ae0ddd4595 (diff) | |
parent | daecbb96b9a747a2edaf33a3e9a9784cc71440a8 (diff) |
Merge "Add CSIT option to run xacml-pdp against postgres database"
Diffstat (limited to 'compose')
-rw-r--r-- | compose/docker-compose.gui.yml | 63 | ||||
-rw-r--r-- | compose/docker-compose.postgres.yml | 25 | ||||
-rwxr-xr-x | compose/export-ports.sh | 1 | ||||
-rwxr-xr-x | compose/get-versions.sh | 220 | ||||
-rwxr-xr-x | compose/start-compose.sh | 20 | ||||
-rw-r--r-- | compose/start-postgres-tests.sh | 7 |
6 files changed, 148 insertions, 188 deletions
diff --git a/compose/docker-compose.gui.yml b/compose/docker-compose.gui.yml deleted file mode 100644 index e2e98b54..00000000 --- a/compose/docker-compose.gui.yml +++ /dev/null @@ -1,63 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright 2023-2024 Nordix Foundation. -# ============================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# - -services: - policy-gui: - image: ${CONTAINER_LOCATION}onap/policy-gui:latest - container_name: policy-gui - depends_on: - - policy-clamp-backend - hostname: policy-gui - environment: - CLAMP_URL: http://policy-clamp-backend:8445 - CLAMP_DISABLE_SSL_VALIDATION: "true" - ports: - - "2445:2445" - volumes: - - ./config/policy-gui/application.yaml:/opt/app/policy/gui/etc/application.yml - - ./config/policy-gui/logback.xml:/opt/app/policy/gui/etc/logback.xml:ro - - ./wait_for_port.sh:/opt/app/policy/gui/bin/wait_for_port.sh:ro - entrypoint: ./policy-gui.sh - working_dir: /opt/app/policy/gui/bin - command: ./policy-gui.sh - policy-clamp-backend: - image: ${CONTAINER_LOCATION}onap/policy-clamp-backend:latest - container_name: policy-clamp-backend - depends_on: - - policy-clamp-runtime-acm - - distribution - hostname: policy-clamp-backend - environment: - POLICY_API_HOST: api - POLICY_PAP_HOST: pap - MARIADB_HOST: mariadb - RUNTIME_HOST: policy-clamp-runtime-acm - ports: - - "8445:8445" - volumes: - - ./config/clamp/ClampBackend.properties:/opt/policy/clamp/config/ClampBackend.properties:ro - - ./config/clamp/logback-backend.xml:/opt/policy/clamp/config/logback.xml:ro - working_dir: /opt/policy/clamp - command: java - -Djava.security.egd=file:/dev/./urandom - -XX:MinRAMPercentage=50 - -XX:MaxRAMPercentage=75 - -jar ./policy-clamp-backend.jar - --spring.config.name=ClampBackend - --spring.config.location=/opt/policy/clamp/config/ClampBackend.properties -
\ No newline at end of file diff --git a/compose/docker-compose.postgres.yml b/compose/docker-compose.postgres.yml index fee55d97..ca96f562 100644 --- a/compose/docker-compose.postgres.yml +++ b/compose/docker-compose.postgres.yml @@ -104,7 +104,7 @@ services: - ${PAP_PORT}:6969 volumes: - ./config/pap/papParametersPostgres.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro - - ./config/${PROJECT}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro + - ./config/${component}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro - ./config/pap/logback.xml:/opt/app/policy/pap/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh @@ -137,6 +137,28 @@ services: 'kafka', '9092', 'pap', '6969' ] + xacml-pdp: + image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} + container_name: policy-xacml-pdp + hostname: policy-xacml-pdp + depends_on: + - postgres + - kafka + - pap + ports: + - ${XACML_PORT}:6969 + - "30999:3904" + volumes: + - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro + - ./config/xacml-pdp/logback.xml:/opt/app/policy/pdpx/etc/logback.xml:ro + - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-pdpx-pg.sh', + 'postgres', '5432', + 'kafka', '9092', + 'pap', '6969' + ] prometheus: image: nexus3.onap.org:10001/prom/prometheus:latest container_name: prometheus @@ -148,6 +170,7 @@ services: zookeeper: image: confluentinc/cp-zookeeper:latest + container_name: zookeeper environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 diff --git a/compose/export-ports.sh b/compose/export-ports.sh index a3422daa..aa97f493 100755 --- a/compose/export-ports.sh +++ b/compose/export-ports.sh @@ -25,6 +25,7 @@ then head -1 | sed 's/onap\/policy-api.*$//' ) + export LOCAL_IMAGES="true" else export CONTAINER_LOCATION="nexus3.onap.org:10001/" fi diff --git a/compose/get-versions.sh b/compose/get-versions.sh index 13dc3653..a51ccef9 100755 --- a/compose/get-versions.sh +++ b/compose/get-versions.sh @@ -25,115 +25,129 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ - "${WORKSPACE}"/.gitreview) - -echo GERRIT_BRANCH="${GERRIT_BRANCH}" - +#default values export POLICY_MARIADB_VER=10.10.2 echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} export POLICY_POSTGRES_VER=11.1 echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER} -function getDockerVersion -{ - REPO=${1} - DEFAULT_DOCKER_IMAGE_NAME=${2:-} - DEFAULT_DOCKER_IMAGE_VERSION=${3:-} - - REPO_RELEASE_DATA=$( - curl -qL --silent \ - "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | - grep "^policy/$REPO" - ) - - # shellcheck disable=SC2034 - read -r repo \ - latest_released_tag \ - latest_snapshot_tag \ - changed_files \ - docker_images \ - <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" - - if [[ -z "$docker_images" ]] - then - if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] +if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then + echo "Running with local images." + export POLICY_DOCKER_VERSION="latest" + export POLICY_MODELS_VERSION="latest" + export POLICY_API_VERSION="latest" + export POLICY_PAP_VERSION="latest" + export POLICY_APEX_PDP_VERSION="latest" + export POLICY_DROOLS_PDP_VERSION="latest" + export POLICY_XACML_PDP_VERSION="latest" + export POLICY_DISTRIBUTION_VERSION="latest" + export POLICY_CLAMP_VERSION="latest" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + export POLICY_DROOLS_APPS_VERSION="latest" + +else + GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) + + echo GERRIT_BRANCH="${GERRIT_BRANCH}" + + function getDockerVersion + { + REPO=${1} + DEFAULT_DOCKER_IMAGE_NAME=${2:-} + DEFAULT_DOCKER_IMAGE_VERSION=${3:-} + + REPO_RELEASE_DATA=$( + curl -qL --silent \ + "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | + grep "^policy/$REPO" + ) + + # shellcheck disable=SC2034 + read -r repo \ + latest_released_tag \ + latest_snapshot_tag \ + changed_files \ + docker_images \ + <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" + + if [[ -z "$docker_images" ]] then - echo "repo $REPO does not produce a docker image, execution terminated" - exit 1 + if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] + then + echo "repo $REPO does not produce a docker image, execution terminated" + exit 1 + else + docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + fi + fi + + # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') + docker_image_version=$latest_snapshot_tag + docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") + + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$latest_released_tag" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return else - docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" + exit 1 fi - fi - - # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') - docker_image_version=$latest_snapshot_tag - docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") - - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - fi - - docker_image_version="$latest_released_tag" - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - fi - - docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - else - echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" - exit 1 - fi -} - -getDockerVersion docker -export POLICY_DOCKER_VERSION="$docker_image_version" - -getDockerVersion models "'policy-models-simulator'" 3.0.1 -export POLICY_MODELS_VERSION="$docker_image_version" - -getDockerVersion api -export POLICY_API_VERSION="$docker_image_version" - -getDockerVersion pap -export POLICY_PAP_VERSION="$docker_image_version" - -getDockerVersion apex-pdp -export POLICY_APEX_PDP_VERSION="$docker_image_version" - -getDockerVersion drools-pdp -export POLICY_DROOLS_PDP_VERSION="$docker_image_version" - -getDockerVersion xacml-pdp -export POLICY_XACML_PDP_VERSION="$docker_image_version" - -getDockerVersion distribution -export POLICY_DISTRIBUTION_VERSION="$docker_image_version" - -getDockerVersion clamp -export POLICY_CLAMP_VERSION="$docker_image_version" -export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION - -getDockerVersion gui -export POLICY_GUI_VERSION="$docker_image_version" - -getDockerVersion drools-applications -export POLICY_DROOLS_APPS_VERSION="$docker_image_version" + } + + getDockerVersion docker + export POLICY_DOCKER_VERSION="$docker_image_version" + + getDockerVersion models "'policy-models-simulator'" 3.0.1 + export POLICY_MODELS_VERSION="$docker_image_version" + + getDockerVersion api + export POLICY_API_VERSION="$docker_image_version" + + getDockerVersion pap + export POLICY_PAP_VERSION="$docker_image_version" + + getDockerVersion apex-pdp + export POLICY_APEX_PDP_VERSION="$docker_image_version" + + getDockerVersion drools-pdp + export POLICY_DROOLS_PDP_VERSION="$docker_image_version" + + getDockerVersion xacml-pdp + export POLICY_XACML_PDP_VERSION="$docker_image_version" + + getDockerVersion distribution + export POLICY_DISTRIBUTION_VERSION="$docker_image_version" + + getDockerVersion clamp + export POLICY_CLAMP_VERSION="$docker_image_version" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + + getDockerVersion drools-applications + export POLICY_DROOLS_APPS_VERSION="$docker_image_version" +fi
\ No newline at end of file diff --git a/compose/start-compose.sh b/compose/start-compose.sh index a6ada298..671927ba 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -32,7 +32,6 @@ COMPOSE_FOLDER="${WORKSPACE}"/compose # Set default values for the options grafana=false -gui=false # Parse the command-line arguments while [[ $# -gt 0 ]] @@ -44,11 +43,6 @@ do grafana=true shift ;; - --gui) - gui=true - shift 2 - break; - ;; *) component="$1" shift @@ -84,24 +78,14 @@ if [ -n "$component" ]; then docker compose up -d "${component}" grafana echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}" echo "Grafana server: http://localhost:${GRAFANA_PORT}" - elif [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d "${component}" policy-gui - echo "Clamp GUI: https://localhost:2445/clamp" else echo "Starting ${component} application" docker compose up -d "${component}" fi else export PROJECT=api # api has groups.json complete with all 3 pdps - if [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d - echo "Clamp GUI: https://localhost:2445/clamp" - else - echo "Starting all components..." - docker compose up -d - fi + echo "Starting all components..." + docker compose up -d fi cd ${WORKSPACE} diff --git a/compose/start-postgres-tests.sh b/compose/start-postgres-tests.sh index 1c08600a..2d695911 100644 --- a/compose/start-postgres-tests.sh +++ b/compose/start-postgres-tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # # ============LICENSE_START==================================================== -# Copyright (C) 2023 Nordix Foundation. +# Copyright (C) 2023-2024 Nordix Foundation. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,7 +30,8 @@ echo "Configuring docker compose..." source export-ports.sh > /dev/null 2>&1 source get-versions.sh > /dev/null 2>&1 -export REPLICAS=${1} -docker-compose -f docker-compose.postgres.yml up -d apex-pdp prometheus +export component=${1} +export REPLICAS=${2} +docker-compose -f docker-compose.postgres.yml up -d ${component} prometheus cd ${WORKSPACE}
\ No newline at end of file |