Add dockerfile for MDG's 10/6510/2
authorMike Marchetti <mmarchetti@sandvine.com>
Wed, 19 Sep 2018 19:00:36 +0000 (15:00 -0400)
committerMike Marchetti <mmarchetti@sandvine.com>
Wed, 19 Sep 2018 19:13:38 +0000 (15:13 -0400)
- Added option to installer to use specfic docker build tag

Change-Id: Ia6cf6316c6fb84a18ecdbaf98747a95c20ce2f0b
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
21 files changed:
docker/.gitignore [new file with mode: 0644]
docker/LCM/Dockerfile [new file with mode: 0644]
docker/LCM/Makefile [new file with mode: 0644]
docker/MON/Dockerfile
docker/MON/Makefile [new file with mode: 0644]
docker/Makefile [new file with mode: 0644]
docker/NBI/Dockerfile
docker/NBI/Makefile [new file with mode: 0644]
docker/RO/Dockerfile
docker/RO/Makefile [new file with mode: 0644]
docker/light-ui/Dockerfile [new file with mode: 0644]
docker/light-ui/Makefile [new file with mode: 0644]
docker/mk/Makefile.include [new file with mode: 0644]
docker/mk/dirs.mk [new file with mode: 0644]
docker/mk/get_version.sh [new file with mode: 0755]
docker/osmclient/Dockerfile
docker/osmclient/Makefile [new file with mode: 0644]
docker/pm/Dockerfile [new file with mode: 0644]
docker/pm/Makefile [new file with mode: 0644]
installers/docker/docker-compose.yaml
installers/full_install_osm.sh

diff --git a/docker/.gitignore b/docker/.gitignore
new file mode 100644 (file)
index 0000000..567609b
--- /dev/null
@@ -0,0 +1 @@
+build/
diff --git a/docker/LCM/Dockerfile b/docker/LCM/Dockerfile
new file mode 100644 (file)
index 0000000..46be58e
--- /dev/null
@@ -0,0 +1,95 @@
+# This creates som/LCM docker from from last stable package
+
+FROM ubuntu:16.04
+
+# Set the working directory to /app
+WORKDIR /app/osm_lcm
+
+# avoid extra information from packages
+RUN echo 'path-exclude /usr/share/doc/*\n\
+path-include /usr/share/doc/*/copyright\n\
+path-exclude /usr/share/man/*\n\
+path-exclude /usr/share/groff/*\n\
+path-exclude /usr/share/info/*\n\
+path-exclude /usr/share/lintian/*\n\
+path-exclude /usr/share/linda/*\n'\
+> /etc/dpkg/dpkg.cfg.d/01_nodoc && \
+    echo  'APT::Install-Recommends "false";\n\
+APT::AutoRemove::RecommendsImportant "false";\n\
+APT::AutoRemove::SuggestsImportant "false";\n'\
+> /etc/apt/apt.conf.d/99_norecommends
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get update && apt-get install -y git make python3 \
+    python3-pip python3-pymongo python3-yaml python3-aiohttp \
+    python3-all python3-setuptools \
+    python3-bitarray python3-regex python3-lxml dh-python wget tox \
+    python3-cffi \
+    && pip3 install pip==9.0.3 \
+    && pip3 install -U aiokafka pyang lxml six enum34 \
+    && pip3 install websockets==4.0.1 \
+    && pip3 install requests
+
+RUN pip3 install PyNaCl
+
+RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
+    && cd N2VC \
+    && git checkout BUILD_v4.0.1_1 \
+    && cd modules/libjuju && python3 setup.py develop && cd ../.. \
+    && pip3 install -U -r requirements.txt
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
+
+ARG LCM_VERSION
+ARG COMMON_VERSION
+ARG N2VC_VERSION
+
+RUN apt-get update && apt-get install -y python3-osm-lcm${LCM_VERSION} \
+                                         python3-osm-common${COMMON_VERSION} \
+                                         python3-n2vc${N2VC_VERSION} \
+                                         && rm -rf /var/lib/apt/lists/*
+
+EXPOSE 9999
+
+LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
+      Description="This implements life cycle management engine for OSM" \
+      Version="1.0" \
+      Author="Alfonso Tierno"
+
+# Used for local storage
+VOLUME /app/storage
+# Used for logs
+VOLUME /app/log
+
+# The following ENV can be added with "docker run -e xxx' to configure LCM
+ENV OSMLCM_RO_HOST         ro
+ENV OSMLCM_RO_PORT         9090
+ENV OSMLCM_RO_TENANT       osm
+
+# VCA
+ENV OSMLCM_VCA_HOST        vca
+ENV OSMLCM_VCA_PORT:       17070
+ENV OSMLCM_VCA_USER:       admin
+ENV OSMLCM_VCA_SECRET:     secret
+
+# database
+ENV OSMLCM_DATABASE_DRIVER mongo
+ENV OSMLCM_DATABASE_HOST   mongo
+ENV OSMLCM_DATABASE_PORT   27017
+ENV OSMLCM_STORAGE_DRIVER  local
+ENV OSMLCM_STORAGE_PATH    /app/storage
+
+# message
+ENV OSMLCM_MESSAGE_DRIVER  kafka
+ENV OSMLCM_MESSAGE_HOST    kafka
+ENV OSMLCM_MESSAGE_PORT    9092
+
+# Run app.py when the container launches
+CMD ["python3", "/usr/lib/python3/dist-packages/osm_lcm/lcm.py"]
diff --git a/docker/LCM/Makefile b/docker/LCM/Makefile
new file mode 100644 (file)
index 0000000..d64462a
--- /dev/null
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
index 9ea5b3e..0da9c91 100644 (file)
@@ -26,19 +26,22 @@ LABEL authors="Guillermo Calvino"
 
 RUN apt-get update && apt-get -y install curl software-properties-common
 
+RUN apt-get --yes update \
+ && apt-get --yes install git python python-pip python3 python3-pip libmysqlclient-dev libssl-dev libffi-dev \
+ && pip3 install pip==9.0.3
+
 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
 ARG RELEASE=ReleaseFOUR-daily
 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
 ARG REPOSITORY=testing
 
 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
-RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} MON IM common" && apt update
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} MON common" && apt update
 
-RUN apt-get --yes update \
- && apt-get --yes install git python python-pip python3 python3-pip libmysqlclient-dev libssl-dev libffi-dev \
- && pip3 install pip==9.0.3
+ARG MON_VERSION
+ARG COMMON_VERSION
 
-RUN apt-get --yes update  && apt-get -y install python3-osm-common python3-osm-mon
+RUN apt-get --yes update  && apt-get -y install python3-osm-common${COMMON_VERSION} python3-osm-mon${MON_VERSION}
 
 COPY scripts/ scripts/
 
diff --git a/docker/MON/Makefile b/docker/MON/Makefile
new file mode 100644 (file)
index 0000000..d64462a
--- /dev/null
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/Makefile b/docker/Makefile
new file mode 100644 (file)
index 0000000..b0dc1f1
--- /dev/null
@@ -0,0 +1,17 @@
+#
+#   Copyright 2017 Sandvine
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+SUBDIRS = MON NBI osmclient RO LCM light-ui pm
+include mk/dirs.mk
index 44b24b2..08f4ee5 100644 (file)
@@ -4,6 +4,12 @@ FROM ubuntu:16.04
 
 RUN apt-get update && apt-get -y install curl software-properties-common
 
+RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
+    python3-pymongo python3-yaml python3-pip \
+    && pip3 install pip==9.0.3 \
+    && pip3 install aiokafka cherrypy pyangbind \
+    && mkdir -p /app/storage/kafka && mkdir -p /app/log
+
 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
 ARG RELEASE=ReleaseFOUR-daily
 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
@@ -12,19 +18,21 @@ ARG REPOSITORY=testing
 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update
 
-RUN apt-get -y install python3-osm-nbi python3-osm-common python3-osm-im
+ARG NBI_VERSION
+ARG COMMON_VERSION
+ARG IM_VERSION
+
+RUN apt-get update && apt-get -y install python3-osm-nbi${NBI_VERSION} python3-osm-common${COMMON_VERSION} python3-osm-im${IM_VERSION}
 
 # Set the working directory to /app
 WORKDIR /app/osm_nbi
 
-RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
-    python3-pymongo python3-yaml python3-pip \
-    && pip3 install pip==9.0.3 \
-    && pip3 install aiokafka cherrypy pyangbind \
-    && mkdir -p /app/storage/kafka && mkdir -p /app/log
-
 EXPOSE 9999
 
+RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
+RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
+RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/
+
 LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
       Description="This implements a north bound interface for OSM" \
       Version="1.0" \
@@ -46,7 +54,7 @@ ENV OSMNBI_DATABASE_DRIVER mongo
 ENV OSMNBI_DATABASE_HOST   mongo
 ENV OSMNBI_DATABASE_PORT   27017
 # web
-ENV OSMNBI_STATIC_DIR      /usr/lib/python3/dist-packages/osm_nbi/html_public
+ENV OSMNBI_STATIC_DIR      /app/osm_nbi/html_public
 # logs
 ENV OSMNBI_LOG_FILE        /app/log
 ENV OSMNBI_LOG_LEVEL       DEBUG
diff --git a/docker/NBI/Makefile b/docker/NBI/Makefile
new file mode 100644 (file)
index 0000000..d64462a
--- /dev/null
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
index e6d3763..cfccb68 100644 (file)
@@ -2,7 +2,8 @@ from ubuntu:xenial
 
 MAINTAINER Gennadiy Dubina <gennadiy.dubina@dataat.com>; Alfonso Tierno <alfonso.tiernosepulveda@telefoncia.com>
 
-RUN apt-get update && apt-get -y install curl software-properties-common
+RUN apt-get update && apt-get -y install curl software-properties-common git
+RUN apt-get update && apt-get install -y python-setuptools python-wheel mysql-client python-bitarray
 
 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
 ARG RELEASE=ReleaseFOUR-daily
@@ -12,8 +13,10 @@ ARG REPOSITORY=testing
 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} RO IM common openvim" && apt update
 
-RUN apt-get update && apt-get install -y python-setuptools python-wheel mysql-client python-bitarray
-RUN apt-get update && apt-get install -y python-osm-ro python-osm-im
+ARG RO_VERSION
+ARG IM_VERSION
+
+RUN apt-get update && apt-get install -y python-osm-ro${RO_VERSION} python-osm-im${IM_VERSION}
 
 RUN mkdir -p /bin/RO
 
diff --git a/docker/RO/Makefile b/docker/RO/Makefile
new file mode 100644 (file)
index 0000000..d64462a
--- /dev/null
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/light-ui/Dockerfile b/docker/light-ui/Dockerfile
new file mode 100644 (file)
index 0000000..f845f7a
--- /dev/null
@@ -0,0 +1,30 @@
+FROM ubuntu:16.04
+
+WORKDIR /usr/src/app
+
+RUN apt-get update && apt-get install -y npm git python-pip nginx supervisor
+RUN npm install -g bower
+RUN git clone https://osm.etsi.org/gerrit/osm/LW-UI /usr/src/app
+
+RUN ln -s /usr/bin/nodejs /usr/bin/node
+RUN bower install --allow-root
+
+RUN pip install -r requirements.txt
+RUN pip install uwsgi
+#
+RUN echo "daemon off;" >> /etc/nginx/nginx.conf
+RUN cp /usr/src/app/nginx-app.conf /etc/nginx/sites-available/default
+RUN cp /usr/src/app/supervisor-app.conf /etc/supervisor/conf.d/
+
+# delete the copy of the database inside the container (if exists)
+RUN rm -f db.sqlite3
+
+ENV DJANGO_ENV=prod
+RUN python manage.py makemigrations authosm
+RUN python manage.py migrate
+RUN python manage.py collectstatic --noinput
+
+
+EXPOSE 80
+
+CMD ["supervisord", "-n"]
diff --git a/docker/light-ui/Makefile b/docker/light-ui/Makefile
new file mode 100644 (file)
index 0000000..e638100
--- /dev/null
@@ -0,0 +1,6 @@
+include ../mk/Makefile.include
+
+# Currently LW-UI needs no-cache (binary version packages not yet available)
+DOCKER_ARGS += $(NO_CACHE)
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/mk/Makefile.include b/docker/mk/Makefile.include
new file mode 100644 (file)
index 0000000..ceaacaa
--- /dev/null
@@ -0,0 +1,51 @@
+TOPDIR=$(shell readlink -f .|sed -e 's/\/docker\/.*//')
+MKINCLUDE=$(TOPDIR)/docker/mk
+MKBUILD=$(TOPDIR)/docker/build
+
+all: build
+
+TAG ?= latest
+
+REPOSITORY_BASE ?= http://osm-download.etsi.org/repository/osm/debian
+RELEASE         ?= ReleaseFOUR-daily
+REPOSITORY_KEY  ?= OSM%20ETSI%20Release%20Key.gpg
+REPOSITORY      ?= testing
+NO_CACHE        ?= --no-cache
+
+LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]')
+
+CMD_DOCKER_ARGS ?= -q
+DOCKER_ARGS     = $(CMD_DOCKER_ARGS)
+
+DEPS := MON IM LCM RO common osmclient devops NBI
+
+DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS))
+
+Q=@
+
+$(MKBUILD):
+       $Qmkdir -p $(MKBUILD)
+
+$(MKBUILD)/.dep_%:
+       $Q$(MKINCLUDE)/get_version.sh -m $* > $@
+
+build: $(MKBUILD) $(DEPS_TARGETS)
+       $Qdocker build -t osm/$(LOWER_MDG):$(TAG) \
+                   --build-arg RELEASE=$(RELEASE) \
+                   --build-arg REPOSITORY=$(REPOSITORY) \
+                   --build-arg REPOSITORY_KEY=$(REPOSITORY_KEY) \
+                   --build-arg REPOSITORY_BASE=$(REPOSITORY_BASE) \
+                   --build-arg MON_VERSION==$(shell cat $(MKBUILD)/.dep_MON) \
+                   --build-arg IM_VERSION==$(shell cat $(MKBUILD)/.dep_IM) \
+                   --build-arg RO_VERSION==$(shell cat $(MKBUILD)/.dep_RO) \
+                   --build-arg LCM_VERSION==$(shell cat $(MKBUILD)/.dep_LCM) \
+                   --build-arg COMMON_VERSION==$(shell cat $(MKBUILD)/.dep_common) \
+                   --build-arg OSMCLIENT_VERSION==$(shell cat $(MKBUILD)/.dep_osmclient) \
+                   --build-arg NBI_VERSION==$(shell cat $(MKBUILD)/.dep_NBI) \
+                   $(DOCKER_ARGS) .
+
+clean:
+       rm -f $(MKBUILD)/.dep*
+
+tag:
+       docker tag osm/$(LOWER_MDG) osm/$(LOWER_MDG):$(TAG)
diff --git a/docker/mk/dirs.mk b/docker/mk/dirs.mk
new file mode 100644 (file)
index 0000000..53846cc
--- /dev/null
@@ -0,0 +1,47 @@
+#
+#   Copyright 2017 Sandvine
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+
+TOPDIR=$(shell readlink -f .|sed -e 's/\/descriptor-packages\/.*//')
+TOOLS_DIR := $(TOPDIR)/tools
+
+SUBDIRS_CLEAN = $(addsuffix .clean, $(SUBDIRS))
+SUBDIRS_TEST = $(addsuffix .test, $(SUBDIRS))
+SUBDIRS_TAG = $(addsuffix .tag, $(SUBDIRS))
+
+.PHONY: $(SUBDIRS) $(SUBDIRS_CLEAN) clean test tag
+
+all: $(SUBDIRS)
+
+clean: $(SUBDIRS_CLEAN)
+
+test: $(SUBDIRS_TEST)
+
+tag: $(SUBDIRS_TAG)
+
+$(SUBDIRS_CLEAN): %.clean:
+       @$(MAKE) --no-print-directory -C $* clean
+
+$(SUBDIRS_TEST): %.test:
+       @$(MAKE) --no-print-directory -C $* test
+
+$(SUBDIRS_TAG): %.tag:
+       @$(MAKE) --no-print-directory -C $* tag 
+
+$(SUBDIRS):
+       @$(MAKE) --no-print-directory -C $@
+
+test:
+       $(TOOLS_DIR)/launch_tests.sh
diff --git a/docker/mk/get_version.sh b/docker/mk/get_version.sh
new file mode 100755 (executable)
index 0000000..8b6e1cd
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+RELEASE="ReleaseFOUR-daily"
+REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
+REPOSITORY="testing"
+REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
+DEBUG=
+
+while getopts ":r:k:u:R:b:-:dm:" o; do
+    case "${o}" in
+        r)
+            REPOSITORY=${OPTARG}
+            ;;
+        R)
+            RELEASE=${OPTARG}
+            ;;
+        k)
+            REPOSITORY_KEY=${OPTARG}
+            ;;
+        u)
+            REPOSITORY_BASE=${OPTARG}
+            ;;
+        d)
+            DEBUG=y
+            ;;
+        m)
+            MDG=${OPTARG}
+            ;;
+        -)
+            ;;
+    esac
+done
+
+if [ -z "$MDG" ]; then
+    echo "missing MDG"
+fi
+
+if [ -n "$DEBUG" ]; then
+    echo curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages
+fi
+
+curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages 2>/dev/null | awk -v mdg=$MDG '{
+    if ( /Package:/ && match($2,tolower(mdg)) ) {
+        package=1;
+    } else if (package==1 && match($1,"Version:")) { 
+        package=0; 
+        printf("%s\n", $2);
+    }
+}' | head -1
index a2cd547..b8e7686 100644 (file)
@@ -4,6 +4,10 @@ LABEL authors="Michael Marchetti"
 
 RUN apt-get update && apt-get -y install curl software-properties-common
 
