I have next to zero experience with C but the commit 702d44f seems to be small enough for me to be able to wrap my head around.
I'll try making it work for use-server tomorrow! Thank you! On Tue, Feb 19, 2019 at 8:57 AM Willy Tarreau <w...@1wt.eu> wrote: > Hi Joe, > > On Tue, Feb 19, 2019 at 08:45:48AM +0000, Joe K wrote: > > Hi Willy! > > > > My use case is very similar to gitlab's review apps: > > https://gitlab.com/help/ci/review_apps/index.md, > > on some PRs I want to be able to start web apps each with its own > subdomain > > which would register themselves with haproxy > > via a socket like this (I thought): > > > > ``` > > set server be_template/websrv<i> addr <app_host> port <app_port> > > set server be_template/websrv<i> state ready > > add map /usr/local/etc/haproxy/domain2server.map <COMMIT_REF_SLUG>. > > domain.com websrv<i> > > ``` > > I see, it totally makes sense indeed! In the past it was not possible > to dynamically create servers so there was little point in having such > dynamic rules since the config would have had to be restarted anyway. > But with this in mind I totally agree with your use case. At first > glance I'm not seeing anything that would cause trouble by adapting > use-server to support log-format style rules like use_backend does. > We could simply decide that the rule does nothing if the server is > not found, like use_backend does, and like use-server does when the > designated server is down. > > I've looked at the code a bit. The only thing is that servers are > linked to the backend using a regular list, they are not placed in a > tree, so name lookups could be expensive when you have hundreds or > thousands of servers in a backend. But this limitation possibly is > acceptable for now. > > I don't know if anyone is interested in trying to work on this. It's > not very difficult and is a good first contribution. Commit 702d44f > ("MEDIUM: proxy: support use_backend with dynamic names") could serve > as an excellent guide to see how to proceed. > > Regards, > Willy >