Skip to content



If you only want to hack on the frontend, see the UI Development section below. If you want to hack on the backend or work full-stack, see the Server and Full-stack Development section.

Code Standards

Before pushing new code, please make sure you are following our Code Style and Accessibility Guidelines.

Pre-commit checks

If you would like pre-commit linting checks you can set it up like this:

% pip install pre-commit
% pre-commit install
pre-commit installed at .git/hooks/pre-commit

From here on, linting checks will be executed every time you commit.

UI Development

To get started:

  • Install Node.js and Yarn (see package.json for known compatible versions, listed under engines).
  • Run yarn install to install all dependencies.
  • Run yarn build to build necessary files.

Running the standalone development server

The default development server runs the unminified UI and fetches data from the production site. You do not need to set up the Docker environment unless making backend changes.

  • Start the development server by running:

    yarn start


    Any action you take, such as classifying a job, will affect the live production front-end of Treeherder, so we recommend developing against stage (details below) unless there's something data-specific that must be addressed on production.

  • The server will perform an initial build and then watch for new changes. Once the server is running, you can navigate to: http://localhost:5000 to see the UI.

    To run the unminified UI with data from the staging site instead of the production site, type:

    yarn start:stage

Server and Full-stack Development

To get started:

  • Install Docker & docker-compose (both are installed if using Docker for Windows/Mac).
  • If you just wish to run the tests, you can stop now without performing the remaining steps.

Starting a local Treeherder instance

By default, data will be ingested from autoland and try using a shared pulse account. However, if you want to use your own pulse account or change the repositories being ingested, you need to export those env variables in the shell first or inline with the command below. See Pulse Ingestion Configuration for more details.

  • Open a shell, cd into the root of the Treeherder repository, and type:

    docker-compose up --build
  • Wait for the Docker images to be downloaded/built and container steps to complete.

Both Django's runserver and webpack-dev-server will automatically refresh every time there's a change in the code. Proceed to Running the ingestion tasks to get data.

Using the minified UI

If you would like to use the minified production version of the UI with the development backend:

  • Run the build task:

    docker-compose run frontend sh -c "yarn && yarn build"
  • Start Treeherder's backend:

    docker-compose up --build

Requests to port 8000 skip webpack-dev-server, causing Django's runserver to serve the production UI from .build/ instead. In addition to being minified and using the non-debug versions of React, the assets are served with the same Content-Security-Policy header as production.

Proceed to Running the ingestion tasks to get data.

Running full stack with a custom DB setting

If you want to develop both the frontend and backend, but have the database pointing to an external DB host, you have a few choices. The environment variable of DATABASE_URL is what needs to be set. You can do this in a file in the root of /treeherder called .env:


Alternatively, you can export that value in your terminal prior to executing docker-compose up or just specify it on the command line as you execute:

DATABASE_URL=mysql://user:password@hostname/treeherder SKIP_INGESTION=True docker-compose up


If you are using a database on one of our instances (production, stage or prototype) then you should also disable data ingestion via Pulse. It will ONLY ingest to your local DB, even if DATABASE_URL is set. But it will use your system's resources unnecessarily. To skip data ingestion, set the var SKIP_INGESTION=True

Deleting the MySql database

The MySql database is kept locally and is not destroyed when the Docker containers are destroyed. If you want to start from scratch type the following commands:

docker-compose down
docker volume rm treeherder_mysql_data

Running the ingestion tasks

Celery tasks include storing of pushes, tasks and parsing logs (which provides failure lines and performance data) and generating alerts (for Perfherder). You can either run all the queues or run only specific queues.

Open a new shell tab. To run all the queues type:

docker-compose run -e PROJECTS_TO_INGEST=autoland backend celery -A treeherder worker --concurrency 1


If you skip the PROJECTS_TO_INGEST flag, this command will store pushes and tasks from all repositories and will take a very long time for data to load. However, you can change it to ingest from other repositories if you wish.

You can find a list of different celery queues in the the CELERY_TASK_QUEUES variable in the settings file. For instance, to only store tasks and pushes and omit log parsing:

docker-compose run -e PROJECTS_TO_INGEST=autoland backend celery -A treeherder worker -Q store_pulse_tasks,store_pulse_pushes --concurrency 1

Manual ingestion

NOTE: You have to include --root-url in order to ingest from the Taskcluster Community instance, otherwise, it will default to the Firefox CI.

Open a terminal window and run docker-compose up. All following sections assume this step.

Ingesting pushes

NOTE: Only the push information will be ingested. Tasks associated with the pushes will not. This mode is useful to seed pushes so they are visible on the web interface and so you can easily copy and paste changesets from the web interface into subsequent commands to ingest all tasks.

Ingest a single Mercurial push or the last N pushes:

docker-compose exec backend ./ ingest push -p autoland -r 63f8a47cfdf5
docker-compose exec backend ./ ingest push -p mozilla-central --last-n-pushes 100

Ingest a single Github push or the last 10:

docker-compose exec backend ./ ingest git-push -p servo-try -c 92fc94588f3b6987082923c0003012fd696b1a2d
docker-compose exec -e GITHUB_TOKEN=<foo> backend ./ ingest git-pushes -p android-components

NOTE: You can ingest all tasks for a push. Check the help output for the script to determine the parameters needed.

NOTE: If you make too many calls to the Github API you will start getting 403 messages because of the rate limit. To avoid this visit your settings and set up GITHUB_TOKEN. You don't need to grant scopes for it.

Ingesting Github PRs

NOTE: This will only ingest the commits if there's an active Github PRs project. It will only ingest the commits.

docker-compose exec backend ./ ingest pr --pr-url

Ingesting individual task

This will work if the push associated to the task exists in the database.

# Make sure to ingest 1bd9d4f431c4c9f93388bd04a6368cb07398f646 for autoland first
docker-compose exec backend ./ ingest task --task-id KQ5h1BVYTBy_XT21wFpLog

Learn more

Continue to Working with the Server section after looking at the Code Style doc.