Corrected Docker Files 67/34367/4
authorIkram Ikramullah (ikram@research.att.com) <ikram@research.att.com>
Tue, 6 Mar 2018 22:27:15 +0000 (17:27 -0500)
committerIkram Ikramullah (ikram@research.att.com) <ikram@research.att.com>
Wed, 7 Mar 2018 21:38:42 +0000 (16:38 -0500)
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) <ikram@research.att.com>
conductor/docker/api/Dockerfile
conductor/docker/api/api_paste.ini [new file with mode: 0755]
conductor/docker/build-dockers.sh
conductor/docker/controller/Dockerfile
conductor/docker/data/Dockerfile
conductor/docker/push-dockers.sh [new file with mode: 0755]
conductor/docker/reservation/Dockerfile
conductor/docker/run-dockers.sh
conductor/docker/solver/Dockerfile
conductor/docker/stop-dockers.sh [new file with mode: 0755]

index bc0b07d..9280c6c 100755 (executable)
 # -------------------------------------------------------------------------
 
 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 (executable)
index 0000000..4299f46
--- /dev/null
@@ -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
index 3d860f8..f62a6fd 100755 (executable)
@@ -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/
index 427cc9b..4f9bfdd 100755 (executable)
 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"]
index d3836d9..9485644 100755 (executable)
 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 (executable)
index 0000000..59cb7d4
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash \r
+BUILD_ARGS="--no-cache" \r
+ORG="onap" \r
+VERSION="1.1.0" \r
+PROJECT="optf" \r
+IMAGE="api" \r
+DOCKER_REPOSITORY="nexus3.onap.org:10003" \r
+IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" \r
+TIMESTAMP=$(date +"%Y%m%dT%H%M%S") \r
\r
+if [ $HTTP_PROXY ]; then \r
+BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" \r
+fi \r
+if [ $HTTPS_PROXY ]; then \r
+    BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" \r
+fi \r
\r
+function tag {\r
+     echo "Tagging !!!"\r
+     docker tag api "nexus3.onap.org:10003/onap/optf/api"\r
+     docker tag data "nexus3.onap.org:10003/onap/optf/data"\r
+     docker tag controller "nexus3.onap.org:10003/onap/optf/controller"\r
+     docker tag solver "nexus3.onap.org:10003/onap/optf/solver"\r
+     docker tag reservation "nexus3.onap.org:10003/onap/optf/reservation"\r
+}\r
+\r
+\r
+function push_image { \r
+     echo "Start push ${IMAGE_NAME}:latest" \r
+     \r
+     tag\r
+     docker push "nexus3.onap.org:10003/onap/optf/api"\r
+     docker push "nexus3.onap.org:10003/onap/optf/data"\r
+     docker push "nexus3.onap.org:10003/onap/optf/controller"\r
+     docker push "nexus3.onap.org:10003/onap/optf/solver"\r
+     docker push "nexus3.onap.org:10003/onap/optf/reservation"\r
+     \r
+     #docker push ${IMAGE_NAME}:latest \r
+     #push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest \r
+     #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-latest \r
+     #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-${TIMESTAMP} \r
+ } \r
+push_image\r
index 2402f1d..323f15d 100755 (executable)
 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"]
index 555fe04..f8ae249 100755 (executable)
@@ -1,7 +1,7 @@
 ### example run - provide the conductor configuration file as input to the run script
-#./run-dockers.sh <path-to>/conductor.conf
-docker run -v $1:/usr/local/bin/conductor.conf api & 
+# ./run-dockers.sh <path-to>/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 &
index 3aad3a9..b1a3125 100755 (executable)
 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 (executable)
index 0000000..72595e8
--- /dev/null
@@ -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)