1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
\r
2 .. http://creativecommons.org/licenses/by/4.0
\r
4 Build and Setup procedure
\r
5 =========================
\r
10 Use the below repository for Heartbeat Microservice.
\r
12 https://gerrit.onap.org/r/#/admin/projects/dcaegen2/services/heartbeat
\r
17 To run heartbeat Micro Service in development environment, POD25
\r
18 access is required. Please get the access and install Openvpn.
\r
20 Connect to POD25 setup using Openvpn and the credentials obtained.
\r
22 Docker build procedure
\r
23 ----------------------
\r
25 Clone the code using below command
\r
28 git clone https://gerrit.onap.org/r/dcaegen2/services/heartbeat
\r
30 give executable permission to mvn-phase-script.sh if not there
\r
34 chmod +x mvn-phase-script.sh
\r
36 **Setting up the postgres DB, group/consumer IDs, CBS download and
\r
37 CBS polling. The following environment variables are to be set.**
\r
39 For postgres and CBS download, the environment setting file to be
\r
40 passed while running the Docker. The file would contain following
\r
41 parameters. The sample values are shown for reference.
\r
44 pg_ipAddress=10.0.4.1
\r
46 pg_userName=postgres
\r
48 #Below parameters for CBS download
\r
49 SERVICE_NAME=mvp-dcaegen2-heartbeat-static
\r
50 CONSUL_HOST=10.12.6.50
\r
51 HOSTNAME=mvp-dcaegen2-heartbeat-static
\r
52 #Below parameter for heartbeat worker process to receive message
\r
56 If the postgres parameters are not there in environment setting file,
\r
57 then it takes the values from miss_htbt_service/config/hbproperties.yaml
\r
58 file. Make sure that postgres running in the machine where pg_ipAddress
\r
59 parameter is mentioned.
\r
61 Run below netstat command to check postgres port number and IP address are fine.
\r
67 If CBS parameters are not there in the environment setting file, then
\r
68 local config file (etc/config.json) is considered as a default
\r
71 For CBS polling CBS_polling_allowed & CBS_polling_interval to be set
\r
72 appropriately in miss_htbt_service/config/hbproperties.yaml file
\r
74 The sample values in miss_htbt_service/config/hbproperties.yaml file
\r
79 pg_ipAddress: 10.0.4.1
\r
81 pg_userName: postgres
\r
84 CBS_polling_allowed: True
\r
85 CBS_polling_interval: 300
\r
87 PS: Change the groupID and consumerID in the environment accordingly
\r
88 for each HB instance so that HB worker process receive the HB event
\r
89 correctly. Usually groupID remains the same for all instance of HB
\r
90 where as consumerID would be changed for each instance of HB Micro
\r
91 service. If groupID and consumerID is not provided, then it takes
\r
92 “DefaultGroup” and “1” respectively.
\r
94 **Setting CBS configuration parameters using the consule KV URL.**
\r
96 The sample consul KV is as below.
\r
98 http://10.12.6.50:8500/ui/#/dc1/kv/mvp-dcaegen2-heartbeat-static
\r
100 Go to the above link and click on KEY/VALUE tab
\r
102 Click on mvp-dcaegen2-heartbeat-static
\r
104 Copy the configuration in the box provided and click on update.
\r
106 The sample configuration is as below
\r
108 .. code-block:: json
\r
111 "heartbeat_config": {
\r
113 "eventName": "Heartbeat_S",
\r
114 "heartbeatcountmissed": 3,
\r
115 "heartbeatinterval": 60,
\r
116 "closedLoopControlName": "ControlLoopEvent1",
\r
117 "policyVersion": "1.0.0.5",
\r
118 "policyName": "vFireWall",
\r
119 "policyScope": "resource=sampleResource,type=sampletype,CLName=sampleCLName",
\r
120 "target_type": "VM",
\r
121 "target": "genVnfName",
\r
125 "eventName": "Heartbeat_vFW",
\r
126 "heartbeatcountmissed": 3,
\r
127 "heartbeatinterval": 60,
\r
128 "closedLoopControlName": "ControlLoopEvent1",
\r
129 "policyVersion": "1.0.0.5",
\r
130 "policyName": "vFireWall",
\r
131 "policyScope": "resource=sampleResource,type=sampletype,CLName=sampleCLName",
\r
132 "target_type": "VNF",
\r
133 "target": "genVnfName",
\r
139 "streams_publishes": {
\r
142 "topic_url": "http://10.12.5.252:3904/events/unauthenticated.DCAE_CL_OUTPUT/"
\r
144 "type": "message_router"
\r
147 "streams_subscribes": {
\r
150 "topic_url": "http://10.12.5.252:3904/events/unauthenticated.SEC_HEARTBEAT_INPUT/"
\r
152 "type": "message_router"
\r
157 **Build the Docker using below command with a image name**
\r
161 sudo Docker build --no-cache --network=host -f ./Dockerfile -t
\r
162 heartbeat.test1:latest .
\r
164 To check whether image is built or not, run below command
\r
167 sudo Docker images |grep heartbeat.test1
\r
169 **Run the Docker using below command which uses the environment file
\r
170 mentioned in the above section.**
\r
173 sudo Docker run -d --name hb1 --env-file env.list
\r
174 heartbeat.test1:latest
\r
176 To check the logs, run below command
\r
179 sudo Docker logs -f hb1
\r
181 **To stop the Docker run**
\r
183 Get the Docker container ID from below command
\r
187 sudo Docker ps -a \| grep heartbeat.test1
\r
189 Run below commands to stop the Docker run
\r
193 sudo Docker stop <Docker container ID)
\r
194 sudo Docker rm -f hb1
\r
196 **Initiate the maven build**
\r
198 To run the maven build, execute any one of them.
\r
201 sudo mvn -s settings.xml deploy
\r
203 sudo mvn -s settings.xml -X deploy
\r
205 If there is a libxml-xpath related issue, then install the
\r
206 libxml-xpath as below. If the issue is something else, follow the
\r
207 link given as part of the build failure.
\r
210 sudo apt install libxml-xpath-perl
\r