{"action":"created","issue":{"url":"https://api.github.com/repos/rancher/rancher/issues/1746","labels_url":"https://api.github.com/repos/rancher/rancher/issues/1746/labels{/name}","comments_url":"https://api.github.com/repos/rancher/rancher/issues/1746/comments","events_url":"https://api.github.com/repos/rancher/rancher/issues/1746/events","html_url":"https://github.com/rancher/rancher/issues/1746","id":99343597,"number":1746,"title":"rancher-compose fails to correctly setup L7 load balancer","user":{"login":"sf-devops","id":11682050,"avatar_url":"https://avatars.githubusercontent.com/u/11682050?v=3","gravatar_id":"","url":"https://api.github.com/users/sf-devops","html_url":"https://github.com/sf-devops","followers_url":"https://api.github.com/users/sf-devops/followers","following_url":"https://api.github.com/users/sf-devops/following{/other_user}","gists_url":"https://api.github.com/users/sf-devops/gists{/gist_id}","starred_url":"https://api.github.com/users/sf-devops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sf-devops/subscriptions","organizations_url":"https://api.github.com/users/sf-devops/orgs","repos_url":"https://api.github.com/users/sf-devops/repos","events_url":"https://api.github.com/users/sf-devops/events{/privacy}","received_events_url":"https://api.github.com/users/sf-devops/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"alena1108","id":1562176,"avatar_url":"https://avatars.githubusercontent.com/u/1562176?v=3","gravatar_id":"","url":"https://api.github.com/users/alena1108","html_url":"https://github.com/alena1108","followers_url":"https://api.github.com/users/alena1108/followers","following_url":"https://api.github.com/users/alena1108/following{/other_user}","gists_url":"https://api.github.com/users/alena1108/gists{/gist_id}","starred_url":"https://api.github.com/users/alena1108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alena1108/subscriptions","organizations_url":"https://api.github.com/users/alena1108/orgs","repos_url":"https://api.github.com/users/alena1108/repos","events_url":"https://api.github.com/users/alena1108/events{/privacy}","received_events_url":"https://api.github.com/users/alena1108/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-08-06T03:06:31Z","updated_at":"2015-08-06T04:07:55Z","closed_at":null,"body":"When using rancher-compose to recreate a load balancer, the L7 vhost/request-host definition is not correctly setup per the labels in the docker-compose.yml file.  \r\n\r\nrancher-compose:  v0.2.5\r\nrancher/server: v0.31.0\r\n\r\nWorking config for haproxy as reported by rancher/server export config:\r\n```\r\n$ cat docker-compose.yml\r\nhaproxy-stage:\r\n  ports:\r\n  - '80'\r\n  external_links:\r\n  - docker-test-stage/docker-test-stage:dts\r\n  labels:\r\n    io.rancher.scheduler.affinity:host_label: sf_env=stage\r\n    io.rancher.loadbalancer.target.dts: docker-test.example.com=10001\r\n  tty: true\r\n  image: rancher/load-balancer-service\r\n  stdin_open: true\r\n\r\n$ cat rancher-compose.yml\r\nhaproxy-stage:\r\n  scale: 2\r\n  load_balancer_config:\r\n    name: haproxy-stage config\r\ndocker-test-stage:\r\n  scale: 2\r\n```\r\n\r\n```\r\n$ rancher-compose --access-key=xxx --secret-key=yyy --url=http://54.210.xxx.xxx:8080/v1 create\r\nINFO[0000] Creating environment haproxy-stage\r\nINFO[0000] Creating service haproxy-stage\r\n\r\n$ rancher-compose --access-key=xxx --secret-key=yyy --url=http://54.210.xxx.xxx:8080/v1 start\r\nINFO[0000] Project [haproxy-stage]: Starting project\r\nINFO[0000] [0/1] [haproxy-stage]: Starting\r\nINFO[0009] [1/1] [haproxy-stage]: Started\r\n```\r\nThe vhost link of docker-test.example.com port 10001 is what is being problematic.  The link is created but the target port and request host fields are not populated.  \r\n\r\nIf I manually put docker-test.example.com in the request host and target port 10001 ... everything works fine again.  \r\n\r\nHere's the L7 routing for haproxy-stage after i've run rancher-compose ... notice that the request_host and target_port are left blank:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/11682050/9102889/a5b7be90-3bbd-11e5-890d-ddb41268515c.png)\r\n\r\nHere's the L7 routing for haproxy-stage after I've manually added the request_host and the target_port:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/11682050/9102864/80d1f758-3bbd-11e5-8a29-17c26a0cdf79.png)\r\n\r\nAfter I manually re-add those two bits of info, the load balancer functions fine.    I consulted the label syntax for the vhost as described on this page:  http://docs.rancher.com/rancher/rancher-compose/rancher-services/  ... and it seems to be correct.  Plus, its what rancher/server exports after I've manually fixed it.  \r\n\r\n```\r\n# curl --header 'Host: docker-test.example.com' http://54.210.xxx.xxx\r\n<h1>Hello World!</h1><p>\r\nHost: 6b1fbf51f3d6<p>\r\nUser ip:10.42.42.156\r\n# curl --header 'Host: docker-test.example.com' http://54.210.xxx.xxx\r\n<h1>Hello World!</h1><p>\r\nHost: 860da075d21f<p>\r\nUser ip:10.42.42.156\r\n```"},"comment":{"url":"https://api.github.com/repos/rancher/rancher/issues/comments/128229575","html_url":"https://github.com/rancher/rancher/issues/1746#issuecomment-128229575","issue_url":"https://api.github.com/repos/rancher/rancher/issues/1746","id":128229575,"user":{"login":"alena1108","id":1562176,"avatar_url":"https://avatars.githubusercontent.com/u/1562176?v=3","gravatar_id":"","url":"https://api.github.com/users/alena1108","html_url":"https://github.com/alena1108","followers_url":"https://api.github.com/users/alena1108/followers","following_url":"https://api.github.com/users/alena1108/following{/other_user}","gists_url":"https://api.github.com/users/alena1108/gists{/gist_id}","starred_url":"https://api.github.com/users/alena1108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alena1108/subscriptions","organizations_url":"https://api.github.com/users/alena1108/orgs","repos_url":"https://api.github.com/users/alena1108/repos","events_url":"https://api.github.com/users/alena1108/events{/privacy}","received_events_url":"https://api.github.com/users/alena1108/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T04:07:55Z","updated_at":"2015-08-06T04:07:55Z","body":"@sf-devops the culprit is the named external link - \"dts\", or rather the fact that the name of the link is different from the service name. During the \"io.rancher.loadbalancer.target.*\" label generation when export .yml, instead of reading from the service.name, we read from the service link name - a Rancher server bug. Because rancher-compose looks up for the target service by name, not link alias, when propagate host name routing rules to rancher. \r\n\r\nTo workaround the problem for now, just remove \":dts\" portion from the yml file, so it looks like:\r\n```\r\nexternal_links:\r\n  - docker-test-stage/docker-test-stage\r\n```\r\nand omit the link alias for all new links you register for Rancher LB service. Let us know how it works for you.\r\n\r\nWe will be working on the actual fix, thanks for reporting the issue"}}