+RUN apt-get update && apt-get -y install python \
+    libcurl4-gnutls-dev libgnutls-dev iputils-ping python-pip
+RUN pip install python-magic pytest
+
 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
 ARG RELEASE=ReleaseFOUR-daily
 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
@@ -12,9 +16,10 @@ ARG REPOSITORY=testing
 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} devops osmclient" && apt update
 
-RUN apt-get update && apt-get -y install python \
-    libcurl4-gnutls-dev libgnutls-dev osm-devops python-osmclient iputils-ping python-pip
-RUN pip install python-magic pytest
+ARG OSMCLIENT_VERSION
+ARG DEVOPS_VERSION
+
+RUN apt-get update && apt-get -y install osm-devops${DEVOPS_VERSION} python-osmclient${OSMCLIENT_VERSION}
 
 ENV OSM_SOL005=True
 ENV OSM_HOSTNAME=nbi:9999
diff --git a/docker/osmclient/Makefile b/docker/osmclient/Makefile
new file mode 100644 (file)
index 0000000..d64462a
--- /dev/null
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/pm/Dockerfile b/docker/pm/Dockerfile
new file mode 100644 (file)
index 0000000..9fec7c4
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright 2018 Whitestack, LLC
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Whitestack, LLC
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+
+#         http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: bdiaz@whitestack.com or glavado@whitestack.com
+##
+
+FROM ubuntu:16.04
+
+LABEL authors="Benjamín Díaz"
+
+RUN apt-get --yes update \
+ && apt-get --yes install python3 python3-pip libmysqlclient-dev git \
+ && pip3 install pip==9.0.3
+
+RUN git clone https://osm.etsi.org/gerrit/osm/MON MON
+#COPY requirements.txt /policy_module/requirements.txt
+
+RUN pip3 install -r /MON/policy_module/requirements.txt
+
+RUN pip3 install /MON/policy_module
+
+CMD bash /MON/policy_module/scripts/gen_config_from_env.sh && osm-policy-agent --config osm_policy_agent.cfg
diff --git a/docker/pm/Makefile b/docker/pm/Makefile
new file mode 100644 (file)
index 0000000..e638100
--- /dev/null
@@ -0,0 +1,6 @@
+include ../mk/Makefile.include
+
+# Currently LW-UI needs no-cache (binary version packages not yet available)
+DOCKER_ARGS += $(NO_CACHE)
+
+MDG=$(shell basename $(CURDIR))
index 6924314..fefd66e 100644 (file)
@@ -13,13 +13,13 @@ networks:
     #  com.docker.network.driver.mtu: "1446"
 services:
   zookeeper:
