Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
/ notificaption Public archive

Screenshots of Emissary for notifications.

License

Notifications You must be signed in to change notification settings

opsee/notificaption

Repository files navigation

notificaption

Circle CI Docker Repository on Quay

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.

API

POST /screenshot

Screenshots can be generated by POSTing 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"
}

GET /checks/{{checkID}}.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.

GET /health

Returns an empty response with a 200 status code, when operating normally. Used for AWS health checks.

Local development

  1. Add your AWS credentials to your environment: export AWS_ACCESS_KEY_ID='AKID'; export AWS_SECRET_ACCESS_KEY='SECRET'
  2. Install the dependencies: npm install
  3. Start up the server: npm start. (You can also use nodemon server.js, although this might spawn a ton of Electron subprocesses.)
  4. Check https://localhost:9099 to make sure it's up.
  5. 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.
  6. Start screenshotting by POSTing to https://localhost:9099/screenshot.

Deployment

  1. Build the Docker image and push it to quay.io: npm run docker-publish
  2. From the compute repo: ./run deploy production notificaption latest

Troubleshooting deploys

All notificaption logs show up in Papertrail.

If the service is failing, make sure notificaption is playing nice with Docker by running it locally:

  1. Build the docker image locally: npm run docker-build
  2. Start up the docker image: npm run docker-run
  3. Get the IP address of the local docker-machine: docker-machine ip default (e.g., 123.4.5.6)
  4. Try hitting 123.4.5.6:9099

About

Screenshots of Emissary for notifications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •