Skip to content

SprintCoderSetup

Robert Sparks edited this page Mar 14, 2022 · 117 revisions

Sprint Coder Setup

WARNING

**Many things on this page have changed since the repository moved to GitHub. See https://github.com/ietf-tools/datatracker/blob/main/docker/README.md **

Introduction

Install Docker

See https://github.com/ietf-tools/datatracker/blob/main/docker/README.md

If this is the first time you have used Docker, please follow the Docker installation all the way through to successfully running the hello-world example in a terminal window ( $ docker run hello-world).

RUN THE TESTS

  • First, run the built-in checks:

       (virtual) $ ./ietf/manage.py check
    

    This will

    1. ensure that you don't have missing directories or any other obvious issues with the OS environment

    2. apply any patches needed to bring library modules up to snuff.

  • You are now ready to run the tests. Make sure that one of the following commands runs to completion without errors:

       (virtual) $ ./ietf/manage.py test --settings=settings_local_sqlitetest
       or
       (virtual) $ ./ietf/manage.py test --settings=settings_local_sqlitetest -v 3   # for more verbose output
    

    If you see any errors or failures, you probably have a configuration problem or are missing a required python module. If it's not obvious what to do to correct the problem, please ask for help. The Troubleshooting page may provide some hints. Once you resolve the problem, consider adding a new hint on that page. For help with running the tests, type:

      (virtual) $ ./ietf/manage.py test --help
    

    A specific subset of test cases containing a failure can be re-run without re-running all of the test cases using (for example):

      (virtual) $ ./ietf/manage.py test --settings=settings_local_sqlitetest -v 3 ietf.submit.tests.SubmitTests
    

Start the Development Server

  • Then start the dev server:

       (virtual) $ ./ietf/manage.py runserver 0.0.0.0:8000 
    

    Note the IP address 0.0.0.0 used to make the dev server bind to all addresses. The internal port 8000 has been mapped to port 8000 externally, too. If you are using a recent native Docker for Mac or Docker for Windows install, you will find the datatracker on localhost:8000:

       native_prompt $ open http://localhost:8000/
    
  • You can sign into the Datatracker with any valid username using the password 'password'. Signing out will allow you to sign in with a different username. Trying your new code out as people with different roles will help find issues early.

Notes on the Mailserver

  • Your local version of Datatracker does not actually send email messages. A debugging mailserver is automatically started in the docker environment and any emails generated will print to the terminal window.

Manually Edit or rsync Datatracker Data Directories

The container has empty directories to hold the files the Datatracker uses. You'll find them under data/developers.

  • You can put files in the directories individually if and when you need them. For instance, you can put drafts in data/developers/ietf-ftp/internet-drafts one at a time to see them displayed on the document's main page in your test instance - otherwise, you'll simply get a "cannot read" message.

  • Alternatively, you can use rsync to fetch all current files. Warning - this takes about 3 Gb:

        # only if you have the space and time:
        (virtual) $ ./docker/scripts/app-rsync-extras.sh
    

    Note that the settings_local.py provided by this container forces the draft repository and draft archive to be the same directory. Feel free to separate them if you are already keeping a full copy of the draft archive separately (or want to mirror it into data from rsync.ietf.org::id-archive (about 6Gb)).

  • Depending on what you are going to work on, you may later need to obtain the dot and pyang binaries and tell the datatracker where they are by adding this to your setting_local.py (paths here are examples only):

        DOT_BINARY = '/opt/local/bin/dot'
        UNFLATTEN_BINARY= '/opt/local/bin/unflatten'
        PS2PDF_BINARY = '/opt/local/bin/ps2pdf'
        SUBMIT_PYANG_COMMAND = ('/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pyang'
                                  '-p %(workdir)s --verbose --ietf  %(model)s' )
    

Setup Complete

You can now start working on Datatracker code.

Workflow

  • Pick something to work on. This could be any of the following:

    Once you have picked something, make a comment in the ticket along the lines of "working on this at the nnn CodeSprint" so that other people will know not to pick the same thing to work on, or will know to contact you in order to cooperate on it.

  • Do the coding. Talk with your fellow sprinters about what you're doing. Ask for advice as needed. Whenever possible, please add tests to cover the code you've added.

  • Run the test suite to make sure that it still passes.

        (virtual) $ ./ietf/manage.py test --settings=settings_local_sqlitetest
    
  • You can run individual tests too while you develop by adding the path to the Class and test case as an argument.

        (virtual) $./ietf/manage.py test ietf.meeting.tests_views.IphoneAppJsonTests.test_iphone_app_json --settings=settings_local_sqlitetest
    
  • Commit your code. Provide a commit message which can be used in the changelog and announcement of what's gone into a release. Indicate which issue your code fixes. Please don't add "Commit ready for merge." in your commit message anymore. We know this now when we receive a PR.

  • Create a PR to the branch at https://github.com/ietf-tools/datatracker that you would like your code to appear in.

Clone this wiki locally