aboutsummaryrefslogtreecommitdiffstats
path: root/lib/msb
blob: e406e2da624598090710ea5daa0f55c94ab735c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017-2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#############################################################################

source /var/onap/functions

# _build_msb_images() - Function that creates Microservices Docker images from source code
function _build_msb_images {
    if [[ "$compile_repo" != "True" ]]; then
        compile_repos "msb"
    fi

    build_docker_image ${src_folders[msb]}/apigateway/distributions/msb-apigateway/src/main/basedocker onap/msb/msb_base
    build_docker_image ${src_folders[msb]}/apigateway/distributions/msb-apigateway/src/main/docker onap/msb/msb_apigateway
    build_docker_image ${src_folders[msb]}/discovery/distributions/msb-discovery/src/main/docker onap/msb/msb_discovery
}

# get_msb_images() - Function that retrieves the Microservices Bus images
function get_msb_images {
    pull_docker_image "consul:0.9.3"
    if [[ "$build_image" == "True" ]]; then
        _build_msb_images
    else
        unset docker_version
        for image in base apigateway discovery; do
            pull_onap_image msb/msb_$image
        done
    fi
}

# install_msb() - Downloads and configure Microservices Bus source code
function install_msb {
    run_docker_image -d --net=host --name msb_consul consul:0.9.3
    run_docker_image -d --net=host --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
    run_docker_image -d --net=host -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
}

# init_msb() - Function that initialize Message Router services
function init_msb {
    if [[ "$clone_repo" == "True" ]]; then
        clone_repos "msb"
        if [[ "$compile_repo" == "True" ]]; then
            compile_repos "msb"
        fi
    fi
    if [[ "$skip_get_images" == "False" ]]; then
        get_msb_images
        if [[ "$skip_install" == "False" ]]; then
            install_msb
        fi
    fi
}