-
Notifications
You must be signed in to change notification settings - Fork 268
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
Fix backend ports to be seperated #74
Conversation
Now, I've never actually tried to specify multiple ports like that, but is there a semantic difference between doing this and having them both on the same 'server' line? If there is, I think the existing behavior should be preserved. If you need a separate server line for each port, use multiple balancermember resources, one for each port, instead. |
@kitchen - please check the documentation associated with HaProxy. Please check for yourself - http://haproxy.1wt.eu/download/1.4/doc/configuration.txt This configuration syntax cant be found by me.... |
I agree, it feels weird to have one server with 2 ports, I just wasn't sure if there was a legit use case for it. I'll look in a bit! -Jeremy Insert PGP signature here.
|
Well in my particular case, i create python backends based on the number of cores the machine has. I do believe this is a common use case, hence why i would love to see this merged :) |
no, I meant in haproxy config having multiple ports per server vs just multiple server lines. if the former is a valid use case, then your use case should be simply to export multiple balancermembers, one for each port. if the former is not a valid use case, then it would make sense to merge this! |
After reading the docs for a while, I think the use case of a single binding port and multiple server/port combinations on the backend (whether used in @kitchen Do you use the frontend/backend entries too, or just the listen entries? |
I only use frontend/backend actually (I originally adapted the module to support them, previously it just had listen) but this is more a balancermember thing. The "server" line is standard, and as far as I can tell from the docs doesn't actually support multiple ip:ports on one server line. I don't even know what actually is supposed to happen if you put multiple ip:ports on the same server line, my guess would be a syntax error from haproxy but considering how long this has been here, probably not :) |
@kitchen I am trying to sort out what parts are duplicated or awkward (such as trying to have a frontend that binds to :80 non-ssl and :443 ssl, which isn't currently possible). Do you have some example use cases you could share? The |
I don't think it needs a As for the ssl bit I am using 1.4 so I don't have SSL support, but I would probably make those 2 separate frontends anyways. I think? Just like I do right now with apache ssl vs non-ssl. |
Okay, sounds valid. Thanks for the feedback. I'll look at getting this PR rebased for merge. |
sorry to be a necromancer here, but I had a thought: being able to specify configuration options to various stanzas as a resource would be awesome. Let me give you an example: I use the role/profile pattern. I try to keep individual bits of functionality as separate classes and include them as necessary. One of these bits of functionality we've come up with as of late is a go service which implements rate limiting for API requests. We implement this by dropping in a frontend for the proxy to proxy back to (which just defaults to using the 'normal' backend that the original frontend would), a backend which just has the rate limiting proxy (which currently just runs on localhost, but that may change) configured, an acl to match requests by, and a use_backend with the acl to send requests at it. I have this all implemented as a separate class, but since my "main" On top of that, since I'm not quite ready for it to go into production yet, I've got this set up as a feature toggle in my puppet code (toggled via a hiera key) and I have lots of nested array concats to build up the final acl and use_backend lists... it's frustrating :) I realize that is hella confusing, and if you'd like I can draw up either some puppet code, or a sample haproxy config file (or both) to illustrate. The obvious thing would be to just have an This would make it possible to do what I was mentioning above, as I would just inject the acl and use_backends into the "main" frontend stanza from my profile, and then when I want to enable that functionality I just include the class. This also means the feature toggle can just be a class param on the class which actually implements the feature, making things even cleaner. As I said, I can draw up a use case, and probably even a sample implementation if you'd like. |
server webserver 10.0.0.10:8000,10.0.0.20:8001 check
Does not work using haproxy 1.4.24 on centos - it only checks the 8000 port
To fix this i modified the template to write the backend servers like
server webserver 10.0.0.10:8000 check
server webserver 10.0.0.20:8001 check
This is a simpler method which allows both ports to be checked
Cheers