fee19135815ec12a68ce8141187a2b55c881a630
[policy/engine.git] / docs / platform / cookbook.rst
1
2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 ***************
6 Policy Cookbook
7 ***************
8
9 Policy VM/Docker Recipes
10 ^^^^^^^^^^^^^^^^^^^^^^^^
11
12     .. code-block:: bash
13        :caption: Get latest images in an already setup policy VM
14        :linenos:
15
16         /opt/policy_vm_init.sh
17
18
19     .. code-block:: bash
20        :caption: Install/start docker policy containers with no policies preloaded
21        :linenos:
22
23         echo "PRELOAD_POLICIES=false" > /opt/policy/.env
24         /opt/policy_vm_init.sh
25
26
27     .. code-block:: bash
28        :caption: Install/start docker policy containers with policies preloaded
29        :linenos:
30
31         # This is the current default mode of instantiation.
32         # These operations are unnecessary unless PRELOAD_POLICIES
33         # was previously set to true
34          
35         echo "PRELOAD_POLICIES=true" > /opt/policy/.env
36         /opt/policy_vm_init.sh
37
38
39     .. code-block:: bash
40        :caption: Access the PDP-D container as a policy user
41        :linenos:
42
43         docker exec -it drools bash
44
45
46     .. code-block:: bash
47        :caption: Access the PDP-X container as a policy user
48        :linenos:
49
50         docker exec -it -u 0 pdp su - policy
51
52
53     .. code-block:: bash
54        :caption: Access the BRMSGW container as a policy user
55        :linenos:
56
57         docker exec -it -u 0 brmsgw su - policy
58
59
60     .. code-block:: bash
61        :caption: Access PAP container as a policy user
62        :linenos:
63
64         docker exec -it -u 0 pap su - policy
65
66
67     .. code-block:: bash
68        :caption: Access the CONSOLE container as a policy user
69        :linenos:
70
71         docker exec -it -u 0 console su - policy
72
73
74     .. code-block:: bash
75        :caption: Manual Healthcheck invokation
76        :linenos:
77
78         # Assuming the healthcheck service credentials have not been changed
79         # post-installation within the drools container
80          
81         source /opt/app/policy/config/feature-healthcheck.conf.environment
82         curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" 
83              -X GET http://localhost:6969/healthcheck | python -m json.tool
84
85
86 PDP-D Recipes ("drools" container)
87 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89     .. code-block:: bash
90        :caption: Stop the PDP-D
91        :linenos:
92
93         policy stop
94
95
96     .. code-block:: bash
97        :caption: Start the PDP-D
98        :linenos:
99
100         policy start
101
102
103     .. code-block:: bash
104        :caption: Manual Healthcheck Invokation
105        :linenos:
106
107         # Assuming the healthcheck service credentials have not been changed
108         # post-installation within the drools container
109  
110         source ${POLICY_HOME}/config/feature-healthcheck.conf
111         curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" 
112              -X GET http://localhost:6969/healthcheck | python -m json.tool
113
114 End of Document
115
116 .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Policy+Cookbook
117
118
119