MSB can run as dockers, it's very handy to try it on your laptop.
Run MSB microservices on the same host using host network
MSB consists of multiple microservices, for testing, the easiest way is to run them on the same host by using host network.
1. Run the Consul dockers.
sudo docker run -d --net=host --name msb_consul consul:1.4.3
2. Run the MSB dockers.
Login the ONAP docker registry first: docker login -u docker -p docker nexus3.onap.org:10001
sudo docker run -d --net=host --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
sudo docker run -d --net=host -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
3. Explore the MSB portal.
4. Register your REST service to MSB via curl
For testing, we can register the services via curl. For real use case, MSB can register the services automatically when deploying the ONAP components are deployed by OOM or Heat template.
export AAI_IP=10.74.148.80
export AAI_PORT=443
export MSB_IP=10.96.33.44
export MSB_PORT=80
curl -X POST -H "Content-Type: application/json" -d "{\"serviceName\": \"aai-cloudInfrastructure\", \"version\": \"v11\", \"url\": \"/aai/v11/cloud-infrastructure\",\"protocol\": \"REST\", \"enable_ssl\":\"true\", \"nodes\": [ {\"ip\": \"$AAI_IP\",\"port\": \"$AAI_PORT\"}]}" https://$MSB_IP:$MSB_PORT/api/microservices/v1/services
5.Access the rest service via api gateway
curl --user AAI:AAI -H "X-TransactionId:123" -H "X-FromAppId:test" http://$MSB_IP:$MSB_PORT/api/aai-cloudInfrastructure/v11/cloud-regions
Run MSB microservices using default docker network
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.
1. Run the Consul dockers.
sudo docker run -d -p 8500:8500 --name msb_consul consul:1.4.3
CONSUL_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_consul`
2. Run the MSB dockers.
Login the ONAP docker registry first: docker login -u docker -p docker nexus3.onap.org:10001
sudo docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
DISCOVERY_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_discovery`
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
Run MSB with OOM
1. Precondition:
Have kubernetes cluster, kubectl and helm installed.
Login the ONAP docker registry first: docker login -u docker -p docker nexus3.onap.org:10001
2.Download oom from ONAP gerrit
git clone https://gerrit.onap.org/r/oom
3.Install MSB and Kube2MSB registrator
cd ~/oom/kubernets/config
./createConfig.sh -n onap
cd ~/oom/kubernetes/oneclick/
../createAll.bash -a msb -n onap
./createAll.bash -a kube2msb -n onap
4.Install AAI for testing
./createAll.bash -a aai-n onap
5. Open the MSB IAG portal in the browser. You are able to see the registered AAI services.
https://${Node_IP}:30283/msb
4 Comments
Ethan Lynn
Hi Huabing, docker for mac didn't support '–net=host', is there any other way to get rid of this parameter?
user-9823d
Using host network can simplify the network configuration for the test environment. The consul, disovery and api gateway docker can find each other without additional configuration by this approach. Otherwise we mus specify the IP address as the environment variables when starting the docker.
I will add the details later on the wiki page in case that you can't use host network.
user-9823d
Guide for Mac has been added as well.
Vijendra Rajput
Hi Huabing,
Tried to setup the environment instead of providing --net=host option i started all three docker with specific fix IP and then when started apigateway docker with CONSUL_IP and SDCLIENT_IP.
expose consul port 8500 and discovery port 100081 to access consul ui and portal ui remotely. But seem there is a issue i am not able to see side bar in portal ui.
Able to register service successfully and able to call that service through client.
could you please help me to understand where and what i am missing. I also prepared a docker-compose file for same. will upload to repository if required.