-    image: wurstmeister/zookeeper
+    image: wurstmeister/zookeeper:${ZOOKEEPER_TAG:-latest}
 #    ports:
 #      - "2181:2181"
     networks:
       - netOSM
   kafka:
-    image: wurstmeister/kafka
+    image: wurstmeister/kafka:${KAFKA_TAG:-latest}
     ports:
       - "9092"
     networks:
@@ -41,7 +41,7 @@ services:
     volumes:
       - mongo_db:/data/db
   nbi:
-    image: osm/nbi
+    image: osm/nbi:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -55,7 +55,7 @@ services:
     #  - kafka
     #  - mongo
   lcm:
-    image: osm/lcm
+    image: osm/lcm:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -81,7 +81,7 @@ services:
 #    ports:
 #      - "3306:3306"
   ro:
-    image: osm/ro
+    image: osm/ro:${TAG:-latest}
     networks:
       - netOSM
     environment:
@@ -93,7 +93,7 @@ services:
     ports:
       - "${OSM_RO_PORTS:-9090:9090}"
   mon:
-    image: osm/mon
+    image: osm/mon:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -108,7 +108,7 @@ services:
     ports:
       - "8662"
   pm:
-    image: osm/pm
+    image: osm/pm:${TAG:-latest}
     networks:
       - netOSM
     environment:
