QubitProducts / bamboo

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

EscapedId #29

Closed MikeMichel closed 9 years ago

MikeMichel commented 10 years ago

Hi,

any specific reason for the colons in

EscapedId: strings.Replace(appId, "/", "::", -1), ?

The colons mess up my host acl

acl ::socketchat-host hdr(host) -i ::socketchat.example.io

Best,

Mike

j1n6 commented 10 years ago

Did you use the default template?

EscapedId is only used for HAProxy frontend and backend naming. It shouldn't appeare in the ACL section. In your example, acl ::socketchat-host part is correct. hdr(host) -i ::socketchat.example.io should really be hdr(host) -i socketchat.example.io.

MikeMichel commented 10 years ago

I changed the template to my needs

acl {{ $app.EscapedId }}-host hdr(host) -i {{ $app.EscapedId }}.example.io
use_backend {{ $app.EscapedId }}-cluster if {{ $app.EscapedId }}-host
j1n6 commented 10 years ago

This is the line in template: https://github.com/QubitProducts/bamboo/blob/master/config/haproxy_template.cfg#L52

You probably want to write something like this:

acl {{ $app.EscapedId }}-host hdr(host) -i {{ $appId }}.example.io
use_backend {{ $app.EscapedId }}-cluster if {{ $app.EscapedId }}-host

The complication is '$appId' in new Marathon app ID definition containing slash e.g. '/my-app'. What you want is really just 'my-app'.

This feature https://github.com/QubitProducts/bamboo/issues/27 might allow you to auto generate domains based on app id.

j1n6 commented 10 years ago

And the documentation for how to use template should be improved.

MikeMichel commented 10 years ago

Yep, i was allready looking for the var which holds the app without any special chars but it's not there yet.

j1n6 commented 10 years ago

This is probably related to feature request https://github.com/QubitProducts/bamboo/issues/28