aboutsummaryrefslogtreecommitdiffstats
path: root/sdv/docs/docker/sdvconfig/user/configguide.rst
diff options
context:
space:
mode:
authorSridhar Rao <sridhar.rao@spirent.com>2020-10-15 01:55:24 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-10-15 01:55:24 +0000
commitf12039ae1fb9ed773ddf3d8000c6645e5900c48e (patch)
tree53dff91c6d2bcbe8b0ba5511ea8e7a32f52dd993 /sdv/docs/docker/sdvconfig/user/configguide.rst
parentc5bd3737e608b81ef5d4361739d680d2fb3bb1cb (diff)
parentb189119586d1d3cf176c31402daa4b34830ec48b (diff)
Merge "sdv-prevalidation: added src, mapping, documentation, Dockerfile, and server files"
Diffstat (limited to 'sdv/docs/docker/sdvconfig/user/configguide.rst')
-rw-r--r--sdv/docs/docker/sdvconfig/user/configguide.rst83
1 files changed, 83 insertions, 0 deletions
diff --git a/sdv/docs/docker/sdvconfig/user/configguide.rst b/sdv/docs/docker/sdvconfig/user/configguide.rst
new file mode 100644
index 0000000..d8bb3c2
--- /dev/null
+++ b/sdv/docs/docker/sdvconfig/user/configguide.rst
@@ -0,0 +1,83 @@
+=========
+SDVConfig
+=========
+Welcome to the SDVConfig config Guide!
+
+Who should use this guide?
+
+If you are searching for a way to run the sdvconfig code and don't know how, this guide is for you.
+
+There currently exists two ways of running the code, they are through commandline and through docker-http.
+
+Commandline
+^^^^^^^^^^^
+The configuration required are as follows.
+
+Use Python Virtual Environment Manager
+```
+python3 -m pip install --user virtualenv
+python3 -m venv env
+source env/bin/activate
+```
+Install the required packages from requirements.txt
+
+```
+pip install -r requirements.txt
+```
+Please refer the user guide on how to run the code on commandline.
+
+docker-http
+^^^^^^^^^^^
+Make sure you have docker installed before proceeding any further.
+
+The Dockerfile contents are as follows.
+
+.. code:: bash
+ FROM python:3.8-slim-buster
+
+ # create folder sdvconfig
+ RUN mkdir sdvconfig
+ # change the workdir to the newly created file
+ WORKDIR /sdvconfig/
+
+ # install from requirements.txt
+ COPY requirements.txt /sdvconfig/requirements.txt
+ RUN pip install -r requirements.txt
+ RUN rm requirements.txt
+
+ # copy all required files/folders
+ COPY extrapolation/ /sdvconfig/extrapolation/
+ COPY mapping/ /sdvconfig/mapping/
+ COPY validation/ /sdvconfig/validation/
+ COPY server.py /sdvconfig/
+ COPY cli_validation.py /sdvconfig/
+ COPY testapi/ sdvconfig/testapi/
+ COPY manifest /sdvconfig/manifest/
+
+ # expose port for rest calls
+ EXPOSE 8000
+
+ # run the http server
+ CMD [ "python", "server.py" ]
+
+Build the docker image with the following command.
+
+```
+docker build --tag <user>/sdvconfig:<version>
+```
+You’ll see Docker step through each instruction in your Dockerfile, building up your image as it goes. If successful, the build process should end with a message Successfully tagged <user>/sdvconfig:<version>.
+
+Finally we can run the image as a container with the follwing command.
+
+```
+docker run -v /path/to/folder:/path/to/folder --publish 8000:8000 --detach --name config <user>/sdvconfig:<version>
+```
+
+There are a couple of common flags here:
+- --publish asks Docker to forward traffic incoming on the host’s port 8000 to the container’s port 8080. Containers have their own private set of ports, so if you want to reach one from the network, you have to forward traffic to it in this way. Otherwise, firewall rules will prevent all network traffic from reaching your container, as a default security posture.
+- --detach asks Docker to run this container in the background.
+- --name specifies a name with which you can refer to your container in subsequent commands, in this case config.
+Finally we attach a volume from the localhost to the container so we can feed in files such as pdf, manifests to docker-http module and get the results persisted in this volume . This is done with ``` -v ```.
+
+Please refer the user guide regarding the http requests.
+