summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/orchestrator/scripts/Dockerfile30
-rwxr-xr-xsrc/orchestrator/scripts/_functions.sh8
-rwxr-xr-xsrc/orchestrator/scripts/build.sh68
-rw-r--r--src/orchestrator/scripts/docker-compose.yml22
-rwxr-xr-xsrc/orchestrator/scripts/start-docker.sh24
5 files changed, 152 insertions, 0 deletions
diff --git a/src/orchestrator/scripts/Dockerfile b/src/orchestrator/scripts/Dockerfile
new file mode 100644
index 00000000..b894f47c
--- /dev/null
+++ b/src/orchestrator/scripts/Dockerfile
@@ -0,0 +1,30 @@
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2020
+# 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
+##############################################################################
+
+FROM ubuntu:18.04
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+ENV no_proxy $NO_PROXY
+
+EXPOSE 9015
+
+RUN groupadd -r onap && useradd -r -g onap onap
+
+WORKDIR /opt/multicloud/k8s/orchestrator
+RUN chown onap:onap /opt/multicloud/k8s/orchestrator -R
+
+ADD --chown=onap ./orchestrator ./
+
+USER onap
+
+CMD ["./orchestrator"] \ No newline at end of file
diff --git a/src/orchestrator/scripts/_functions.sh b/src/orchestrator/scripts/_functions.sh
index cba65d94..1200f71f 100755
--- a/src/orchestrator/scripts/_functions.sh
+++ b/src/orchestrator/scripts/_functions.sh
@@ -28,9 +28,17 @@ function start_etcd {
function generate_config {
cat << EOF > config.json
{
+ "ca-file": "ca.cert",
+ "server-cert": "server.cert",
+ "server-key": "server.key",
+ "password": "",
"database-ip": "${DATABASE_IP}",
"database-type": "mongo",
"plugin-dir": "plugins",
+ "etcd-ip": "127.0.0.1",
+ "etcd-cert": "",
+ "etcd-key": "",
+ "etcd-ca-file": "",
"service-port": "9015"
}
EOF
diff --git a/src/orchestrator/scripts/build.sh b/src/orchestrator/scripts/build.sh
new file mode 100755
index 00000000..5446dac0
--- /dev/null
+++ b/src/orchestrator/scripts/build.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2020 Intel Corporation
+# 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
+##############################################################################
+
+set -o nounset
+set -o pipefail
+
+k8s_path="$(git rev-parse --show-toplevel)"
+
+VERSION="0.0.1-SNAPSHOT"
+export IMAGE_NAME="nexus3.onap.org:10003/onap/multicloud/k8s/orchestrator"
+
+function _compile_src {
+ echo "Compiling source code"
+ pushd $k8s_path/src/orchestrator/
+ make
+ popd
+}
+
+function _move_bin {
+ echo "Moving binaries"
+ mv $k8s_path/src/orchestrator/orchestrator .
+}
+
+function _cleanup {
+ echo "Cleaning previous execution"
+ docker-compose kill
+ image=$(grep "image.*orchestrator" docker-compose.yml)
+ if [[ -n ${image} ]]; then
+ docker images ${image#*:} -q | xargs docker rmi -f
+ fi
+ docker ps -a --filter "status=exited" -q | xargs docker rm
+}
+
+function _build_docker {
+ echo "Building docker image"
+ docker-compose build --no-cache
+}
+
+function _push_image {
+ local tag_name=${IMAGE_NAME}:${1:-latest}
+
+ echo "Start push {$tag_name}"
+ docker push ${IMAGE_NAME}:latest
+ docker tag ${IMAGE_NAME}:latest ${tag_name}
+ docker push ${tag_name}
+}
+
+if [[ -n "${JENKINS_HOME+x}" ]]; then
+ set -o xtrace
+ _compile_src
+ _move_bin
+ _build_docker
+ _push_image $VERSION
+else
+ source /etc/environment
+
+ _compile_src
+ _move_bin
+ _cleanup
+ _build_docker
+fi \ No newline at end of file
diff --git a/src/orchestrator/scripts/docker-compose.yml b/src/orchestrator/scripts/docker-compose.yml
index e5a1d681..3bb7bdaa 100644
--- a/src/orchestrator/scripts/docker-compose.yml
+++ b/src/orchestrator/scripts/docker-compose.yml
@@ -12,12 +12,34 @@
version: '3.0'
services:
+ orchestrator:
+ image: nexus3.onap.org:10003/onap/multicloud/k8s/orchestrator
+ build:
+ context: ./
+ args:
+ - HTTP_PROXY=${HTTP_PROXY}
+ - HTTPS_PROXY=${HTTPS_PROXY}
+ - NO_PROXY=${NO_PROXY}
+ environment:
+ - HTTP_PROXY=${HTTP_PROXY}
+ - HTTPS_PROXY=${HTTPS_PROXY}
+ - NO_PROXY=${NO_PROXY},mongo
+ depends_on:
+ - mongo
+ network_mode: host
+ volumes:
+ - /opt/csar:/opt/csar
+ - ${PWD}/config.json:/opt/multicloud/k8s/orchestrator/config.json:ro
+ ports:
+ - 9015:9015
mongo:
image: mongo
environment:
- HTTP_PROXY=${HTTP_PROXY}
- HTTPS_PROXY=${HTTPS_PROXY}
- NO_PROXY=${NO_PROXY}
+ ports:
+ - 27017:27017
etcd:
image: bitnami/etcd:3
environment:
diff --git a/src/orchestrator/scripts/start-docker.sh b/src/orchestrator/scripts/start-docker.sh
new file mode 100755
index 00000000..c6f53c6c
--- /dev/null
+++ b/src/orchestrator/scripts/start-docker.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2020 Intel Corporation
+# 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
+##############################################################################
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+source _functions.sh
+
+#
+# Start from containers. build.sh should be run prior this script.
+#
+stop_all
+start_mongo
+start_etcd
+generate_config
+start_all \ No newline at end of file