Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Docker configuration #497

Merged
merged 11 commits into from
Jul 28, 2021
Merged

Commits on Jul 23, 2021

  1. Show static files in docker setup

    After 312160c docker-compose doesn't load static files as the server
    runs in development mode without DEBUG enabled.
    Also, this commit makes sure it is loud and heard that running via
    docker is not safe.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    7f69f92 View commit details
    Browse the repository at this point in the history
  2. Remove remaining traces of DJANGO_DEV

    DJANGO_DEV is obsolete and now nowhere exists in the entire codebase
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    ce64bce View commit details
    Browse the repository at this point in the history
  3. Use nginx server in docker with gunicorn support

    The docker setup present earlier used django development server to host
    vulnerablecode, this is neither recommended nor safe. Also the server
    did not drop privileges.
    Docker environment vars are now easily configured via docker.env, also
    the nginx template present in etc/nginx could be used in a non docker
    setup with slight modifications.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    55faf69 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2021

  1. Add Makefile

    Inspired by ScancodeIO. This Makefile makes the installation easy as
    a cake.
    The virtualenv zipapp used in this commit is obtained from
    https://bootstrap.pypa.io/virtualenv/3.8/virtualenv.pyz
    Note: sqlite support in this makefile is not implemented yet. It will be
    done in next commits in this PR.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    be53bb7 View commit details
    Browse the repository at this point in the history
  2. Update CI unit tests to use Makefile

    This will be essential after later commits as the existence of
    SECRET_KEY in .env or environment is going to be non-optional.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    24d8b1d View commit details
    Browse the repository at this point in the history
  3. Update Travis CI to use Makefile

    This is not essential but promotes uniformity.
    Also, `collectstatic` is removed from this test as this is not really
    necessary.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    d24dcb2 View commit details
    Browse the repository at this point in the history
  4. Make Settings consistent with scancodeio

    Inspired by scancodeio, we now have a consistent ALLOWED_HOSTS
    environment variable support. SECRET_KEY no longer defaults to insecure
    values and is required to be generated. Static files are now served in
    /var/vulnerablecode/static which is consistent to scancodeio.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    e01dc44 View commit details
    Browse the repository at this point in the history
  5. Refine Docker installation

    File hierarchy inside docker container now looks similar to scancodeio.
    postgres data is now a docker volume, so it will persist even after
    recreation.  .dockerignores makes sure that we don't overpopulate docker
    images, improving build times.  A common environment variable for
    containers is kept in docker.env
    The python image we are using now explicitly states python:3.8
    
    NOTE: We should have a postgres health check script which uses python
    manage.py check --database default which comes with max_retries and
    backoffs for `vulnerablecode` container.  Currently, docker's `restart:`
    option is used but it has a caveat that it'll restart on non-db errors
    as well.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    25292dd View commit details
    Browse the repository at this point in the history
  6. Add Docker related documentation

    This calls for a lot of changes in other parts of documentation as well.
    This will be done in later PRs. This commit marks the end of this PR.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    1ab0b28 View commit details
    Browse the repository at this point in the history
  7. Revert Use cache for pip in CI test

    This commit gets rid of using any type of cache (introduced in 135c95f)
    This is to ensure having no surprises in future. This was discussed in
    https://github.com/nexB/vulnerablecode/wiki/WeeklyMeetings#meeting-on-tuesday-2021-07-27-at-1300-utc
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    c024620 View commit details
    Browse the repository at this point in the history
  8. Remove TravisCI tests

    These are redundant after PR# 295.
    
    Signed-off-by: Hritik Vijay <[email protected]>
    Hritik14 committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    b69dee2 View commit details
    Browse the repository at this point in the history