We use Tock to track and report our time at 18F
Python HTML JavaScript CSS Shell
Latest commit 46b8850 Feb 3, 2017 @annalee annalee committed on GitHub Merge pull request #622 from 18F/update-slim-report
Adds the project_id attribute from the Project class to the SlimBulkTimecardSerializer.
Permalink
Failed to load latest commit information.
.github Add PR template Oct 12, 2016
api-docs Update user-data.md Oct 6, 2016
provision/dev update nginx template to match new auth scheme Sep 16, 2016
tock fix failing tests from UTC vs local time issue Feb 3, 2017
.cfignore un-ignore css files in cf Sep 23, 2016
.gitignore clean up .gitignore; ignore built css Sep 23, 2016
.travis.yml Add a default timezone to .travis.yml Nov 29, 2016
CONTRIBUTING.md initial commit Jan 20, 2015
Dockerfile Fixed issues with GroupUtilizationView Oct 14, 2016
LICENSE.md initial commit Jan 20, 2015
Procfile Minor changes for new cloud.gov environment and route service Sep 15, 2016
README.md Update README.md Dec 5, 2016
Screen Shot 2016-12-05 at 11.30.54 AM.png Add files via upload Dec 5, 2016
about.yml minimum viable about.yml. Jan 3, 2017
data-reconciliation.md Include Client Name in Project API Results Feb 28, 2016
deploy.sh newrelic configuration. Jan 11, 2017
docker-compose.yml node v6.3 Sep 23, 2016
init.sh chmod +x *.sh Sep 23, 2016
manifest.yml newrelic configuration. Jan 11, 2017
newrelic.ini newrelic configuration. Jan 11, 2017
package.json Add USWDS to site Oct 4, 2016
requirements-dev.txt updating factory-boy to resolve a dependency error. Jan 3, 2017
requirements.txt updating to the newest version of newrelic. Jan 30, 2017
runtime.txt upgrade to python 3.5.2 from 3.4.3 Aug 16, 2016
staging-deploy.sh chmod +x *.sh Sep 23, 2016
staging-manifest.yml removing unrelated change Sep 21, 2016
tock-in-the-future.md Update tock-in-the-future.md Jun 16, 2015

README.md

tock

We use Tock to track our time. You can read more about Tock in this blog post about its features.

Build Status

Screenshot of Tock

If your team uses Tock and Slack, you might also find the "angrytock" reminder bot helpful.

Getting Started

  1. Install Docker. If you're on OS X, install Docker for Mac. If you're on Windows, install Docker for Windows.

  2. Move into the tock directory at the repository root:

    $ cd tock
    

    This is where the env.sample file is held.

  3. Run:

    $ cp .env.sample .env
    $ docker-compose build
    $ docker-compose run app python manage.py migrate
    $ docker-compose run app python manage.py loaddata test_data/data-update.json
  4. Once the above commands are successful, run:

    docker-compose up
    

    This will start up all required servers in containers and output their log information to stdout.

  5. Visit http://localhost:8000/ directly to access the site.

    If you see this message in the console, you can disregard it:

    app_1   | Starting development server at http://0.0.0.0:1234/
    

    It's still running at http://localhost:8000

You can access the admin panel at /admin.

Accessing the app container

You'll likely want to run manage.py to do other things at some point. To do this, it's probably easiest to run:

docker-compose run app bash

This will run an interactive bash session inside the main app container. In this container, the /tock directory is mapped to the tock directory of the repository on your host; you can run manage.py from there.

Note that if you don't have Django installed on your host system, you can just run python manage.py directly from outside the container--the manage.py script has been modified to run itself in a Docker container if it detects that Django isn't installed.

Making CSS changes

docker-compose up will also launch a Node machine that compiles the Sass files in tock/tock/static/sass into corresponding CSS files in tock/tock/static/css/dist. The generated CSS files are not checked into git, and should not be modified by hand.

You can also run the CSS build and watch scripts outside of the Docker container. Just install Node (e.g. with brew install node on OS X), then install the dependencies with:

npm install

Assuming that goes off without a hitch, you can then either build the CSS in one go with:

npm run build-css

or start the watch process, which builds new CSS whenever the source Sass files are changed:

npm run watch-css

API

Tock has an API! You may issue GET requests to various endpoints via the /api/ path with results returned as JSON objects. We use Django REST framework's TokenAuthentication library which requires all requests to include a token value in your request header using the following format (a cURL command line based request is used for this example for getting project data from our Tock deployment):

$ curl https://tock.18f.gov/api/projects.json -H 'Authorization: Token randomalphanumericstringed854b18ba024327'

To obtain your own Tock API authorization token, please visit #tock-dev on Slack!

To access similar data in CSV format from within Tock, please visit the /reports page.

Authentication

18F's current deployment of Tock relies on a cloud.gov route service called uaa-auth.