Turns Keymetrics errors and exceptions into new tasks in Phabricator using Keymetrics custom integration hook.
- nodejs > 6 or harmony mode
That's an example installation. For more secure installation check Settings and Security sections.
- You should have a phabricator instance with conduit api exposed to the app and the app exposed to the keymetrics so it can post to the hook url.
- Go to phabricator instance and create a bot user, then create a new conduit API token for it.
- Choose a project to put the tasks to or create one. Add the bot to the project visible policy, add to members of the project. If you're using Spaces, add the bot to the project spaces as well. Go to
https://your-phabricator.domain.net/api/project.query
and find the project, get it's PHID-PROJ string. you can get several PHIDs and set them as a comma-separated list. - git clone the project.
- Run the project:
KPG_CONDUIT_TOKEN=api-XXXXXXXXXXXXXXXXXXXXXXXXXXXX KPG_CONDUIT_ROOT=http://your-phabricator.domain.net/api/ KPG_TOKEN_VALUE=ALPHANUMERIC_HASH KPG_PROJECT=PHID-PROJ-YYYYYYYYYYYYYYYYYYYY node bin/www
- or
- use
ecosystem-example.json
to setupecosystem.json
(which is in gitignore) pm2 deploy production setup
pm2 deploy production
- use
- The app is running and listens on port 3000 on all interfaces.
- Go to the Keymetrics.io settings and put
https://kpg_address:3000/?token=ALPHANUMERIC_HASH
to webhook integration.
More config options see below.
Fully configurable through environment variables.
KPG_CONDUIT_ROOT
is the root URL of your conduit api. So, it should usually look likehttp://your-phabricator.domain.net/api/
. RequiredKPG_CONDUIT_TOKEN
is the value of the bot's conduit token. RequiredKPG_PROJECT
is the PHID of the project to post tasks to. RequiredKPG_TOKEN_VALUE
the value of the token to check, it isALPHANUMERIC_HASH
from the Installation section. Set to some reasonable alphanumeric gibberish string. Required
NODE_ENV
if set toproduction
, debug logs will be suppressed.KPG_PATH
is the url path the app will listen to, default is empty. No leading slash needed.KPG_PORT
port to listen to, default is 3000.KPG_HOST
ip address to bind to, default is empty, so it listens to all interfaces.KPG_TOKEN_FIELD
in what field to look forALPHANUMERIC_HASH
, default istoken
.KPG_TEMPLATE
is what template for tasks to use, default isdefault
. Checktemplates/default.js
for examples if you feel like you need another format of phabricator tasks. Put something intemplates/custom.js
and passKPG_TEMPLATE=custom
in the run command.templates/custom*
is in gitignore, so feel free to experiment.
It is strongly recommended to put the app behind an https termination server, such as nginx, to encrypt data between keymetrics and the gateway. Also I hope you have your phabricator instance behind an https also.
Set up KPG_HOST
so it will listen to e.g. 127.0.0.1
, so it won't accept outer connections.
KPG_PATH
, KPG_TOKEN_FIELD
and KPG_TOKEN_VALUE
is how you protect from unauthorized requests, the app won't start if KPG_TOKEN_VALUE
is empty.
- Test several projects
- pmx instrumentation
- test usage as a middleware
- Tests
- publish as npm module
- Docker examples
- Convenience bash start script
- Some logic to put exceptions to corresponding phabricator projects with policies / assignees
PRs welcome.