Simple scripts for compiling FxA metrics
These scripts are most useful as an example of how to pull from APIs. To use the scripts directly you'd need to have Jira custom fields with the same IDs, spreadsheets with the same columns, etc. Just go into this knowing you'll need to adjust the scripts.
Additionally, there aren't a lot of guardrails or error checking...
I pass configuration into the scripts using environment variables. Fill in the
values in local.env
and source it into your environment before running the
scripts.
pip install -r requirements.txt
cp local.env-dist local.env
source local.env
python <script>
To run a cron job from a virtualenv:
* * * * * /path/to/virtualenv/bin/python /path/to/fxa-metrics-scripts/copy_jira_data_to_sheets.py
To run a cron job with specific environment variables within a virtualenv:
* * * * * . /path/to/fxa-metrics-scripts/local.env; /path/to/virtualenv/bin/python /path/to/fxa-metrics-scripts/copy_jira_data_to_sheets.py
This is a python project and you should use a python buildpack for it. You also need two additional buildpacks:
heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 3 heroku-community/chrome-for-testing
You can run the commands on heroku to test them. For example:
heroku run python calculate_lighthouse_scores.py
If you want to schedule them on heroku use the free Heroku Scheduler add-on.