QubitProducts / bamboo

HAProxy auto configuration and auto service discovery for Mesos Marathon
Apache License 2.0
794 stars 214 forks source link

Allow multiple template file rendering #60

Closed tangicolin closed 9 years ago

tangicolin commented 9 years ago

In my use case i use bamboo for update HAproxy and for Redis failover. Today i need to have one instance of Bamboo for HAproxy and one instance of Bamboo for redis failover. It will be nice if i can use only once instance of Bamboo to udpate HAproxy and Redis failover.

j1n6 commented 9 years ago

Hey, can you describe more about your current setup?

j1n6 commented 9 years ago

Do you mean support both TCP and HTTP?

tangicolin commented 9 years ago

I use bamboo for two thing. First to autodiscover Apps and proxy them trought HAproxy. Secondly, for my redis instances i use a sentinel setup to monitor Redis Master/Slave status and automatic failover when master died. I don't use officiel redis sentinel, because i use mesos (and so zookeeper) i prefer to use this "framework": https://github.com/ryanlecompte/redis_failover

So i use bamboo template feature to generate the config.yml of redis_failover.

So to sumarize my all setup.

I launch a redis instance (REDIS1) from marathon, at startup, this instance check if other redis instance exist, in this case no so it configure this instance as Redis Master. I launch another redis instance (REDIS2), at startup i do the same check so it configure this instance as Redis slave (we get redis master port:ip from redis_failover).

I launch a number of Bamboo Instance with redis_failover (Bamboo_redis_failover). Each instances have a config.yml with :nodes: field (ip and port of each REDIS instance) automatically computed.

Now imagine we have REDIS1 (master) that dies.
Bamboo_redis_failover will switch REDIS2 from slave to master. Marathon will relaunch REDIS1 at new location. At startup REDIS1 will be configure as slave of REDIS1 Bamboo_redis_failover is relaunch to take the new config (update :nodes: field for the new REDIS ip:port localization).

j1n6 commented 9 years ago

Can you post your template file?

tangicolin commented 9 years ago

Sorry for the delay, i don't work on this anymore and i can post my config files because it base on old version of bamboo (v1.1). But the idea is still valid. You can need auto-discovery configuration file for other programs than just haproxy. Some client that work in HA mode, can have multiple server. For example collectd (https://collectd.org/wiki/index.php/Networking_introduction#Multiple_servers). You can use bamboo to generate collectd client configuration file.

j1n6 commented 9 years ago

69 This should have resolved your concern. I'm going to close the issue for the moment.