Skip to content

Puppet managed Synapse - Airbnb's service discovery via a local HAProxy configured from Zookeeper

License

Notifications You must be signed in to change notification settings

S2Games/puppet-synapse

 
 

Repository files navigation

#synapse

Build Status

Description

This puppet module configures Synapse, a service discovery system by Airbnb. Synapse configures a local HAproxy running on every node, configured dynamically from Zookeeper entries.

##Installation

puppet module install KyleAnderson/synapse
# Or librarian-puppet, r10k, whatever.

###What this module affects

  • /etc/synapse/ for configs
  • Installs synapse (either via gem or system package
  • Installs and configures HAproxy

###HAproxy considerations

This module is incompatible with an existing instance of HAProxy running. Synapse overwrites the HAProxy config file.

##Usage Examples

Start off by getting synapse installed and running:

class { 'synapse':
  package_provider => 'gem'
}

Now you can prep synapse for listening for services. Syntax is a little tricky, but follows the syntax in example configs. All parameters are validated, so puppet won't let you insert invalid syntax:

synapse::service { 'service1':
  default_servers => [
    {
      "name" => "default1",
      "host" => "localhost",
      "port" => 8422
    }
  ],
  discovery => {
    "method" => "zookeeper",
    "path"   => "/airbnb/service/service2",
    "hosts"  =>  [
      "zk0.airbnb.com:2181",
      "zk1.airbnb.com:2181"
    ]
  },
  haproxy => {
    "port"           => '3214',
    "server_options" => "check inter 2s rise 3 fall 2",
    "listen"         => [
      "mode http",
      "option httpchk /health",
    ]
  },
  ensure => 'present',
}

##Limitations

I assume that you are using a modern version of ruby on the puppetmaster. It outputs json, so either use ruby 1.9 with built in JSON or have the JSON gem available. Pull requests welcome for a better way to do this.

##Development Open an issue or fork and open a Pull Request

About

Puppet managed Synapse - Airbnb's service discovery via a local HAProxy configured from Zookeeper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Puppet 50.6%
  • Ruby 49.4%