The notificaption service takes screenshots of failing checks in Emissary to be sent with notifications. Screenshots result in a more consistent appearance across notification mediums (Slack vs. email).
Notificaption uses NightmareJS for taking the screenshots, making requests against production Emissary. All screenshots are stored in S3.
Screenshots can be generated by POST
ing data on a failing check to the /screenshot
endpoint. The following gist contains an example of the POST request data: https://gist.github.com/doeg/fb03dde66a08c2dd90d2
In return, you'll receive S3 URLs to the generated images and the check JSON:
{
"images": {
"default": "https://opsee-notificaption-images.s3.amazonaws.com/21G057gL7oNtKKDW64g9Dl_1454446492972_100.png"
},
"json_url": "https://opsee-notificaption-images.s3.amazonaws.com/21G057gL7oNtKKDW64g9Dl_1454446492972.json"
}
Returns the JSON data on the check with the given ID. The data returned by this endpoint is the same data posted by Beavis in the screenshot request, which is stored in memory by the server whenever a screenshot request is received. Emissary makes requests to this endpoint to populate the screenshot page.
Returns an empty response with a 200 status code, when operating normally. Used for AWS health checks.
- Add your AWS credentials to your environment:
export AWS_ACCESS_KEY_ID='AKID'; export AWS_SECRET_ACCESS_KEY='SECRET'
- Install the dependencies:
npm install
- Start up the server:
npm start
. (You can also usenodemon server.js
, although this might spawn a ton of Electron subprocesses.) - Check
https://localhost:9099
to make sure it's up. - Make sure you have Emissary running. You can adjust the host, port, and the like for your Emissary service by editing the config file you're using, found in the
config/
folder. - Start screenshotting by
POST
ing tohttps://localhost:9099/screenshot
.
- Build the Docker image and push it to quay.io:
npm run docker-publish
- From the
compute
repo:./run deploy production notificaption latest
All notificaption logs show up in Papertrail.
If the service is failing, make sure notificaption is playing nice with Docker by running it locally:
- Build the docker image locally:
npm run docker-build
- Start up the docker image:
npm run docker-run
- Get the IP address of the local docker-machine:
docker-machine ip default
(e.g., 123.4.5.6) - Try hitting
123.4.5.6:9099