diff options
-rw-r--r-- | docs/installation/docker.rst | 116 | ||||
-rwxr-xr-x | integration/src/main/scripts/release/releasePhase.sh | 12 | ||||
-rwxr-xr-x | integration/src/main/scripts/release/updateOomImages.sh | 3 | ||||
-rwxr-xr-x | integration/src/main/scripts/release/updateRefs.sh | 23 |
4 files changed, 105 insertions, 49 deletions
diff --git a/docs/installation/docker.rst b/docs/installation/docker.rst index d9ddd1a1..7f038934 100644 --- a/docs/installation/docker.rst +++ b/docs/installation/docker.rst @@ -10,98 +10,136 @@ Policy Docker Installation :depth: 2 -Building the ONAP Policy Framework Docker Images +Starting the ONAP Policy Framework Docker Images ************************************************ -The instructions here are based on the instructions in the file *~/git/onap/policy/docker/README.md*. +In order to start the containers, you can use *docker-compose*. This uses the *docker-compose-all.yml* yaml file to bring up the ONAP Policy Framework. This file is located in the policy/docker repository. In the csit folder there are scripts to *automatically* bring up components in Docker, without the need to build all the images locally. -**Step 1:** Build the Policy API Docker image +Clone the read-only version of policy/docker repo from gerrit: .. code-block:: bash - cd ~/git/onap/policy/api/packages - mvn clean install -P docker + git clone "https://gerrit.onap.org/r/policy/docker" -**Step 2:** Build the Policy PAP Docker image + +Start the containers automatically +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. note:: The start-all.sh script in policy/docker/csit will bring up all the Policy Framework components, and give the local ip for the GUI. The latest images will be downloaded from Nexus. .. code-block:: bash - cd ~/git/onap/policy/pap/packages - mvn clean install -P docker + export CONTAINER_LOCATION=nexus3.onap.org:10001/ + export PROJECT=pap + ./start-all.sh -**Step 3:** Build the Drools PDP docker image. -This image is a standalone vanilla Drools engine, which does not contain any pre-built drools rules or applications. +To stop them use ./stop-all.sh .. code-block:: bash - cd ~/git/onap/policy/drools-pdp/ - mvn clean install -P docker + ./stop-all.sh -**Step 4:** Build the Drools Application Control Loop image. -This image has the drools use case application and the supporting software built together with the Drools PDP engine. It is recommended to use this image if you are first working with ONAP Policy and wish to test or learn how the use cases work. +Start the containers manually +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. code-block:: bash +**Step 1:** Set the containers location and project. - cd ~/git/onap/policy/drools-applications - mvn clean install -P docker +For *local* images, set CONTAINER_LOCATION="" (or don't set it at all) +*You will need to build locally all the images using the steps in the next chapter* -**Step 5:** Build the Apex PDP docker image: +For *remote* images set CONTAINER_LOCATION="nexus3.onap.org:10001/" .. code-block:: bash - cd ~/git/onap/policy/apex-pdp - mvn clean install -P docker + export CONTAINER_LOCATION=nexus3.onap.org:10001/ + export PROJECT=pap -**Step 6:** Build the XACML PDP docker image: + +**Step 2:** Set gerrit branch + +Set GERRIT_BRANCH="master" + +Or use the script get-branch.sh .. code-block:: bash - cd ~/git/onap/policy/xacml-pdp/packages - mvn clean install -P docker + source ./get-branch.sh -**Step 7:** Build the policy engine docker image (If working with the legacy Policy Architecture/API): + +**Step 3:** Get all the images versions + +Use the script get-versions.sh .. code-block:: bash - cd ~/git/onap/policy/engine/ - mvn clean install -P docker + source ./get-versions.sh -**Step 8:** Build the Policy SDC Distribution docker image: + +**Step 4:** Run the system using docker-compose .. code-block:: bash - cd ~/git/onap/policy/distribution/packages - mvn clean install -P docker + docker-compose -f docker-compose-all.yml up <image> <image> -Starting the ONAP Policy Framework Docker Images +**You now have a full standalone ONAP Policy framework up and running!** + + +Building the ONAP Policy Framework Docker Images ************************************************ +If you want to use your own local images, you can build them following these instructions: + +**Step 1:** Build the Policy API Docker image + +.. code-block:: bash -In order to run the containers, you can use *docker-compose*. This uses the *docker-compose.yml* yaml file to bring up the ONAP Policy Framework. This file is located in the policy/docker repository. + cd ~/git/onap/policy/api/packages + mvn clean install -P docker -**Step 1:** Set the environment variable *MTU* to be a suitable MTU size for the application. +**Step 2:** Build the Policy PAP Docker image .. code-block:: bash - export MTU=9126 + cd ~/git/onap/policy/pap/packages + mvn clean install -P docker +**Step 3:** Build the Drools PDP docker image. -**Step 2:** Determine if you want the legacy Policy Engine to have policies pre-loaded or not. By default, all the configuration and operational policies will be pre-loaded by the docker compose script. If you do not wish for that to happen, then export this variable: +This image is a standalone vanilla Drools engine, which does not contain any pre-built drools rules or applications. + +.. code-block:: bash -.. note:: This applies ONLY to the legacy Engine and not the Policy Lifecycle polices + cd ~/git/onap/policy/drools-pdp/ + mvn clean install -P docker + +**Step 4:** Build the Drools Application Control Loop image. + +This image has the drools use case application and the supporting software built together with the Drools PDP engine. It is recommended to use this image if you are first working with ONAP Policy and wish to test or learn how the use cases work. .. code-block:: bash - export PRELOAD_POLICIES=false + cd ~/git/onap/policy/drools-applications + mvn clean install -P docker +**Step 5:** Build the Apex PDP docker image: + +.. code-block:: bash + + cd ~/git/onap/policy/apex-pdp + mvn clean install -P docker -**Step 3:** Run the system using *docker-compose*. Note that on some systems you may have to run the *docker-compose* command as root or using *sudo*. Note that this command takes a number of minutes to execute on a laptop or desktop computer. +**Step 6:** Build the XACML PDP docker image: .. code-block:: bash - docker-compose up -d + cd ~/git/onap/policy/xacml-pdp/packages + mvn clean install -P docker +**Step 7:** Build the Policy SDC Distribution docker image: -**You now have a full standalone ONAP Policy framework up and running!** +.. code-block:: bash + + cd ~/git/onap/policy/distribution/packages + mvn clean install -P docker diff --git a/integration/src/main/scripts/release/releasePhase.sh b/integration/src/main/scripts/release/releasePhase.sh index 81a457e0..789e7f18 100755 --- a/integration/src/main/scripts/release/releasePhase.sh +++ b/integration/src/main/scripts/release/releasePhase.sh @@ -24,7 +24,8 @@ set -e SCRIPT_NAME=$(basename "$0") repo_location="./" -release_data_file="./pf_release_data.csv" +release_data_file="pf_release_data.csv" +release_data_file_tag="" usage() { @@ -40,6 +41,7 @@ usage() echo " defaults to '$repo_location'" echo " -i issue-id - issue ID in the format POLICY-nnnn" echo " -p phase - the release phase, a positive integer" + echo " -t tag - tag the release data file with the given tag" echo "" echo " examples:" echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234 -p 3" @@ -48,7 +50,7 @@ usage() exit 255; } -while getopts "hd:l:i:p:" opt +while getopts "hd:l:i:p:t:" opt do case $opt in h) @@ -66,6 +68,9 @@ do p) release_phase=$OPTARG ;; + t) + release_data_file_tag="$OPTARG" + ;; \?) usage exit 1 @@ -389,7 +394,8 @@ release_phase_15() { -f \ -d "$release_data_file" \ -l "$repo_location" \ - -r "policy/parent" + -r "policy/parent" \ + -t "$release_data_file_tag" generateCommit.sh \ -l "$repo_location" \ -r "policy/parent" \ diff --git a/integration/src/main/scripts/release/updateOomImages.sh b/integration/src/main/scripts/release/updateOomImages.sh index ad337a8c..7d8d9826 100755 --- a/integration/src/main/scripts/release/updateOomImages.sh +++ b/integration/src/main/scripts/release/updateOomImages.sh @@ -156,7 +156,7 @@ do continue fi - for docker_image in $(echo "$docker_images" | tr ':' ' ') + for docker_image in $(echo "$docker_images" | sed -e "s/'//g" -e "s/:/ /g") do new_image="$docker_image:$latest_released_tag" @@ -170,7 +170,6 @@ do done done - echo "generating OOM commit to update policy framework docker image versions . . ." generateCommit.sh \ diff --git a/integration/src/main/scripts/release/updateRefs.sh b/integration/src/main/scripts/release/updateRefs.sh index 9e1231ad..45ec0652 100755 --- a/integration/src/main/scripts/release/updateRefs.sh +++ b/integration/src/main/scripts/release/updateRefs.sh @@ -24,7 +24,8 @@ set -e SCRIPT_NAME=$(basename "$0") repo_location="./" -release_data_file="./pf_release_data.csv" +release_data_file="pf_release_data.csv" +release_data_file_tag="" # Use the bash internal OSTYPE variable to check for MacOS if [[ "$OSTYPE" == "darwin"* ]] @@ -55,6 +56,7 @@ usage() echo " -x - update policy/apex-pdp references" echo " -k - update docker base images in Dockerfiles" echo " -f - update release data in policy parent" + echo " -t tag - tag the release data file with the given tag" echo " -s - update release references to snapshot references," echo " if omitted, snapshot references are updated to release references" echo "" @@ -78,7 +80,7 @@ update_snapshot=false update_docker=false update_file=false -while getopts "hd:l:r:pcmoxkfs" opt +while getopts "hd:l:r:pcmoxkft:s" opt do case $opt in h) @@ -114,6 +116,9 @@ do f) update_file=true ;; + t) + release_data_file_tag="$OPTARG"_ + ;; s) update_snapshot=true ;; @@ -433,7 +438,15 @@ then exit 1 fi - echo "updating release data at $repo_location/$target_repo/integration/src/main/resources/release . . ." - cp "$release_data_file" "$repo_location/$target_repo"/integration/src/main/resources/release - echo "updated release data at $repo_location/$target_repo/integration/src/main/resources/release" + release_data_file_name="$release_data_file_tag$release_data_file" + + echo \ + "updating release data at" \ + "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name" + cp \ + "$release_data_file" \ + "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name" + echo \ + "updated release data at" \ + "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name" fi |