QubitProducts / bamboo

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

creating other configuration files #164

Closed diegoroccia closed 8 years ago

diegoroccia commented 8 years ago

Hi! is it possible to use bamboo to create other configuration files than haproxy ones? I would like to export a json file to be used by other services

thanks

j1n6 commented 8 years ago

This was one of the feature we are working on internally. For the moment, you might be able to request the API using a script.

You can change the reload command to call a script that does:

  1. reload haproxy
  2. call Bamboo API and generate json
lclarkmichalek commented 8 years ago

Here's an idea of what you might do if you need to set in the config if you wanted to generate an nginx config file:

  "HAProxy": {
    "TemplatePath": "/etc/bamboo/nginx_template.cfg",
    "OutputPath": "/etc/nginx/nginx.conf",
    "ReloadCommand": "nginx -s reload",
    "ReloadValidationCommand": "nginx -c /etc/nginx/nginx.conf -t"
  },

I don't know what service you're deploying, but let us know if there's any functionality you need from bamboo.

diegoroccia commented 8 years ago

Thanks a lot for your replies

My need would be to have multiple configuration files generated. I was aware of the 2 solutions you guys proposed (thanks) but I think it would be great to have something like:

"Outputs": [ "HAProxy": { "TemplatePath": "/etc/bamboo/nginx_template.cfg", "OutputPath": "/etc/nginx/nginx.conf", "ReloadCommand": "nginx -s reload", "ReloadValidationCommand": "nginx -c /etc/nginx/nginx.conf -t" }, "ServiceMappings": { "TemplatePath": "/etc/bamboo/servicemappings.cfg", "OutputPath": "/etc/sysconfig/servicemappings.cfg", "ReloadCommand": "kill -HUP somepid", }, "Someotherfile": { "TemplatePath": "/etc/bamboo/someotherfile.cfg", "OutputPath": "/etc/someotherfile.cfg", } ]

and so on, an arbitrary number of files generated. As your code has no real "dependency" on haproxy, I think it would be smart to abstract all of this.

diegoroccia commented 8 years ago

@activars I just re-read your reply and I realised I missed the "we're working on this" feature! so can we wait for this feature to arrive? thanks!

lclarkmichalek commented 8 years ago

Yeah, multiple output files is a needed feature, even for haproxy, with things like green-blue deploys making zero downtime reloads much easier. I'll open a seperate issue for that