| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 1 | # Copyright 2018 Telefonica S.A. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | # implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| calvinosanch | d5916fd | 2020-01-09 17:19:53 +0100 | [diff] [blame] | 16 | FROM ubuntu:18.04 |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 17 | |
| 18 | # Set the working directory to /app |
| tierno | 2b82991 | 2019-08-30 15:21:05 +0000 | [diff] [blame] | 19 | WORKDIR /app/LCM |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 20 | |
| calvinosanch | d5916fd | 2020-01-09 17:19:53 +0100 | [diff] [blame] | 21 | RUN apt-get update && apt-get install -y curl xz-utils gnupg2 \ |
| calvinosanch | 9f9c6f2 | 2019-11-04 13:37:39 +0100 | [diff] [blame] | 22 | && apt-get update && apt-get install -y apt-transport-https \ |
| 23 | && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \ |
| 24 | && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \ |
| 25 | && apt-get update && apt-get install -y kubectl |
| 26 | |
| 27 | RUN curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz \ |
| 28 | && tar -zxvf helm-v2.15.2.tar.gz \ |
| 29 | && mv linux-amd64/helm /usr/local/bin/helm \ |
| 30 | && rm -r linux-amd64/ |
| 31 | |
| Dominik Fleischmann | 584465c | 2020-05-21 14:00:43 +0200 | [diff] [blame] | 32 | RUN curl -L https://launchpad.net/juju/2.7/2.7.6/+download/juju-2.7.6-k8s.tar.xz --output juju-2.7.6-k8s.tar.xz \ |
| 33 | && tar -xvf juju-2.7.6-k8s.tar.xz \ |
| Adam Israel | baacc30 | 2019-12-01 12:41:39 -0500 | [diff] [blame] | 34 | && mv juju /usr/local/bin/juju |
| 35 | |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 36 | RUN apt-get update && apt-get install -y git tox python3 \ |
| calvinosanch | d5916fd | 2020-01-09 17:19:53 +0100 | [diff] [blame] | 37 | python3-pip python3-jinja2 \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame] | 38 | && python3 -m pip install pip --upgrade \ |
| calvinosanch | d5916fd | 2020-01-09 17:19:53 +0100 | [diff] [blame] | 39 | && python3 -m pip install -U 'PyYAML' 'aiohttp>=2.3.10' flake8 |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 40 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 41 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/N2VC.git \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame] | 42 | && python3 -m pip install -e /app/N2VC \ |
| 43 | && python3 -m pip install -U juju \ |
| tierno | f578e55 | 2018-11-08 19:07:20 +0100 | [diff] [blame] | 44 | && apt-get install -y libffi-dev libssl-dev openssh-client |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 45 | # cd N2VC; python3 setup.py develop |
| 46 | # cd modules/libjuju; python3 setup.py develop |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 47 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 48 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame] | 49 | && python3 -m pip install -e /app/common |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 50 | # python3-pymongo python3-yaml pycrypto aiokafka |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 51 | |
| lloretgalleg | 62b2ee4 | 2020-06-30 11:26:48 +0000 | [diff] [blame] | 52 | RUN python3 -m pip install grpcio-tools grpclib |
| 53 | |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 54 | RUN mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 55 | |
| 56 | |
| 57 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| tierno | 8d95001 | 2018-05-22 12:27:48 +0200 | [diff] [blame] | 58 | Description="This implements the Life Cicle Management module of OSM" \ |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 59 | Version="1.0" \ |
| 60 | Author="Alfonso Tierno" |
| 61 | |
| 62 | # Used for local storage |
| 63 | VOLUME /app/storage |
| 64 | # Used for logs |
| 65 | VOLUME /app/log |
| 66 | |
| 67 | # The following ENV can be added with "docker run -e xxx' to configure LCM |
| 68 | ENV OSMLCM_RO_HOST ro |
| 69 | ENV OSMLCM_RO_PORT 9090 |
| 70 | ENV OSMLCM_RO_TENANT osm |
| 71 | |
| 72 | # VCA |
| 73 | ENV OSMLCM_VCA_HOST vca |
| garciadeblas | ee29bc7 | 2019-12-17 15:47:58 +0100 | [diff] [blame] | 74 | ENV OSMLCM_VCA_PORT 17070 |
| 75 | ENV OSMLCM_VCA_USER admin |
| 76 | ENV OSMLCM_VCA_SECRET secret |
| Dominik Fleischmann | 90fd5b3 | 2020-03-19 09:23:00 +0100 | [diff] [blame] | 77 | ENV OSMLCM_VCA_CLOUD: localhost |
| garciadeblas | ee29bc7 | 2019-12-17 15:47:58 +0100 | [diff] [blame] | 78 | # ENV OSMLCM_VCA_ENABLEOSUPGRADE false |
| 79 | # ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/ |
| 80 | # ENV OSMLCM_VCA_PUBKEY pubkey |
| 81 | # ENV OSMLCM_VCA_CACERT cacert |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 82 | |
| tierno | 744303e | 2020-01-13 16:46:31 +0000 | [diff] [blame] | 83 | # VCA - k8s |
| 84 | ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm |
| 85 | ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl |
| 86 | ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju |
| 87 | |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 88 | # database |
| 89 | ENV OSMLCM_DATABASE_DRIVER mongo |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 90 | ENV OSMLCM_DATABASE_URI mongodb://mongo:27017 |
| 91 | # ENV OSMLCM_DATABASE_COMMONKEY xxx |
| tierno | 17a612f | 2018-10-23 11:30:42 +0200 | [diff] [blame] | 92 | # ENV OSMLCM_DATABASE_USER xxx |
| 93 | # ENV OSMLCM_DATABASE_PASSWORD xxx |
| tierno | 17a612f | 2018-10-23 11:30:42 +0200 | [diff] [blame] | 94 | |
| 95 | #storage |
| Eduardo Sousa | 5899e08 | 2019-06-21 11:54:56 +0100 | [diff] [blame] | 96 | ENV OSMLCM_STORAGE_DRIVER local |
| 97 | ENV OSMLCM_STORAGE_PATH /app/storage |
| 98 | #ENV OSMLCM_STORAGE_DRIVER mongo |
| 99 | #ENV OSMNBI_STORAGE_URI mongodb://mongo:27017 |
| 100 | #ENV OSMLCM_STORAGE_COLLECTION files |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 101 | |
| 102 | # message |
| 103 | ENV OSMLCM_MESSAGE_DRIVER kafka |
| 104 | ENV OSMLCM_MESSAGE_HOST kafka |
| 105 | ENV OSMLCM_MESSAGE_PORT 9092 |
| 106 | |
| tierno | 991e95d | 2020-07-21 12:41:25 +0000 | [diff] [blame^] | 107 | # tsdb |
| 108 | # ENV OSMLCM_TSDB_DRIVER prometheus |
| 109 | # ENV OSMLCM_TSDB_PATH /etc/prometheus |
| 110 | # ENV OSMLCM_TSDB_URI http://prometheus:9090/ |
| calvinosanch | 9f9c6f2 | 2019-11-04 13:37:39 +0100 | [diff] [blame] | 111 | |
| tierno | 275411e | 2018-05-16 14:33:32 +0200 | [diff] [blame] | 112 | # logs |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 113 | # ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log |
| tierno | 275411e | 2018-05-16 14:33:32 +0200 | [diff] [blame] | 114 | ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG |
| 115 | |
| tierno | 744303e | 2020-01-13 16:46:31 +0000 | [diff] [blame] | 116 | # timeouts |
| 117 | # ENV OSMLCM_TIMEOUT_NS_DEPLOY 7200 |
| 118 | # ENV OSMLCM_TIMEOUT_NSI_DEPLOY 7200 |
| 119 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 120 | # Copy the current directory contents into the container at /app/LCM |
| 121 | ADD . /app/LCM |
| Felipe Vicens | c2033f2 | 2018-11-15 15:09:58 +0100 | [diff] [blame] | 122 | |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 123 | # Run app.py when the container launches |
| tierno | 2b82991 | 2019-08-30 15:21:05 +0000 | [diff] [blame] | 124 | CMD python3 -m osm_lcm.lcm |
| tierno | a9843d8 | 2018-10-24 10:44:20 +0200 | [diff] [blame] | 125 | |
| tierno | 94f0611 | 2020-02-11 12:38:19 +0000 | [diff] [blame] | 126 | # HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \ |
| 127 | # CMD python3 -m osm_lcm.lcm_hc || exit 1 |
| 128 | |