da8af182cad99e085d15204340027fa14b2d88bc
[msb/apigateway.git] / docs / docs / platform / installation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 Installation
4 ------------
5 MSB can run as docker, it's very handy to try it at your laptop. For production, MSB supports to be deployed as a cluster to provide a scalable microservice communication infrastructure with kubernetes.
6  
7 Run MSB on the a single host using host network
8 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9
10 This deployment approach is only for testing. MSB is consist of multiple microservices, for testing, the easiest way is to run them in the same host by using host network.  
11
12 - Run the Consul dockers
13
14 ::
15
16   sudo docker run -d --net=host --name msb_consul consul:0.9.3
17
18 - Run the MSB dockers
19
20 Login the ONAP docker registry first: 
21
22 ::
23
24   docker login -u docker -p docker nexus3.onap.org:10001
25
26 Run MSB dockers
27
28 ::
29
30   docker run -d --net=host --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
31   docker run -d --net=host -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
32
33 - Register your REST service to MSB via curl
34
35 For testing, we can register the services via curl. 
36
37 ::
38
39     curl -X POST \
40     -H "Content-Type: application/json" \
41     -d '{"serviceName": "aai", "version": "v8", "url": "/aai/v8","protocol": "REST", "path": "/aai/v8", "nodes": [ {"ip": "10.74.215.65","port": "8443"}]}' \
42     "http://127.0.0.1:10081/api/microservices/v1/services”
43
44 - Access the rest service via api gateway
45
46 ::
47
48     curl http://127.0.0.1/api/aai/v8/cloud-infrastructure/cloud-regions
49
50 - Browse the registered services
51
52   Open MSB Web GUI portal in your browser: ``http://127.0.0.1/msb`` , you can see all the registered services. If the registered service support swagger, you can see the REST API documentation and test the registered services via the swagger UI integrated in MSB.
53
54 Run MSB using default docker network
55 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
57 In case that you don't want to use host network to set up the MSB dockers, you need to export the port and specify the environment variables to let msb components know each other.
58
59 - Run the Consul dockers
60
61 ::
62
63     sudo docker run -d -p 8500:8500  --name msb_consul consul:0.9.3
64     CONSUL_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_consul`
65
66
67 - Run the MSB dockers
68
69 Login the ONAP docker registry first: 
70
71 ::
72
73   docker login -u docker -p docker nexus3.onap.org:10001
74
75 Run MSB dockers
76
77 ::
78
79   sudo docker run -d  -p 10081:10081  -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
80   DISCOVERY_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_discovery`
81   sudo docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
82
83 Deploy MSB with kubernetes
84 ^^^^^^^^^^^^^^^^^^^^^^^^^^
85
86 The chart for MSB running in kubernetes cluster is available here: 
87
88 https://gerrit.onap.org/r/gitweb?p=oom.git;a=tree;f=kubernetes/msb;h=17f8fd89791b81f1e981716dcffdb3e2e90299ae;hb=refs/heads/master