blob: fbb0600e35df98a5e59ffe5336d52959354ac02f [file] [log] [blame]
Mike Marchetti182bd732018-09-05 09:52:42 -04001# Copyright 2018 Whitestack, LLC
2# *************************************************************
3
4# This file is part of OSM Monitoring module
5# All Rights Reserved to Whitestack, LLC
6
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10
11# http://www.apache.org/licenses/LICENSE-2.0
12
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18
19# For those usages not covered by the Apache License, Version 2.0 please
20# contact: bdiaz@whitestack.com or glavado@whitestack.com
21##
22
David Garciaa60ec732021-03-17 15:28:47 +010023FROM ubuntu:20.04 as INSTALL
Mike Marchetti182bd732018-09-05 09:52:42 -040024
David Garciaa60ec732021-03-17 15:28:47 +010025RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
26 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedue99b45e2021-08-12 15:35:51 +010027 gcc=4:9.3.* \
28 python3=3.8.* \
sousaedue99b45e2021-08-12 15:35:51 +010029 python3-dev=3.8.* \
beierlm5a6d1122022-01-26 10:18:21 -050030 python3-pip=20.0.2* \
31 python3-setuptools=45.2.* \
32 curl=7.68.*
33
34RUN DEBIAN_FRONTEND=noninteractive apt-get --yes install \
35 openssh-client=1:8.*
Mike Marchetti182bd732018-09-05 09:52:42 -040036
David Garciaa60ec732021-03-17 15:28:47 +010037ARG PYTHON3_OSM_COMMON_URL
38ARG PYTHON3_OSM_MON_URL
39ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040040
David Garciaa60ec732021-03-17 15:28:47 +010041RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
42RUN dpkg -i ./osm_common.deb
Benjamin Diaz14017e52018-11-20 12:35:06 -030043
David Garciaa60ec732021-03-17 15:28:47 +010044RUN curl $PYTHON3_N2VC_URL -o n2vc.deb
45RUN dpkg -i ./n2vc.deb
Mike Marchetti182bd732018-09-05 09:52:42 -040046
David Garciaa60ec732021-03-17 15:28:47 +010047RUN curl $PYTHON3_OSM_MON_URL -o osm_mon.deb
48RUN dpkg -i ./osm_mon.deb
Mike Marchetti182bd732018-09-05 09:52:42 -040049
David Garciaa60ec732021-03-17 15:28:47 +010050RUN pip3 install \
51 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt \
52 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
53 -r /usr/lib/python3/dist-packages/osm_mon/requirements.txt
Felipe Vicensce8b5a42019-11-30 19:35:52 +010054
beierlm5a6d1122022-01-26 10:18:21 -050055#######################################################################################
David Garciaa60ec732021-03-17 15:28:47 +010056FROM ubuntu:20.04 as FINAL
Felipe Vicensce8b5a42019-11-30 19:35:52 +010057
beierlm5a6d1122022-01-26 10:18:21 -050058ARG APT_PROXY
59RUN if [ ! -z $APT_PROXY ] ; then \
60 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
61 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
62 fi
63
David Garciaa60ec732021-03-17 15:28:47 +010064RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblasca275682021-09-22 18:11:54 +020065 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
66 python3-minimal=3.8.* \
beierlm5a6d1122022-01-26 10:18:21 -050067 && rm -rf /var/lib/apt/lists/*
68
69RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
70 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblasd992a952021-09-23 17:43:15 +020071 ca-certificates \
72 && rm -rf /var/lib/apt/lists/*
beierlm023e83c2021-04-14 10:12:58 -040073
David Garciaa60ec732021-03-17 15:28:47 +010074COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
75COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
76COPY --from=INSTALL /usr/bin/osm* /usr/bin/
beierlm023e83c2021-04-14 10:12:58 -040077COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
78COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
79COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
80COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
81COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
Felipe Vicensce8b5a42019-11-30 19:35:52 +010082
beierlm026b3562022-02-15 11:29:21 -050083COPY scripts/ /app/osm_mon/scripts/
84
85# Creating the user for the app
86RUN groupadd -g 1000 appuser && \
87 useradd -u 1000 -g 1000 -d /app appuser && \
88 mkdir -p /app/osm_mon && \
89 mkdir -p /app/storage/kafka && \
90 mkdir /app/log && \
91 chown -R appuser:appuser /app
92
93WORKDIR /app/osm_mon
94
95# Changing the security context
96USER appuser
97
98########################################################################
Mike Marchetti182bd732018-09-05 09:52:42 -040099
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300100ENV OSMMON_MESSAGE_DRIVER kafka
101ENV OSMMON_MESSAGE_HOST kafka
102ENV OSMMON_MESSAGE_PORT 9092
103
104ENV OSMMON_DATABASE_DRIVER mongo
105ENV OSMMON_DATABASE_URI mongodb://mongo:27017
106
107ENV OSMMON_SQL_DATABASE_URI sqlite:///mon_sqlite.db
108ENV OSMMON_OPENSTACK_DEFAULT_GRANULARITY 300
109ENV OSMMON_GLOBAL_REQUEST_TIMEOUT 10
110ENV OSMMON_GLOBAL_LOGLEVEL INFO
Benjamin Diaz6a239872018-11-15 10:31:08 -0300111ENV OSMMON_VCA_HOST localhost
112ENV OSMMON_VCA_SECRET secret
113ENV OSMMON_VCA_USER admin
lavadod468d6c2019-12-06 06:54:18 -0500114ENV OSMMON_VCA_CACERT cacert
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300115ENV OSMMON_DATABASE_COMMONKEY changeme
116ENV OSMMON_COLLECTOR_INTERVAL 30
117ENV OSMMON_EVALUATOR_INTERVAL 30
118ENV OSMMON_PROMETHEUS_URL http://prometheus:9090
bravofcfbccb52020-04-01 11:01:11 -0300119ENV OSMMON_GRAFANA_URL http://grafana:3000
120ENV OSMMON_GRAFANA_USER admin
121ENV OSMMON_GRAFANA_PASSWORD admin
Mike Marchetti182bd732018-09-05 09:52:42 -0400122
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300123EXPOSE 8000
124
palsuse3cecd92021-01-18 08:36:26 +0000125HEALTHCHECK --start-period=120s --interval=5s --timeout=2s --retries=12\
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300126 CMD osm-mon-healthcheck || exit 1
Mike Marchetti182bd732018-09-05 09:52:42 -0400127
Benjamin Diaz9261c662019-02-25 17:18:51 -0300128CMD /bin/bash scripts/start.sh