Developing for spin-docker

Contributing to spin-docker development is easy! Fork the GitHub repository and you’re halfway there!

Development environment setup

The easiest way to set up a spin-docker development environment is to follow the instructions in Running locally with Vagrant.

Once you have provisioned your vagrant box, you can run the Flask development server with these steps:

  1. vagrant ssh into the box

  2. Switch to the root user (necessary to start the development server on port 80, which is forwarded by Vagrant)

  3. Stop the nginx, gunicorn, and celery services:

    $ service nginx stop
    $ service gunicorn stop
    $ service celery stop
    
  4. cd to the /var/www

  5. Activate the spin-docker virutal environment: source venv/bin/activate

  6. cd into the spin-docker directory

  7. Apply the spin-docker environment variables with source .env

  8. Start the Flask development server: python runserver.py

Activity monitoring, stopping, and deleting containers are managed by Celery. You can start the Celery worker in a separate terminal session (but still as root, because docker is currently configured only for root):

  1. cd to the /var/www
  2. Activate the spin-docker virutal environment: source venv/bin/activate
  3. cd into the spin-docker directory
  4. Apply the spin-docker environment variables with source .env
  5. Run the command celery -A spindocker.tasks.celery worker -l info

Running tests

To run the spin-docker tests and view current code coverage, follow these steps (again as root):

  1. cd to the /var/www
  2. Activate the spin-docker virutal environment: source venv/bin/activate
  3. cd into the spin-docker directory
  4. Apply the spin-docker environment variables with source .env
  5. Install the test requirements in you haven’t already: pip install -r requirements/test.txt
  6. Run the command coverage run --source=spindocker tests.py

After the tests run, you can view current coverage with coverage report and generate an HTML report with coverage html.

Building the docs

If you make changes to the spin-docker documentation, you can check your work by building the docs with make html in the docs directory.