Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow automatic configuration of Host based routing #28

Open
rthomas opened this issue Sep 22, 2014 · 18 comments
Open

Allow automatic configuration of Host based routing #28

rthomas opened this issue Sep 22, 2014 · 18 comments
Labels
Projects

Comments

@rthomas
Copy link
Contributor

rthomas commented Sep 22, 2014

This is dependent on this issue in marathon: mesosphere/marathon#599

It would be great if I could configure Bamboo to automatically configure apps to hostnames via specifying metadata to Marathon.

For example, if I could specify a tag in Marathon of bamboo.hostname: my-app.example.com and have bamboo automatically configure that application when it sees it.

This would allow us to automatically configure and provision the load balancing for services based off of metadata for the application itself, rather than making a separate api call to provision load balancing.

@j1n6
Copy link
Contributor

j1n6 commented Sep 22, 2014

hi Ryan,

The current release 0.2.x support the none DNS auto configuration by path.

 This feature is not difficult to implement. I will keep an eye on this marathon issue.

Thanks for your support!

On 22 Sep 2014, at 21:54, Ryan Thomas notifications@github.com wrote:

This is dependent on this issue in marathon: mesosphere/marathon#599

It would be great if I could configure Bamboo to automatically configure apps to hostnames via specifying metadata to Marathon.

For example, if I could specify a tag in Marathon of bamboo.hostname: my-app.example.com and have bamboo automatically configure that application when it sees it.

This would allow us to automatically configure and provision the load balancing for services based off of metadata for the application itself, rather than making a separate api call to provision load balancing.


Reply to this email directly or view it on GitHub.

@rthomas
Copy link
Contributor Author

rthomas commented Sep 22, 2014

Are there docs for the auto configuration? I couldn't seem to find them in the README

@j1n6
Copy link
Contributor

j1n6 commented Sep 22, 2014

Take a look the release log under v0.2.1

On 22 Sep 2014, at 22:13, Ryan Thomas notifications@github.com wrote:

Are there docs for the auto configuration? I couldn't seem to find them in the README


Reply to this email directly or view it on GitHub.

@j1n6 j1n6 added the feature label Sep 23, 2014
@MikeMichel
Copy link
Contributor

+1 for this feature

@j1n6
Copy link
Contributor

j1n6 commented Sep 24, 2014

@rthomas Did you look at the current release? Does the default ACL rule that use application id as path solve most of the automation issue?

Thanks

@rthomas
Copy link
Contributor Author

rthomas commented Sep 24, 2014

Hi @activars - I did take a look at the docs, and whilst this does automate it, it is not quite what I need.

This sits on the edge, and I need to be able to route requests via the Host header - not by the path. I'm sure we could come up with a way to determine the host from the application name in marathon, but I think it would be a lot cleaner to wait for marathon to implement the tagging and do it based on a tag.

I also have some additional concerns about the acl field leaking the underlying implementation details out to the requester - i.e. requiring the raw haproxy acl config line. Given this is purely for haproxy I don't think it is a huge issue at the moment, but it would be nice if we could provide some protection from the consumers of the api having to specify haproxy config lines in their requests. This is a bit off topic though :)

I'm happy to implement this feature once we have the tagging in marathon.

@j1n6 j1n6 mentioned this issue Sep 25, 2014
sttts added a commit to sttts/bamboo that referenced this issue Jan 5, 2015
Defining BAMBOO_TCP_PORT in the Marathon task definition, e.g.

	{
	  "id": "test",
	  "cmd": "python -m SimpleHTTPServer $PORT0",
	  "cpus": 0.1,
	  "mem": 90,
	  "ports": [0],
	  "instances": 1
	  "env": {
	    "BAMBOO_TCP_PORT": "1080"
	  }
	}

leads to

	listen ::test-cluster-tcp :1081
	        mode tcp
	        option tcplog
	        balance roundrobin

        	server ::test-192.168.2.2-31001 192.168.2.2:31001

in the haproxy configuration.

Fixes QubitProducts#28.
@cmoro-deusto
Copy link

+1 thanks!

@j1n6
Copy link
Contributor

j1n6 commented Jan 18, 2015

@cmoro-deusto
Lastest Bamboo template is able to read env environment variables (part of the marathon app configuration), you should be able to customize the template to be aware of the your custom variable (e.g. host, cookie or header).

@cmoro-deusto
Copy link

That´s great. Thanks a lot @activars

@j1n6
Copy link
Contributor

j1n6 commented Jan 19, 2015

@rthomas congrats, just noticed you are now working for Google. :)

@tobiassp
Copy link

tobiassp commented May 8, 2015

@activars

labels might be a better choice since they do not pollute the process environment ?

@rasputnik
Copy link
Contributor

The environment variables feature pre-dates marathon and Mesos' label feature, but I agree it's probably a cleaner solution. Haven't upgraded our mesos stacks to 0.22.x yet or i'd have submitted a PR myself.

@rasputnik
Copy link
Contributor

Labels just landed if anyone is still waiting on them.

@dwstevens
Copy link

I'm having trouble adding automatic acl creation of host based routing via this:

frontend http-in
        bind *:80
        {{ $services := .Services }}
        {{ range $index, $app := .Apps }} {{ if hasKey $services $app.Id }} {{ $service := getService $services $app.Id }}
        acl {{ $app.EscapedId }}-aclrule {{ $service.Acl}}
        use_backend {{ $app.EscapedId }}-cluster if {{ $app.EscapedId }}-aclrule
        {{ else }}

        # This is the default proxy criteria
        acl {{ $app.EscapedId }}-aclrule hdr(host) -i {{ $app.Env.SUBDOMAIN }}.domain.com
        use_backend {{ $app.EscapedId }}-cluster if {{ $app.EscapedId }}-aclrule
        {{ end }} {{ end }}

The problem is that I believe the else condition is never met and therefore the default proxy rule isn't getting created. We pass in "SUBDOMAIN" as a ENV in our Marathon Task Definitions. Am I doing something wrong there? I guess I don't understand what the if block is doing.

@rasputnik
Copy link
Contributor

you can check the data structure bamboo is going to use to template by looking at 0:8080/api/state . I've had older marathons give odd responses which sometimes mess up that structure (see #136).

@j1n6
Copy link
Contributor

j1n6 commented Jun 23, 2015

@dwstevens you might want to create a different issue. Do you mind first check if bamboo_host:8080/api/state returns SUBDOMAIN environment variable?

@dwstevens
Copy link

Actually, it seems to be working fine. I chased my tail for several hours yesterday. The Bamboo UI wasn't automatically updating with the ACL rules. I just manually refreshed and all the automatically created ACLs are correctly listed. I spent way too much time yesterday learning about Go templates! Thanks for the help.

@raghu999
Copy link

raghu999 commented Oct 2, 2017

+1 for this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Planning
Backlog
Development

No branches or pull requests

8 participants