Giter VIP home page Giter VIP logo

hydra-notifications's Introduction

Hydra Notifications

Build Status codecov Join the chat at https://gitter.im/pluralsight/hydra

A generic HTTP container that sends events to underlying services.

Supported Services

Currently, two services are supported: Slack and OpsGenie.

Others forthcoming.

Adding a new service

Create the service actor

Look at any of the service classes under services/hydra/notifications/services.

For instance:

hydra.notifications.services.Slack

Services are Akka actors tagged with the HydraNotificationService trait, which allows them to be loaded dynamically at start up time.

The lower case short name of the service class becomes the service name. For instance, hydra.notifications.services.Slack will be available as "slack"

Create the service notification case class

Create the class in the client module and make sure it extends from http.hydra.notifications.HydraNotification

Examples: SlackNotification and OpsGenieNotification in hydra.notifications.client

Add the case class to the SprayJsonFormat

Modify http.hydra.notifications.http.NotificationsFormat.scala and add your service name to the pattern match statements

Example calls

Slack

 curl -X POST localhost:8080/notify -d '{"channel":"hydra-ops","message":"an error occured","service":"slack"}'  -H "Content-Type:application/json"

Ops Genie

  curl -X POST localhost:8080/notify -d '{"source":"source","description":"description","tags":["tag1","tag2"],"service":"opsgenie","alias":"alias","note":"note","team":"team","entity":"entity","message":"message","user":"user"}' -H "Content-Type:application/json"

Building

sbt universal:packageBin

The generated zip file will contain both the assembled jar and the run script.

Running the App

Supply authentication tokens for Slack and OpsGenie by using one of these methods:

  • Modify reference.conf to add authentication tokens for Slack and OpsGenie.
  • Supply environment variables OPSGENIE_TOKEN and SLACK_TOKEN
  • Add the tokens to /etc/hydra/hydra-notifications.conf

Unzip the executable generated by sbt and run ./bin/hydra-notifications.

By default, the container binds to port 8080. To change that, supply this configuration property:

container.http.port=$PORT_NUMBER

Configuration

hydra-notifications makes use of environment variables to configure the application. Environment variables make it easy to configure an application for different environments, i.e., stage and prod. Take a look at the env.example for a list of the parameters you can specify with environment variables. If you're running locally, copy the env.example to .env. Sbt will pick up the values in .env and load them into the environment using sbt-dotenv.

hydra-notifications's People

Contributors

bpetersen avatar bretrbs avatar flybonzai avatar gemma-grover-ps avatar lewisjkl avatar mnikulesko avatar roarking avatar w-aldrich avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

trivedisorabh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.