53d9fd29cde019786da0ba0b021c669704a22568
[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 Message Router is developed using Kafka, Zookeeper and Java. AJSC framework is used to create the REST service and Docker was used to package the service.\r
10 \r
11 Steps\r
12 -----\r
13 Message Router has 3 docker containers. Dmaap\_container,\r
14 kafka\_container and zookeeper\_container. Zookeeper runs on 172.18.0.2,\r
15 kafka runs on 172.18.0.3 and dmaap on 172.18.0.4.\r
16 \r
17 1) Clone message service repo\r
18 \r
19    git clone http://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
20 \r
21 2) copy\r
22    messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties\r
23    to /var/tmp directory\r
24 \r
25 3) In /var/tmp/MsgRtrApi.properties, change value of below variables as\r
26    shown below:\r
27 \r
28    config.zk.servers=172.18.0.2(Change as per where  ZooKeepeer is deployed)\r
29 \r
30    kafka.metadata.broker.list=172.18.0.3:9092(Change as per where Kafka is deployed)\r
31 \r
32 4) Install docker and docker-compose\r
33 \r
34 5) Go to messageservice/src/main/resources/docker-compose and run:\r
35    \r
36    .. code:: bash\r
37    \r
38                 docker-compose up  # add -d argument to start process as a daemon (background process)\r
39 \r
40    This should start 3 containers.\r
41 \r
42 6) Run docker ps. It should show 3 containers.\r
43 \r
44    |image0|\r
45    \r
46    .. |image0| image:: docker.png\r
47   \r
48 Testing\r
49 -------\r
50 \r
51 -  For publishing, create a sample.txt file with some content in the\r
52    directory where you will run below rest api. Run below rest api:\r
53 \r
54    curl -H "Content-Type:text/plain" -X POST -d @sample.txt\r
55    http://172.18.0.4:3904/events/TestTopic1\r
56 \r
57 -  For subscribing, run below rest api:\r
58 \r
59    curl -H "Content-Type:text/plain" -XGET\r
60    http://172.18.0.4:3904/events/TestTopic1/CG1/C1?timeout=1000\r
61 \r
62    Note: You will only receive messages which have been published after\r
63    you have subscribed to a topic.\r
64 \r
65 \r
66 Steps for local development and test\r
67 ------------------------\r
68 On Intel dev machine, in terminal (> indicates prompt) :\r
69 1) Build kafka11aaf\r
70     > git clone https://gerrit.onap.org/r/dmaap/kafka\r
71     > cd kafka11aaf\r
72     > mvn clean install -Pdocker\r
73 2) Build messageservice \r
74     > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
75         - anonymous http, can't push changes\r
76     > cd messageservice\r
77     > mvn clean install -Pdocker\r
78 3) Run tests \r
79     > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
80         - edit /var/tmp/MsgRtrApi.properties\r
81             config.zk.servers=zookeeper\r
82             kafka.metadata.broker.list=kafka:9092\r
83             - docker-compose network maps service name(zookeeper, kafka) to IP\r
84         - set docker preferences/file sharing to access /var/tmp\r
85     > cd src/main/resources/docker-compose\r
86     - edit docker-compose.yml\r
87         - remove "nexus3.onap.org:10001/" from kafka and dmaap image names to \r
88             use local images\r
89     > docker-compose up -d\r
90     - create sample.txt file (as above)(content of file not important)\r
91     > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r
92 \r
93 On Arm:\r
94 1) Build kafka11aaf\r
95     > git clone https://gerrit.onap.org/r/dmaap/kafka\r
96     > cd kafka11aaf\r
97     > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
98         - ensure we pull Arm version of base image\r
99 2) Build messageservice \r
100     > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
101         - anonymous http, can't push changes\r
102     > cd messageservice\r
103     > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
104         - ensure we pull Arm version of base image\r
105 3) Run tests \r
106     > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
107         - edit /var/tmp/MsgRtrApi.properties\r
108             config.zk.servers=zookeeper\r
109             kafka.metadata.broker.list=kafka:9092\r
110             - docker-compose network maps service name(zookeeper, kafka) to IP\r
111         - set docker preferences/file sharing to access /var/tmp\r
112     > cd src/main/resources/docker-compose\r
113     - edit docker-compose.yml\r
114         - remove "nexus3.onap.org:10001/" from from kafka and dmaap image names to \r
115             use local images\r
116         - replace 'nexus3.onap.org:10001/onap/dmaap/zookeeper:1.0.0' with\r
117             multi-platform 'zookeeper'\r
118     > docker-compose up -d\r
119     - create sample.txt file (as above)(content of file not important)\r
120     > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r
121 \r
122    \r