Bundle the listener into the core image 21/2521/2
authorE. Scott Daniels <daniels@research.att.com>
Fri, 14 Feb 2020 19:27:08 +0000 (14:27 -0500)
committerVlad Shkapenyuk <vshkap@research.att.com>
Thu, 20 Feb 2020 23:08:46 +0000 (23:08 +0000)
This change causes the mc_listener application to be included
in the core MC image.  This is accomplished by basing the
final image on the listener container and by adding a "container
start" script which will start the "sidecars" (listener in this
case) and finally starts the core application.

The container version has been bumped to 2.0.

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I983cacbaef4cfd95144664b05043b39e478b7827

mc-core/Dockerfile
mc-core/container-tag.yaml
mc-core/container_start.sh [new file with mode: 0755]

index 89f5314..eebfffd 100644 (file)
@@ -17,6 +17,7 @@
 ARG STAGE_DIR=/mc
 
 FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:3-u16.04-nng AS project-build
+
 # Update & installation of linux packages
 RUN apt-get update -y && \
         apt-get install -y curl && \
@@ -57,9 +58,17 @@ WORKDIR ${STAGE_DIR}/gs-lite/demo/queries
 ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite
 RUN bash ${STAGE_DIR}/gs-lite/bin/buildit
 
+# Update & installation of linux packages
+RUN apt-get update -y && \
+        apt-get install -y curl && \
+        apt-get install -y procps && \
+        apt-get install -y python-pip
 
 # now install the binaries and libraries into smaller docker image
-FROM ubuntu:16.04
+# use the mc_listener container as the base; all of it's stuff is in /playpen and can
+# stay where it is
+#
+FROM nexus3.o-ran-sc.org:10004/o-ran-sc/ric-app-mc-listener:1.3.2
 
 ARG STAGE_DIR
 
@@ -70,6 +79,8 @@ COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /mc/
 COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/
 COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/
 
+COPY container_start.sh /playpen/bin/
+
 RUN apt-get update && \
     apt-get install -y curl python python-pip && \
     apt-get clean
@@ -78,6 +89,7 @@ RUN ldconfig
 RUN pip install protobuf
 
 ENV XAPP_DESCRIPTOR_PATH /mc/mc_deployment.json
-WORKDIR /mc/gs-lite/demo/queries
+WORKDIR /playpen
 ENV GSLITE_ROOT /mc/gs-lite
-CMD ["./runall"]
+
+CMD ["/playpen/bin/container_start.sh"]
index b52f7ea..bd28b38 100644 (file)
@@ -1,4 +1,4 @@
 ---
-tag: '1.0.1'
+tag: '2.0.1'
 
 # this is used by the CI jobs to tag the image it builds
diff --git a/mc-core/container_start.sh b/mc-core/container_start.sh
new file mode 100755 (executable)
index 0000000..1af09d4
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+# vim: ts=4 sw=4 noet:
+#----------------------------------------------------------------------------------
+#
+#      Copyright (c) 2018-2020 AT&T Intellectual Property.
+#
+#   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.
+#
+#---------------------------------------------------------------------------------
+
+
+# ----------------------------------------------------------------------
+# Mnemonic:    container_start.sh
+# Abstract: For some "pod" environments a single container is required.
+#                      This starts all of the related processes which normally would
+#                      be started in individual containers.
+#
+#                      There are two environment variables which affect the operation
+#                      of this script:
+#                              USE_NNG -- if set to !0 then the NNG version of the listener
+#                                                      is started; undefined or when 0 then the SI95
+#                                                      version is used.
+#
+#                              GSLITE_ROOT -- Assumed to be the root directory for the 
+#                                                      core MC xAPP. If not defined, /mc/gs-lite is
+#                                                      assumed.
+#
+# Date:                13 February 2019
+# Author:      E. Scott Daniels
+# ----------------------------------------------------------------------
+
+set -e
+
+SIMULATOR_MODE=`python /mc/extract_params.py $XAPP_DESCRIPTOR_PATH simulator_mode`
+
+if [ "$SIMULATOR_MODE" != "true" ]
+then
+# --- start "sidecars" first. They are expected to need /playpen as the working dir
+
+(
+       cd /playpen
+       if (( $USE_NNG )) || [[ ! -f bin/mc_listener_si ]]              # we really want the si version unless forced
+       then
+               bin/mc_listener
+       else
+               bin/mc_listener_si
+       fi
+) >/tmp/listener.std 2>&1 &
+
+echo "listener was started" >&2
+
+fi
+
+# ---- finally, start the core MC application -----------------------------
+cd ${GSLITE_ROOT:-/mc/gs-lite}/demo/queries
+./runall
+
+