Merge "Move OVN to the latest version"
[multicloud/k8s.git] / deployments / start.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Intel Corporation
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -o nounset
12 set -o pipefail
13
14 source /etc/environment
15
16 k8s_path="$(git rev-parse --show-toplevel)"
17 export GOPATH=$k8s_path
18 export GO111MODULE=on
19
20 echo "Starting mongo services"
21 docker-compose kill
22 docker-compose up -d mongo
23 export DATABASE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=mongo"))
24 export no_proxy=${no_proxy:-},$DATABASE_IP
25 export NO_PROXY=${NO_PROXY:-},$DATABASE_IP
26
27 echo "Compiling source code"
28 pushd $k8s_path/src/k8splugin/
29 cat << EOF > k8sconfig.json
30 {
31     "database-address":     "$DATABASE_IP",
32     "database-type": "mongo",
33     "plugin-dir": "$(pwd)/plugins",
34     "service-port": "9015",
35     "kube-config-dir": "$(pwd)/kubeconfigs"
36 }
37 EOF
38 make all
39 ./k8plugin
40 popd