# macOS
brew install just
# Linux
# Install from https://github.com/casey/just/releases
# Add completion for your shell. E.g. for bash:
source <(just --completions bash)
# Show all available commands
just # shortcut for just --list
Set up a local development environment with:
just devenv
Populate the generated .env
file with the GitHub PATs described in the install instructions.
Start the local docker stack with:
just grafana
This will spin up Grafana, its own database, and a TimescaleDB instance.
Grafana is available at http://localhost:3000.
The default credentials are admin
/admin
; Grafana asks you to change these when you first log in, but you can skip the change.
Add a datasource in Grafana's settings. Copy the details from production, with the exception of the connection details which copy by copied from docker-compose.yaml (the server address is the service name)
To add a dashboard:
- Go to the production dashboard that you want to copy.
- Go to the "share" icon on the top row and to the "Export" tab.
- Select "Export for sharing externally" and "Save to file".
- Go to your local Grafana and import the dashboard (you need to explicitly set the datasource).
You'll need to have timescale db running in the backend, either by running just grafana
, or alternatively, to start TimeScaleDB without starting Grafana by doing
docker compose up timescaledb
You can then run the metrics tasks with:
just metrics
Specify an individual task by passing in the module name
just metrics <module_name>
e.g just metrics prs
to run metrics/tasks/prs.py
All tasks are defined in metrics/tasks
and must have a main()
function that takes no arguments.
You can set a flag to trigger a fast mode which only retrieves and handful of PRs but allows the main code paths to be tested quickly.
DEBUG_FAST=t just metrics prs
Run the tests with:
just test <args>
Changes merged to main
are automatically deployed by GitHub actions.
Metrics that are populated by periodic tasks are automatically updated once a day by a Dokku cron job. This process can also be triggered out-of-schedule.
you@your-laptop:~$ ssh dokku3.ebmdatalab.net
you@dokku3:~$ dokku cron:list metrics
ID Schedule Command
<the-id> @daily python -m metrics.tasks
you@dokku3:~$ dokku cron:run metrics <the-id>