@@ -117,7 +117,7 @@ services:
     #  - kafka
     #  - mon
   light-ui:
-    image: osm/light-ui
+    image: osm/light-ui:${TAG:-latest}
     networks:
       - netOSM
     environment:
index fa1c9ef..f96bfae 100755 (executable)
@@ -36,6 +36,7 @@ function usage(){
     echo -e "     -o <ADDON>:     ONLY (un)installs one of the addons (vimemu, elk_stack, pm_stack)"
     echo -e "     -D <devops path> use local devops installation path"
     echo -e "     -w <work dir>   Location to store runtime installation"
+    echo -e "     -t <docker tag> specify osm docker tag (default is latest)"
     echo -e "     --nolxd:        do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)"
     echo -e "     --nodocker:     do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)"
     echo -e "     --nojuju:       do not juju, assumes already installed"
@@ -629,7 +630,7 @@ function juju_createcontroller() {
         # Not found created, create the controller
         sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost $OSM_STACK_NAME"
     fi
-    [ $(sg lxd -c "juju controllers" |grep "$OSM_STACK_NAME" |wc -l) -eq 1 ] || FATAL "Juju installation failed"
+    [ $(sg lxd -c "juju controllers" | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
 }
 
 function generate_docker_images() {
@@ -720,7 +721,7 @@ function generate_docker_env_files() {
 }
 
 function generate_osmclient_script () {
-    echo "docker run -ti --network net${OSM_STACK_NAME} osm/osmclient" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
+    echo "docker run -ti --network net${OSM_STACK_NAME} osm/osmclient:${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
     $WORKDIR_SUDO chmod +x "$OSM_DOCKER_WORK_DIR/osm"
     echo "osmclient sidecar container can be found at: $OSM_DOCKER_WORK_DIR/osm"
 }
@@ -759,6 +760,7 @@ function deploy_lightweight() {
     fi
     echo "export ${OSM_PORTS[@]}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm_ports.sh
     echo "export OSM_NETWORK=net${OSM_STACK_NAME}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
+    echo "export TAG=${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
 
     pushd $OSM_DOCKER_WORK_DIR
     sg docker -c "source ./osm_ports.sh; docker stack deploy -c $OSM_DOCKER_WORK_DIR/docker-compose.yaml $OSM_STACK_NAME"
@@ -1013,8 +1015,9 @@ REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
 REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
 WORKDIR_SUDO=sudo
 OSM_WORK_DIR="/etc/osm"
+OSM_DOCKER_TAG=latest
 
-while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:" o; do
+while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:t:" o; do
     case "${o}" in
         h)
             usage && exit 0
@@ -1061,6 +1064,9 @@ while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:" o; do
             WORKDIR_SUDO=
             OSM_WORK_DIR="${OPTARG}"
             ;;
+        t)
+            OSM_DOCKER_TAG="${OPTARG}"
+            ;;
         o)
             INSTALL_ONLY="y"
             [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue