From 4b1604a07a478481d3192a1e3c46df89a97260ca Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 29 Jul 2021 02:00:03 +0530 Subject: [PATCH 1/2] Add docker docs This is a part of 1ab0b28 Signed-off-by: Hritik Vijay --- README.rst | 2 +- docs/docker_installation.rst | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 docs/docker_installation.rst diff --git a/README.rst b/README.rst index d35028e46..3e55b1029 100644 --- a/README.rst +++ b/README.rst @@ -91,7 +91,7 @@ First clone the source code:: Using Docker Compose ---------------------- +~~~~~~~~~~~~~~~~~~~~~~ Please find the docker documentation in `Docker Installation `__ diff --git a/docs/docker_installation.rst b/docs/docker_installation.rst new file mode 100644 index 000000000..481f8c2cd --- /dev/null +++ b/docs/docker_installation.rst @@ -0,0 +1,74 @@ +.. _docker_image: + +Docker image +============ + +Get Docker +---------- + +The first step is to download and install Docker on your platform. +Refer to the following Docker documentation and choose the best installation +path for you: `Get Docker `_ + +Build the Image +--------------- + +VulnerableCode is distributed with ``Dockerfile`` and ``docker-compose.yml`` files +required for the creation of the Docker image. + +Clone the git `VulnerableCode repo `_, +create an environment file, and build the Docker image: + +.. code-block:: bash + + git clone https://github.com/nexB/vulnerablecode.git && cd vulnerablecode + make envfile + docker-compose build + +.. note:: + + The image will need to be re-built when the VulnerableCode app source code is + modified or updated via + ``docker-compose build --no-cache vulnerablecode`` + +Run the Image +------------- + +Run your image as a container + +.. code-block:: bash + + docker-compose up + + +At this point, the VulnerableCode app should be running at port ``8000`` on your Docker host. +Go to http://localhost:8000/ on a web browser to access the web UI. +Optionally, you can set ``NGINX_PORT`` environment variable in your shell or in the `.env` file to run on a different port than 8000. + +.. warning:: + + To access a dockerized VulnerableCode app from a remote location, the ``ALLOWED_HOSTS`` + setting need to be provided in your ``docker.env`` file:: + + ALLOWED_HOSTS=.domain.com,127.0.0.1 + + Refer to `Django ALLOWED_HOSTS settings `_ + for documentation. + + +Invoke the importers +-------------------- + +Connect to the Docker container ``bash``. +From here you can access ``manage.py`` and run management commands +to import data as specified in the `Data import <../README.rst#data-import>`_ section and run commands +for the importers from there + +For example: + +.. code-block:: bash + + docker-compose exec vulnerablecode bash + ./manage.py import --list + + From 72aec03cd0082b37964c80b21fb25bc6cc2c2e7e Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Mon, 2 Aug 2021 17:48:29 +0530 Subject: [PATCH 2/2] Add tl;dr and warn about serving on network Explicitly mention that serving VulnerableCode on a network could be security issue and there are several steps that may be needed to secure such a deployment. Further, a quick tl;dr to run with docker in readme is added for convenience. Signed-off-by: Hritik Vijay --- README.rst | 12 ++++++++++++ docs/docker_installation.rst | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3e55b1029..476e952f5 100644 --- a/README.rst +++ b/README.rst @@ -95,6 +95,18 @@ Using Docker Compose Please find the docker documentation in `Docker Installation `__ +TL;DR +"""""" + +.. code-block:: bash + + git clone https://github.com/nexB/vulnerablecode.git && cd vulnerablecode + make envfile + docker-compose up + +Go to http://localhost:8000/ on a web browser to access the web UI. + + Without Docker Compose ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/docker_installation.rst b/docs/docker_installation.rst index 481f8c2cd..8cc86e2a7 100644 --- a/docs/docker_installation.rst +++ b/docs/docker_installation.rst @@ -45,7 +45,7 @@ At this point, the VulnerableCode app should be running at port ``8000`` on your Go to http://localhost:8000/ on a web browser to access the web UI. Optionally, you can set ``NGINX_PORT`` environment variable in your shell or in the `.env` file to run on a different port than 8000. -.. warning:: +.. note:: To access a dockerized VulnerableCode app from a remote location, the ``ALLOWED_HOSTS`` setting need to be provided in your ``docker.env`` file:: @@ -55,6 +55,12 @@ Optionally, you can set ``NGINX_PORT`` environment variable in your shell or in Refer to `Django ALLOWED_HOSTS settings `_ for documentation. +.. warning:: + + Serving VulnerableCode on a network could lead to security issues and there + are several steps that may be needed to secure such a deployment. + Currently, this is not recommendend. + Invoke the importers --------------------