update link to upper-constraints.txt
[dmaap/messagerouter/messageservice.git] / docs / Installation / Installation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.\r
2 .. http://creativecommons.org/licenses/by/4.0\r
3 \r
4 Installation\r
5 ============\r
6 \r
7 Environment\r
8 -----------\r
9 \r
10 Message Router is developed using Kafka, Zookeeper and Java. AJSC framework is\r
11 used to create the REST service and Docker was used to package the service.\r
12 \r
13 Steps\r
14 -----\r
15 \r
16 Message Router has 3 docker containers. Dmaap\_container,\r
17 kafka\_container and zookeeper\_container. Zookeeper runs on 172.18.0.2,\r
18 kafka runs on 172.18.0.3 and dmaap on 172.18.0.4.\r
19 \r
20 1) Clone message service repo\r
21 \r
22   .. code-block::\r
23 \r
24      git clone http://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
25 \r
26 2) copy messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties\r
27    to /var/tmp directory\r
28 \r
29 3) In /var/tmp/MsgRtrApi.properties, change value of below variables as\r
30    shown below:\r
31 \r
32   .. code-block::\r
33 \r
34      config.zk.servers=172.18.0.2 (Change as per where ZooKeepeer is deployed)\r
35      kafka.metadata.broker.list=172.18.0.3:9092 (Change as per where Kafka is deployed)\r
36 \r
37 4) Install docker and docker-compose\r
38 \r
39 5) Go to messageservice/src/main/resources/docker-compose and run:\r
40 \r
41   .. code-block::\r
42  \r
43      docker-compose up  # add -d argument to start process as a daemon (background process)\r
44  \r
45 \r
46    This should start 3 containers.\r
47 \r
48 6) Run docker ps. It should show 3 containers.\r
49 \r
50    |image0|\r
51 \r
52    .. |image0| image:: docker.png\r
53  \r
54 Testing\r
55 -------\r
56 \r
57 -  For publishing, create a sample.txt file with some content in the\r
58    directory where you will run below rest api. Run below rest api:\r
59 \r
60   .. code-block::\r
61 \r
62      curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://172.18.0.4:3904/events/TestTopic1\r
63 \r
64 -  For subscribing, run below rest api:\r
65 \r
66   .. code-block::\r
67 \r
68    curl -H "Content-Type:text/plain" -XGET http://172.18.0.4:3904/events/TestTopic1/CG1/C1?timeout=1000\r
69 \r
70 \r
71    Note: You will only receive messages which have been published after\r
72    you have subscribed to a topic.\r
73 \r
74 \r
75 Steps for local development and test\r
76 ------------------------------------\r
77 \r
78 On Intel dev machine, in terminal (> indicates prompt) :\r
79 \r
80 1) Build kafka11aaf\r
81 \r
82   .. code-block::\r
83 \r
84      > git clone https://gerrit.onap.org/r/dmaap/kafka\r
85      > cd kafka11aaf\r
86      > mvn clean install -Pdocker\r
87 \r
88 \r
89 2) Build messageservice \r
90 \r
91   .. code-block::\r
92 \r
93      > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
94      (Note: anonymous http, can't push changes)\r
95      > cd messageservice\r
96      > mvn clean install -Pdocker\r
97 \r
98 \r
99 3) Run tests \r
100 \r
101   .. code-block::\r
102 \r
103      > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
104 \r
105 \r
106         - edit /var/tmp/MsgRtrApi.properties\r
107             config.zk.servers=zookeeper\r
108             kafka.metadata.broker.list=kafka:9092\r
109 \r
110             - docker-compose network maps service name(zookeeper, kafka) to IP\r
111 \r
112         - set docker preferences/file sharing to access /var/tmp\r
113  \r
114     > cd src/main/resources/docker-compose\r
115 \r
116     - edit docker-compose.yml\r
117         - remove "nexus3.onap.org:10001/" from kafka and dmaap image names to \r
118             use local images\r
119  \r
120     > docker-compose up -d\r
121     - create sample.txt file (as above)(content of file not important)\r
122  \r
123     > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r
124 \r
125 On Arm:\r
126 \r
127 1) Build kafka11aaf\r
128 \r
129   .. code-block::\r
130 \r
131      > git clone https://gerrit.onap.org/r/dmaap/kafka\r
132     \r
133     > cd kafka11aaf\r
134     \r
135     > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
136         - ensure we pull Arm version of base image\r
137 \r
138 \r
139 2) Build messageservice \r
140 \r
141   .. code-block::\r
142 \r
143     > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
144         - anonymous http, can't push changes\r
145     \r
146     > cd messageservice\r
147     \r
148     > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
149         - ensure we pull Arm version of base image\r
150 \r
151 \r
152 3) Run tests \r
153 \r
154   .. code-block::\r
155 \r
156     > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
157 \r
158         - edit /var/tmp/MsgRtrApi.properties\r
159             config.zk.servers=zookeeper\r
160             kafka.metadata.broker.list=kafka:9092\r
161 \r
162             - docker-compose network maps service name(zookeeper, kafka) to IP\r
163 \r
164         - set docker preferences/file sharing to access /var/tmp\r
165     \r
166     > cd src/main/resources/docker-compose\r
167     - edit docker-compose.yml\r
168 \r
169         - remove "nexus3.onap.org:10001/" from from kafka and dmaap image names to \r
170             use local images\r
171 \r
172         - replace 'nexus3.onap.org:10001/onap/dmaap/zookeeper:1.0.0' with\r
173             multi-platform 'zookeeper'\r
174     \r
175     > docker-compose up -d\r
176 \r
177     - create sample.txt file (as above)(content of file not important)\r
178     \r
179     > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r