Document Policy GUI and gui-server
[policy/parent.git] / docs / ui / runtime-ui / gui-server.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 .. _gui-server-label:
4
5 The Policy Framework GUI Server
6 ###############################
7
8 The **gui-server** microservice serves the GUI code to the browser for Policy Framework UI. In addition, it acts as
9 a single point of reference for the REST interfaces provided by **policy-api**, **policy-pap**, and **acm-runtime**.
10 It can also be used as a HTTPS gatewy for REST references into a Policy Framework deployment in a Kubernetes cluster.
11
12 .. contents::
13     :depth: 2
14
15 The **gui-server** is a regular microservice, and it is packaged, delivered and configured as a docker image. It is
16 a Spring application and therefore uses a normal Spring-style *applciation.yaml* approach to configuration.
17
18 Definitive example configurations are available in the codebase:
19
20 - `application_http.yaml <https://github.com/onap/policy-gui/blob/master/gui-server/src/test/resources/application_http.yaml>`_
21   showing how to configure gui-server for HTTP access
22 - `application_https.yaml <https://github.com/onap/policy-gui/blob/master/gui-server/src/test/resources/application_https.yaml>`_
23   showing how to configure gui-server for HTTPS access
24
25 The configuration parameters are explained in the sections below
26
27 Server Configuration
28 --------------------
29
30 Configuration for HTTP access to gui-server::
31
32   server:
33     port: 2443
34     ssl:
35       enabled: false
36
37 Start gui-server on port 2443 and disable SSL.
38
39 Configuration for HTTPS access to gui-server::
40
41   server:
42     port: 2443
43     ssl:
44       enabled: true
45       enabled-protocols: TLSv1.2
46       client-auth: want
47       key-store: file:./src/test/resources/helloworld-keystore.jks
48       key-store-password: changeit
49       trust-store: file:./src/test/resources/helloworld-truststore.jks
50       trust-store-password: changeit
51
52 Start gui-server on port 2443 and enable SSL with the parameters specified above
53
54 Note that other standard Spring **server** configuraiton parameters as
55 documented
56 `on the Spring website <https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html>`_
57 are supported.
58
59 Runtime Adaptation Configuration
60 --------------------------------
61
62 You can configure the adaptation for **policy-api**, **policy-pap**, and **runtime-acm**. In other words, you can map
63 the URL that the GUI produced or that you want to use in a REST tool such as *postman* or *curl* in the **runtime-ui**
64 part of the aaplication.yaml file::
65
66   runtime-ui:
67     policy-api:
68       mapping-path: "/runtime-ui/policy-api/restservices/"
69       url: http://localhost:30440
70       disable-ssl-validation: true
71       disable-ssl-hostname-check: true
72     policy-pap:
73       mapping-path: "/runtime-ui/policy-pap/restservices/"
74       url: http://localhost:30442
75       disable-ssl-validation: true
76       disable-ssl-hostname-check: true
77     acm:
78       mapping-path: "/runtime-ui/acm/restservices/"
79       url: http://localhost:30258
80       disable-ssl-validation: true
81       disable-ssl-hostname-check: true
82
83 The parameters under the **policy-api**, **policy-pap**, and **acm** sections are identical.
84
85 mapping-path and url
86 ++++++++++++++++++++
87
88 The **mapping-path** is the root part of the path that will be replaced by the **url**, the **url** replaces the
89 **mapping-path**.
90
91 Therefore, using the configuration above for policy-api, the following mapping occurs::
92
93   http://localhost:2443/runtime-ui/policy-api/restservices/policy/api/v1/healthcheck
94
95   maps to
96
97   http://localhost:30440/policy/api/v1/healthcheck
98
99 and::
100
101   https://localhost:2443/runtime-ui/acm/restservices/onap/policy/clamp/acm/v2/commission
102
103   maps to
104
105   http://localhost:30258/onap/policy/clamp/acm/v2/commission
106
107 disable-ssl-validation and disable-ssl-hostname-check
108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
109
110 The **disable-ssl-validation** **disable-ssl-hostname-check** are boolean values. If the target server (policy-api,
111 policy-pap, or runtime-acm) is using http, these values should be set to **false**. If the target server is using
112 HTTPS, set the values as **true** so that the **gui-server** transfers and forwards certificates to target servers.
113
114 Spring Boot Acuator Monitoring
115 ------------------------------
116
117 The **gui-server** supports regular
118 `Spring Boot Actuator monitoring <https://docs.spring.io/spring-boot/docs/1.4.0.M2/reference/html/production-ready-monitoring.html>`_
119 and monitoring over `prometheus <https://prometheus.io/>`_.
120
121 The following section of the *application.yaml** file is an example of how to enable monitoring::
122
123   management:
124     endpoints:
125       web:
126         base-path: /
127         exposure:
128           include: health,metrics,prometheus
129         path-mapping.metrics: plain-metrics
130         path-mapping.prometheus: metrics
131
132 The configuration above enables the following URLs::
133
134   # Health Check
135   http://localhost:2443/health
136
137   # Plain Metrics
138   http://localhost:2443/plain-metrics
139
140   # Prometheus Metrics
141   http://localhost:2443/metrics
142
143