mesos-dns store the app's IP and ports. so you can query the mesos-dns to setup a route rule to define the url.
2015-08-02 17:51 GMT+08:00 Ryan Thomas <r.n.tho...@gmail.com>: > Yes it appears that mesos-dns does use SRV records - I should really check > it out :) > > On 2 August 2015 at 10:50, Ryan Thomas <r.n.tho...@gmail.com> wrote: > >> Hey Itamar, >> >> Using DNS to redirect to a port will only be possible if you're using SRV >> records (I'm not sure what mesos-dns uses) but this doesn't really matter >> as it won't be looked up by the browser. >> >> For this solution I have a small daemon written in go running on a number >> of hosts (that aren't slaves), this locates the marathon master, and pulls >> down my apps - I tag apps with a "Host" label (something like >> foo.example.com) and then I create a haproxy config file with backends >> directed by the host header. There's a few more smarts in it around only >> pulling apps with a green healthcheck etc. >> >> This daemon manages the lifecycle of haproxy on the node - it uses a >> polling model, not an event driven one from the marathon event stream. >> >> Another solution that uses the event-stream is this one >> https://github.com/QubitProducts/bamboo - it's been a while since I >> checked it out, but was functional back then. >> >> Hope that helps. >> >> ryan >> >> On 2 August 2015 at 07:10, Itamar Ostricher <ita...@yowza3d.com> wrote: >> >>> I use marathon to launch a nginx-docker-container named "my-app", and >>> set up Mesos-DNS, such that "my-app.marathon.mesos" returns the IP of the >>> slave running the container (e.g. 10.20.30.40). >>> >>> Now, "my-app" is running on some dynamically-allocated port (e.g. >>> 31001), but I would like http://my-app.marathon.mesos/foo to hit my app >>> at http://10.20.30.40:31001/foo >>> >>> Is there a "best practice" way to achieve this behavior? >>> >>> I was thinking about a proxy running on each slave, listening on port >>> 80, redirecting incoming HTTP requests based on the request host to the >>> correct port on localhost. The "correct port" can be determined by querying >>> mesos-dns itself. >>> >>> This sounds like a pretty common use-case, so I wondered if anyone can >>> point me at an existing solution for this. >>> >>> Thanks! >>> - Itamar. >>> >> >> > -- Deshi Xiao Twitter: xds2000 E-mail: xiaods(AT)gmail.com