Skip to content

byxorna/merlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merlin

Inspired by https://github.com/kelseyhightower/confd, this tool allows you to generate configuration files from data in etcd.

Build Status

Build Status

Configuration

A sample config looks like this:

---
testing:
  watch: /merlin/testing
  templates:
    "config/examples/templates/testing.conf.erb": testing.conf
  destination: /tmp/testing/
  atomic: true
  statics:
    config/examples/static/test.txt: test.txt
  check_cmd: echo "This is the check command <%= files.join(' ') %>"
  commit_cmd: echo "This is the commit command <%= dest %>"
named:
  watch: /merlin/named/company.net
  templates:
    "config/examples/named/templates/jfk01.company.net.erb": jfk01.company.net
    "config/examples/named/templates/atl01.company.net.erb": atl01.company.net
    "config/examples/named/templates/sfo01.company.net.erb": sfo01.company.net
  destination: /tmp/named
  statics:
    config/examples/named/static/company.net: company.net
    config/examples/named/static/jfk01.company.net-custom: jfk01.company.net-custom
    config/examples/named/static/sfo01.company.net-custom: sfo01.company.net-custom
  check_cmd: named-checkconf -t <%= dest %>
  commit_cmd: service named reload
  • watch: What keyspace in etcd to watch for changes. The whole tree at watch will be passed to your templates as data.
  • templates: Key is the path to a template in ERuby; the value is the path relative to destination you want the templated file to go.
  • destination: What directory should all of the output be relative to. If omitted, assumes output is relative to pwd.
  • statics: Additional static files that should be watched on the filesystem to trigger a config generation if modified. statics is a hash of input -> output, where output is relative to destination.
  • check_cmd: Command to run to verify the output of the emitter is correct (i.e. service httpd configtest). If this fails, merlin will roll back the configs. Allows erb expansion.
  • commit_cmd: Command to commit results once checked (i.e. cd ... && git commit -am ... && git push origin HEAD). Allows erb expansion.
  • atomic: Boolean. If true, destination will be an atomic symlink to the generated files. The destinations created will not be cleaned up. If omitted, files are just copied from the staging directory into destination.

Additionally, both check_cmd and commit_cmd can use ERB to template in a handful of useful variables. i.e.

check_cmd: "/usr/bin/check_files -d <