csense

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2016 License: Unlicense Imports: 12 Imported by: 0

README

cSense

License Go Report Card Docker Hub

cSense logo

cSense (Container Sense) allows you to subscribe to container events with web hooks. Hooks are registered with cSense via an HTTP API and may contain selectors, like image tag or container name, to limit the containers or events that the hook should be notified about.

Supported storage backends:

  • Etcd3
  • Consul
  • In-memory

Installation

$ go get github.com/danielkrainas/csense

Usage

$ csense [command] <config_path>

Most commands require a configuration path provided as an argument or in the CSENSE_CONFIG_PATH environment variable.

Agent mode

This is the primary mode for cSense. It hosts the HTTP API server and handles monitoring and notifying hooks of container events.

$ csense agent <config_path>

Example - with the default config:

$ csense agent ./config.default.yml

Configuration

A configuration file is required for cSense but environment variables can be used to override configuration. A configuration file can be specified as a parameter or with the CSENSE_CONFIG_PATH environment variable.

All configuration environment variables are prefixed by CSENSE_ and the paths are separated by an underscore(_). Some examples:

  • CSENSE_LOGGING_LEVEL=warn
  • CSENSE_HTTP_ADDR=localhost:2345
  • CSENSE_STORAGE_INMEMORY=true
  • CSENSE_STORAGE_CONSUL_PARAM1=val

A development configuration file is included: /config.dev.yml and a /config.local.yml has already been added to gitignore to be used for local testing or development.

# configuration schema version number, only `0.1`
version: 0.1

# log stuff
logging:
  # minimum event level to log: `error`, `warn`, `info`, or `debug`
  level: 'debug'
  # log output format: `text` or `json`
  formatter: 'text'
  # custom fields to be added and displayed in the log
  fields:
    customfield1: 'value'

# http server stuff
http:
  # host:port address for the server to listen on
  addr: ':9181'
  # http host
  host: 'localhost'

  # CORS stuff
  cors:
    # origins to allow
    origins: ['http://localhost:5555']
    # methods to allow
    methods: ['GET','POST','OPTIONS','DELETE','CONNECT']
    # headers to allow
    headers: ['*']

# storage driver and parameters
storage:
  consul:
    param1: 'val'

# the in-memory driver has no parameters so it can be declared as a string
storage: 'inmemory'

storage only allows specification of one driver per configuration. Any additional ones will cause a validation error when the application starts.

Bugs and Feedback

If you see a bug or have a suggestion, feel free to open an issue here.

Contributions

PR's welcome! There are no strict style guidelines, just follow best practices and try to keep with the general look & feel of the code present. All submissions should atleast be go fmt -s and have a test to verify (if applicable).

For details on how to extend and develop cSense, see the dev documentation.

License

Unlicense. This is a Public Domain work.

Public Domain

"Make art not law" -Nina Paley

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL