GithubHelp home page GithubHelp logo

isabella232 / kvexpress-cookbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datadog/kvexpress-cookbook

0.0 0.0 0.0 23 KB

This cookbook installs kvexpress and offers an LWRP to use with Chef.

Home Page: https://github.com/DataDog/kvexpress

License: Apache License 2.0

Ruby 99.08% HTML 0.92%

kvexpress-cookbook's Introduction

kvexpress Cookbook

Installs kvexpress and provides an LWRP to use it from within Chef.

Requirements

  • Consul
  • Ubuntu

If you're not using Ubuntu - you can download binary releases from Github.

Attributes

default['kvexpress']['version'] = '1.9-1'
default['datadog']['url'] = 'https://app.datadoghq.com'

# Where to place the JSON watches.
default['consul']['config_dir'] = '/etc/consul.d'

# If you're using Consul ACLs to protect the 'kvexpress/' KV space and kvexpress::server_config:
# default['consul']['acl']['kvexpress'] = 'acl-goes-here'

# If you're using the Datadog API to send events and kvexpress::server_config:
# default['datadog']['api_key'] = 'api_key_goes_here'
# default['datadog']['application_key'] = 'app_key_goes_here'

# If you're using the Datadog agent:
default['kvexpress']['dogstatsd'] = false

Default Usage with a Consul watch

Use kvexpress::default to install the binary.

Use the LWRP to get configuration from Consul during a Chef run - here's an example kvexpress resource:

kvexpress 'consul_dns_hosts' do
  location '/etc/hosts.consul'
  compress true
  key 'hosts'
  mode '00644'
  command 'sudo pkill -HUP dnsmasq'
  notifies :reload, 'service[consul]', :delayed
end

During the Chef run, that resource will do the following:

  1. If there's no file at /etc/hosts.consul, it will try to download the key kvexpress/hosts/data and save it. It will fail silently if there's no key there - that's by design.
  2. It will create a Consul watch inside of /etc/consul.d and reload Consul so any updates are automatically replicated.
  3. If it saves a new file, it will send a SIGHUP to dnsmasq to reload it.

The Consul watch will look something like this:

{
  "watches": [
    {
      "type": "key",
      "key": "/kvexpress/hosts/checksum",
      "handler": "kvexpress out -k hosts -f /etc/hosts.consul -l 10 -c 00644 -e 'sudo pkill -HUP dnsmasq' -z true"
    }
  ]
}

If you don't use Chef - you can manually create the JSON needed for the Consul watch - use the above as a template.

Ad-Hoc Usage with Consul exec

Detailed here.

Contributing

We love pull requests from anyone. Details are available here.

Code of Conduct

This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#kvexpress/[email protected]

kvexpress-cookbook's People

Contributors

darron avatar

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.