From 186a7c9014441b1bd97843e54220ecabcc863e7e Mon Sep 17 00:00:00 2001 From: "Ikram Ikramullah (ikram@research.att.com)" Date: Tue, 6 Mar 2018 17:27:15 -0500 Subject: Corrected Docker Files Note: we've been running conductor/has using the source distribution (sdist) Running the git glone instead of going for the artifacts - will do the sdist based execution soon once the blocker for functional testing is removed. Also, added push script for docker images. Issue-ID: OPTFRA-123 Change-Id: I733113d217157828322ebc2464351abdc0752be6 Signed-off-by: Ikram Ikramullah (ikram@research.att.com) --- conductor/docker/api/Dockerfile | 22 +++++++++++++---- conductor/docker/api/api_paste.ini | 26 ++++++++++++++++++++ conductor/docker/build-dockers.sh | 9 +++---- conductor/docker/controller/Dockerfile | 6 ++--- conductor/docker/data/Dockerfile | 6 ++--- conductor/docker/push-dockers.sh | 43 +++++++++++++++++++++++++++++++++ conductor/docker/reservation/Dockerfile | 5 ++-- conductor/docker/run-dockers.sh | 6 ++--- conductor/docker/solver/Dockerfile | 6 ++--- conductor/docker/stop-dockers.sh | 5 ++++ 10 files changed, 105 insertions(+), 29 deletions(-) create mode 100755 conductor/docker/api/api_paste.ini create mode 100755 conductor/docker/push-dockers.sh create mode 100755 conductor/docker/stop-dockers.sh diff --git a/conductor/docker/api/Dockerfile b/conductor/docker/api/Dockerfile index bc0b07d..9280c6c 100755 --- a/conductor/docker/api/Dockerfile +++ b/conductor/docker/api/Dockerfile @@ -16,11 +16,23 @@ # ------------------------------------------------------------------------- FROM python:2.7 +ENV CON_ADDR "127.0.0.1" +ENV CON_PORT "8091" + +EXPOSE 8091 + RUN apt-get update RUN apt-get --assume-yes install python-setuptools +RUN apt-get install -y unzip +RUN apt-get install -y curl +RUN apt-get install -y wget +RUN rm -rf ./has RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -COPY ./conductor.conf conductor.conf -RUN ls -ltr /usr/local/bin/conductor-api -CMD ["sh","-c", "python /usr/local/bin/conductor-api --port=8091 -- --config-file=conductor.conf"] +WORKDIR ./has/conductor/ +#RUN ls +RUN pip install -e . +#COPY ./conductor.conf conductor.conf +WORKDIR ./has/conductor/docker/api +COPY api_paste.ini /usr/local/bin/api_paste.ini +RUN ls +CMD ["sh","-c", "python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/api/api_paste.ini b/conductor/docker/api/api_paste.ini new file mode 100755 index 0000000..4299f46 --- /dev/null +++ b/conductor/docker/api/api_paste.ini @@ -0,0 +1,26 @@ +# Conductor API WSGI Pipeline +# Define the filters that make up the pipeline for processing WSGI requests +# Note: This pipeline is PasteDeploy's term rather than Conductor's pipeline +# used for processing samples + +# Remove authtoken from the pipeline if you don't want to use keystone authentication +[pipeline:main] +pipeline = cors http_proxy_to_wsgi api-server +#pipeline = cors http_proxy_to_wsgi request_id authtoken api-server + +[app:api-server] +paste.app_factory = conductor.api.app:app_factory + +#[filter:authtoken] +#paste.filter_factory = keystonemiddleware.auth_token:filter_factory + +#[filter:request_id] +#paste.filter_factory = oslo_middleware:RequestId.factory + +[filter:cors] +paste.filter_factory = oslo_middleware.cors:filter_factory +oslo_config_project = conductor + +[filter:http_proxy_to_wsgi] +paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory +oslo_config_project = conductor diff --git a/conductor/docker/build-dockers.sh b/conductor/docker/build-dockers.sh index 3d860f8..f62a6fd 100755 --- a/conductor/docker/build-dockers.sh +++ b/conductor/docker/build-dockers.sh @@ -1,9 +1,6 @@ -#codecloud.web.att.com -#vi /etc/resolve.conf -#nameserver 135.207.142.20 -#nameserver 135.207.142.21 -#nameserver 135.207.255.13 - +#!/bin/bash +# TODO (IKRAM): need to test api only first to test the docker upload chain. +# Will enable the others once api is tested docker build -t api api/ docker build -t controller controller/ docker build -t data data/ diff --git a/conductor/docker/controller/Dockerfile b/conductor/docker/controller/Dockerfile index 427cc9b..4f9bfdd 100755 --- a/conductor/docker/controller/Dockerfile +++ b/conductor/docker/controller/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor/ +RUN pip install -e . RUN echo "Starting conductor-controller" CMD ["python","/usr/local/bin/conductor-controller", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/data/Dockerfile b/conductor/docker/data/Dockerfile index d3836d9..9485644 100755 --- a/conductor/docker/data/Dockerfile +++ b/conductor/docker/data/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor +RUN pip install -e . RUN echo "Starting conductor-data" CMD ["python","/usr/local/bin/conductor-data", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/push-dockers.sh b/conductor/docker/push-dockers.sh new file mode 100755 index 0000000..59cb7d4 --- /dev/null +++ b/conductor/docker/push-dockers.sh @@ -0,0 +1,43 @@ +#!/bin/bash +BUILD_ARGS="--no-cache" +ORG="onap" +VERSION="1.1.0" +PROJECT="optf" +IMAGE="api" +DOCKER_REPOSITORY="nexus3.onap.org:10003" +IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" +TIMESTAMP=$(date +"%Y%m%dT%H%M%S") + +if [ $HTTP_PROXY ]; then +BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" +fi +if [ $HTTPS_PROXY ]; then + BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" +fi + +function tag { + echo "Tagging !!!" + docker tag api "nexus3.onap.org:10003/onap/optf/api" + docker tag data "nexus3.onap.org:10003/onap/optf/data" + docker tag controller "nexus3.onap.org:10003/onap/optf/controller" + docker tag solver "nexus3.onap.org:10003/onap/optf/solver" + docker tag reservation "nexus3.onap.org:10003/onap/optf/reservation" +} + + +function push_image { + echo "Start push ${IMAGE_NAME}:latest" + + tag + docker push "nexus3.onap.org:10003/onap/optf/api" + docker push "nexus3.onap.org:10003/onap/optf/data" + docker push "nexus3.onap.org:10003/onap/optf/controller" + docker push "nexus3.onap.org:10003/onap/optf/solver" + docker push "nexus3.onap.org:10003/onap/optf/reservation" + + #docker push ${IMAGE_NAME}:latest + #push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest + #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-latest + #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-${TIMESTAMP} + } +push_image diff --git a/conductor/docker/reservation/Dockerfile b/conductor/docker/reservation/Dockerfile index 2402f1d..323f15d 100755 --- a/conductor/docker/reservation/Dockerfile +++ b/conductor/docker/reservation/Dockerfile @@ -18,10 +18,9 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . +WORKDIR ./has/conductor/ +RUN pip install -e . RUN pwd RUN echo "Starting conductor-reservation" CMD ["python","/usr/local/bin/conductor-reservation", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/run-dockers.sh b/conductor/docker/run-dockers.sh index 555fe04..f8ae249 100755 --- a/conductor/docker/run-dockers.sh +++ b/conductor/docker/run-dockers.sh @@ -1,7 +1,7 @@ ### example run - provide the conductor configuration file as input to the run script -#./run-dockers.sh /conductor.conf -docker run -v $1:/usr/local/bin/conductor.conf api & +# ./run-dockers.sh /conductor.conf +docker run -v $1:/usr/local/bin/conductor.conf data & docker run -v $1:/usr/local/bin/conductor.conf controller & -docker run -v $1:/usr/local/bin/conductor.conf data & +docker run -p "8091:8091" -v $1:/usr/local/bin/conductor.conf api & docker run -v $1:/usr/local/bin/conductor.conf solver & docker run -v $1:/usr/local/bin/conductor.conf reservation & diff --git a/conductor/docker/solver/Dockerfile b/conductor/docker/solver/Dockerfile index 3aad3a9..b1a3125 100755 --- a/conductor/docker/solver/Dockerfile +++ b/conductor/docker/solver/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor +RUN pip install -e . RUN echo "Starting conductor-solver" CMD ["python","/usr/local/bin/conductor-solver", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/stop-dockers.sh b/conductor/docker/stop-dockers.sh new file mode 100755 index 0000000..72595e8 --- /dev/null +++ b/conductor/docker/stop-dockers.sh @@ -0,0 +1,5 @@ +docker stop $(sudo docker ps -a -q --filter ancestor=api) +docker stop $(sudo docker ps -a -q --filter ancestor=solver) +docker stop $(sudo docker ps -a -q --filter ancestor=reservation) +docker stop $(sudo docker ps -a -q --filter ancestor=data) +docker stop $(sudo docker ps -a -q --filter ancestor=controller) -- cgit 1.2.3-korg