QubitProducts / bamboo

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

Can't connect to TCP server using BAMBOO_TCP_PORT #174

Closed Ozzadar closed 8 years ago

Ozzadar commented 8 years ago

Im trying to launch a tcp minecraft server and bamboo is either not routing properly or im accessing it wrong.

Here's the relevant parts of the Haproxy.cfg file being generated:

       # This is the default proxy criteria
        acl ::ozzadar-fnbcenre-minecraft-aclrule hdr(host) -i ozzadar-fnbcenre-minecraft.klouds.org
        use_backend ::ozzadar-fnbcenre-minecraft-cluster if ::ozzadar-fnbcenre-minecraft-aclrule

[...]

listen ::ozzadar-fnbcenre-minecraft-cluster-tcp :1080
        mode tcp
        option tcplog
        balance roundrobin

        server ::ozzadar-fnbcenre-minecraft-104.154.81.23-31394 104.154.81.23:31394  

backend ::ozzadar-fnbcenre-minecraft-cluster
        balance leastconn
        option httpclose
        option forwardfor

        server ::ozzadar-fnbcenre-minecraft-104.154.81.23-31394 104.154.81.23:31394 

I've tried accessing from both ozzadar-fnbcenre-minecraft.klouds.org and ozzadar-fnbcenre-minecraft.klouds.org:1080

Any help appreciated, Thanks!

-Ozzadar

lclarkmichalek commented 8 years ago

My feeling is that the ACL is blocking you. Is the protocol on that port HTTP? You might want to try a boolean ACL to say 'anything on this port goes to this backend, regardless of content'.

Ozzadar commented 8 years ago

I don't have much experience with ACLs. Should I check for TCP and just not create the http side of things?

It looks like it tries to give it a TCP and an HTTP connection

lclarkmichalek commented 8 years ago

I think setting the acl to -m bool true should work. Not sure, never used a boolean ACL before.

Ozzadar commented 8 years ago

Unfortunately, I don't know what you mean here. Do you mean

acl ::ozzadar-fnbcenre-minecraft-aclrule hdr(host) -i ozzadar-fnbcenre-minecraft.klouds.org -m bool true 

?

I don't think that could be it because I'd have no idea what that would accomplish :(

(Ive been googling and trying things for an hour now and can't figure it out.)

I noticed the tcp backend is using 'listen' instead of 'backend' and that it's name "appname-cluster-tcp" is not referenced anywhere else in the template.

Like I said, these ACL rules are all kinds of confusing to me. =/

lclarkmichalek commented 8 years ago

acl ::ozzadar-fnbcenre-minecraft-aclrule -m bool true

Ozzadar commented 8 years ago

nope didn't work :( tried both with and without the -i

taik0 commented 8 years ago

Try to remove the hdr(host), a TCP lb should just work with the BAMBOO_TCP_PORT, take look at the marathon config to check that you are using BRIDGED networking and letting marathon assign a random port. If you use HOST networking, mesos will assign a random port that will not be used ,but Bamboo will create the LB using that random ports (which are not really working).

Things to check:

If that doesn't work, can you access your app using the port assigned by marathon? (The link in the marathon task description).