1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
8 --------------------------
14 Starting the ONAP Policy Framework Docker Containers
15 ****************************************************
16 In order to start the containers, you can use *docker-compose*. This uses the *docker-compose.yml* yaml file to
17 bring up the ONAP Policy Framework. This file is located in the policy/docker repository. In the csit folder there
18 are scripts to *automatically* bring up components in Docker, without the need to build all the images locally.
20 Clone the read-only version of policy/docker repo from gerrit:
24 git clone "https://gerrit.onap.org/r/policy/docker"
27 The docker compose structure
28 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30 After cloning the docker repository, the scripts and compose files are under the *compose/* folder.
36 config -- all the components configurations
37 metrics -- configuration for Prometheus server and Grafana dashboards
38 docker-compose.gui.yml -- compose file with gui services
39 docker-compose.yml -- compose file with policy components services, including simulator, prometheus and grafana
40 export-ports.sh -- script to export the http ports for all components and where the images are collected from
41 get-versions.sh -- script to get the latest SNAPSHOT version of images based on branch (master is default)
42 start-compose.sh -- script to start the containers / applications
43 stop-compose.sh -- script to stop the containers / applications
44 wait_for_port.sh -- helper script to allow some wait time before an application is completely up and running
47 Start the containers automatically
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49 Assuming all the scripts are being executed from the compose folder.
51 To start all components without Policy GUI:
57 To start all components with Policy GUI:
61 ./start-compose.sh --gui
63 To start all components with Grafana dashboards and Prometheus server:
67 ./start-compose.sh --grafana
69 **You now have a full standalone ONAP Policy framework up and running!**
71 To stop all containers, use stop-compose.sh
78 Building the ONAP Policy Framework Docker Images
79 ************************************************
80 If you want to use your own local images, you can build them following these instructions:
82 **Step 1:** Build the Policy API Docker image
86 cd ~/git/onap/policy/api/packages
87 mvn clean install -P docker
89 **Step 2:** Build the Policy PAP Docker image
93 cd ~/git/onap/policy/pap/packages
94 mvn clean install -P docker
96 **Step 3:** Build the Drools PDP docker image.
98 This image is a standalone vanilla Drools engine, which does not contain any pre-built drools rules or applications.
102 cd ~/git/onap/policy/drools-pdp/
103 mvn clean install -P docker
105 **Step 4:** Build the Drools Application Control Loop image.
107 This image has the drools use case application and the supporting software built together with the Drools PDP engine.
108 It is recommended to use this image if you are first working with ONAP Policy and wish to test or learn how the use
113 cd ~/git/onap/policy/drools-applications
114 mvn clean install -P docker
116 **Step 5:** Build the Apex PDP docker image:
120 cd ~/git/onap/policy/apex-pdp
121 mvn clean install -P docker
123 **Step 6:** Build the XACML PDP docker image:
127 cd ~/git/onap/policy/xacml-pdp/packages
128 mvn clean install -P docker
130 **Step 7:** Build the Policy SDC Distribution docker image:
134 cd ~/git/onap/policy/distribution/packages
135 mvn clean install -P docker
137 **Step 8:** Build the Policy Message Router Simulator
141 cd ~/git/onap/policy/models/models-sim/packages
142 mvn clean install -P docker
144 Start the containers manually
145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 **Step 1:** Set the containers location and project.
149 For *local* images, set CONTAINER_LOCATION="", located at the `export-ports.sh` script
150 *You will need to build locally all the images using the steps in the previous section*
152 For *remote* images set CONTAINER_LOCATION="nexus3.onap.org:10001/"
155 **Step 2:** Set gerrit branch
157 By default, the `start-compose.sh` script will use the `get-versions.sh` to bring up latest SNAPSHOT version.
158 To use a different branch, edit the variable GERRIT_BRANCH located at the start of `get-versions.sh` to the
162 **Step 3:** Get all the images versions
164 Use the script get-versions.sh
168 source ./get-versions.sh
171 **Step 4:** Run the system using the `start-compose.sh` script
175 ./start-compose.sh <component> [--grafana] [--gui]
177 The <component> input is any of the policy components available:
184 - drools-applications
189 Debugging docker containers
190 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 To debug code against docker compose, the java parameters for jmxremote needs to be added to the start script
196 For Policy PAP, edit the `policy-pap.sh` script:
200 vi ~git/onap/policy/pap/packages/policy-pap-docker/src/main/docker/policy-pap.sh
203 Before the `-jar /app/pap.jar \ ` line, add the following block:
208 -Dcom.sun.management.jmxremote.rmi.port=5005 \
209 -Dcom.sun.management.jmxremote=true \
210 -Dcom.sun.management.jmxremote.port=5005 \
211 -Dcom.sun.management.jmxremote.ssl=false \
212 -Dcom.sun.management.jmxremote.authenticate=false \
213 -Dcom.sun.management.jmxremote.local.only=false \
215 On `docker-compose.yml` compose file, add to the port section the mapping 5005.
220 image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION}
221 container_name: policy-pap
231 That should allow an IDE to connect remotely to the 5005 port.
232 Follow the instructions of the IDE being used to add a remote connection.
234 For Intellij, under Run/Debug Configurations, add a new Remote JVM Debug, point Use module classpath to the
235 <component>-main sub-project.