aboutsummaryrefslogtreecommitdiffstats
path: root/sdv/docs/docker/sdvconfig/user
diff options
context:
space:
mode:
Diffstat (limited to 'sdv/docs/docker/sdvconfig/user')
-rw-r--r--sdv/docs/docker/sdvconfig/user/configguide.rst83
-rw-r--r--sdv/docs/docker/sdvconfig/user/userguide.rst42
2 files changed, 125 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.
+
diff --git a/sdv/docs/docker/sdvconfig/user/userguide.rst b/sdv/docs/docker/sdvconfig/user/userguide.rst
new file mode 100644
index 0000000..f38303d
--- /dev/null
+++ b/sdv/docs/docker/sdvconfig/user/userguide.rst
@@ -0,0 +1,42 @@
+=========
+SDVConfig
+=========
+Welcome to the SDVConfig user 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.
+
+Currently there exists two functionalities, extrapolation and validation.
+
+To do a extrapolate POST request, use following command.
+
+```
+curl --header "Content-Type: application/json" --request POST --data '{"pdf_fn":"<>", "store_at":"<>"}' http://localhost:8000/extrapolate
+```
+
+To run this on commandline, use the following command
+
+```
+python extrapolation.py --pdf_fn="path/to/pdf_fn" --store-at="path/to/storage"
+```
+
+The pdf_fn key expects absolute filepath to pdf or a raw github file url.
+the store_at key expects absolute filepath to which the new generated pdf should be stored at.
+
+To do a validation POST request, use following command
+
+```
+curl --header "Content-Type: application/json" --request POST --data '{"pdf_file":"<>", "inst_dir":"<>", "inst_type":"<>", "sitename":"<>"}' http://localhost:8000/validate
+```
+
+To run this on commandline, use the following command.
+
+```
+python cli_validation.py --inst_dir=path/to/mani_dir --inst_type=type --pdf=path/to/pdf --sitename=sitename
+```
+
+The pdf_file key expects absolute filepath to pdf or a raw github file url.
+The inst_dir key expects absolute filepath to installer directory or a github clone url.
+The inst_type key expects installer type string ("airship", "tripleo", etc.)
+sitename: intel-pod10, intel-pod15 etc.