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

Add local development instructions for docker in README.md #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,41 @@ speaks, see:

https://developers.google.com/safe-browsing/developers_guide

Local Development (Docker)
--------------------------

Running locally
---------------
To have a running copy of shavar locally for devopment and testing, please follow the following steps:

For dev testing, create and activate a virtual environment:
#### Build docker image tagged mozilla/shavar

virtualenv -p python3.7 shavar
source shavar/bin/activate
docker build -t mozilla/shavar .

#### Run image with container name shavar

docker run --name shavar -p 127.0.0.1:80:8080/tcp mozilla/shavar

*The container name shavar could be changed to whatever name you want*

Install the necessary dependencies:

pip install -r requirements-test.txt
docker exec shavar pip install -r requirements-test.txt

Run code style check:
#### Run code style check

flake8 --exclude ./shavar/lib,./shavar/bin,./build,./deactivate,./.local
docker exec shavar flake8 --exclude ./shavar/lib,./shavar/bin,./build,./deactivate,./.local

Run unit tests:
#### Run unit tests
Before running tests run the following command to create version.json: `docker exec shavar echo '{"commit":"1","version":test","source":"testing"}' > version.json`

nosetests -s --nologcapture ./shavar/tests
docker exec shavar nosetests -s --nologcapture ./shavar/tests

Configure for running locally in a development environment:

python setup.py develop
docker exec shavar python setup.py develop

Run the service locally:

pserve shavar.testing.ini
docker exec shavar pserve shavar.testing.ini

By default the service listens on port the loopback interface, port 6543. If
you want to change this, modify the values in the INI file's [server:main]
Expand Down