How to route different services using domain names?

174 views
Skip to first unread message

Frank Maounis

unread,
May 26, 2015, 5:16:30 PM5/26/15
to ranc...@googlegroups.com

Hi, I am trying to route 2 different services by domain names. I've tried to add an Environment Var to the service (VIRTUAL_HOST=www.mydomain.com) but did not work.

I also tried to add HOST NAME or DOMAIN NAME in the Network tab, but had no luck.

Can someone tell me if I need a specific Environment Var? Am I missing something?

Thanks

Frank Maounis

unread,
May 27, 2015, 5:44:37 AM5/27/15
to ranc...@googlegroups.com
Just to mention that I am using RANCHER_SERVER_IMAGE=v0.20.4 . Is there a chance that this is a bug?

Thanks

Prokharchyk Alena

unread,
May 28, 2015, 1:23:59 PM5/28/15
to ranc...@googlegroups.com
Hi Frank,

Just to clarify - "services" in your post refer to Service objects in Rancher? Rancher services communicate with each other through DNS, not via environment variables. As an example, if you want instances of Service1 to resolve instances of Service2, you would need to create a link from Service1 to Service2 (in the UI, just click Edit on the service1, and select service2 from the "Links" drop down list). DNS name in this case will be the name of Service2. We are planning to add support for named links soon, so user would be able to choose which name to set for the DNS record.

Let me know if the above answers your question

-alena.

Max Wayt

unread,
May 29, 2015, 9:28:23 AM5/29/15
to ranc...@googlegroups.com
Hello,

I think the question here is how to route two different website for example, like site1.example.com and site2.example.com which are two different services in Rancher.
I also have the same question and didn't find an answer yet.

Thanks,
Max.

Prokharchyk Alena

unread,
May 29, 2015, 12:57:13 PM5/29/15
to ranc...@googlegroups.com
Max, thank you for the clarification.

Rancher currently doesn't support routing between services based on the host/domain name, but we are planning to add this functionality soon.

-Alena.

Max Wayt

unread,
May 29, 2015, 1:01:48 PM5/29/15
to ranc...@googlegroups.com
Ok thanks you,

meanwhile, I'm using this image https://registry.hub.docker.com/u/jwilder/nginx-proxy/ which do the work.

Frank Maounis

unread,
May 30, 2015, 7:29:04 PM5/30/15
to ranc...@googlegroups.com
Hi Max,

Do you mean that you are running nginx-proxy in Rancher to point to other services in Rancher? Do you run it as a service too? Are you using any LBs?

Thanks,

Frank

Frank Maounis

unread,
May 31, 2015, 2:12:23 PM5/31/15
to ranc...@googlegroups.com
Hi Alena,

Do you know how soon?

Thanks,

Frank

Max Wayt

unread,
Jun 1, 2015, 6:12:20 AM6/1/15
to ranc...@googlegroups.com
Yes I've created a service "Proxy" which have to route every http(s) requests to the right container.
An no, I'm not using any LB since then. nginx-proxy is managing roundrobine routing if you have multiple container for the same endpoint host. 

Max.

Frank Maounis

unread,
Jun 1, 2015, 8:07:29 AM6/1/15
to ranc...@googlegroups.com
Hi Max,

Thanks for the answer.

Regarding the "Yes I've created a service "Proxy" which have to route every http(s) requests to the right container.", can I also route to services instead of containers? 

Thanks,

Frank

Prokharchyk Alena

unread,
Jun 3, 2015, 1:18:43 PM6/3/15
to ranc...@googlegroups.com
Hi Frank,

We are working on it, it would be released some time in summer.

-Alena.

Marko Uskokovic

unread,
Jun 19, 2015, 6:44:11 AM6/19/15
to ranc...@googlegroups.com
Hello,
Are there any blueprints or documentation of planned features of that name-based proxy for http(s)?

Marko

pw Foo

unread,
Jun 19, 2015, 8:05:09 AM6/19/15
to ranc...@googlegroups.com
Would be great to have a implemented solution of a http(s) proxy to route traffic to the containers by one or more domain names.
Will you support other protocols / ports too? For example to route ssh to the container by domain name.

pw Foo

unread,
Jun 19, 2015, 8:08:17 AM6/19/15
to ranc...@googlegroups.com
At the moment I do some tests with jwilder/nginx-proxy and jwilder/docker-gen

Marko Uskokovic

unread,
Jun 19, 2015, 8:36:09 AM6/19/15
to ranc...@googlegroups.com
I was wandering about docker-gen but it seemed to me that it can not be done the same way
because in rancher environment variables are not exposed to arbitrary containers (https://github.com/rancherio/rancher/issues/807).

I imagined that proxy could query API like /v1/projects/1a5/instances (or get some callback?) to gather info about which
ports of which containers should be proxied for specific virtualhost.

Did you have any luck with jwilder/nginx-proxy and jwilder/docker-gen ?

pw Foo

unread,
Jun 19, 2015, 11:25:01 AM6/19/15
to ranc...@googlegroups.com
nginx-proxy works out of the box as described in the readme file, but the docker socket is mounted as volume inside the container. First attempt with separated containers (nginx + docker-gen as two containers) failed.
nginx is used as proxy, the config is a volume and will be generated by the docker-gen without a container restart. Changes trigger a nginx reload.
docker socket shouldn't be inside of the "public" nginx proxy container for security reasons.

Denise Schannon

unread,
Jun 19, 2015, 12:30:07 PM6/19/15
to Marko Uskokovic, ranc...@googlegroups.com
We currently are busy preparing for DockerCon, but both name-based proxy and SSL on our roadmap for our 1.0 release. In the next couple of weeks, we’ll be adding more details about the feature if you want to follow along. 


Thanks,
Denise


--
You received this message because you are subscribed to the Google Groups "Rancher" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rancherio+...@googlegroups.com.
To post to this group, send email to ranc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rancherio/7910b56b-85c0-4692-90e3-3c26b57d3694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages