Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

EXTRA_ROUTE_SETTINGS is global for every server #113

Open
kakawait opened this issue Sep 21, 2016 · 9 comments
Open

EXTRA_ROUTE_SETTINGS is global for every server #113

kakawait opened this issue Sep 21, 2016 · 9 comments
Assignees
Labels

Comments

@kakawait
Copy link

Using following docker-compose.yml

version: '2'
services:
  blue:
    image: dockercloud/hello-world
    environment:
      - "EXTRA_ROUTE_SETTINGS=weight 1"
  green:
    image: dockercloud/hello-world
    environment:
      - "EXTRA_ROUTE_SETTINGS=weight 2"
  lb:
    image: dockercloud/haproxy
    links:
      - blue
      - green
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 80

I may expect something like

backend default_service
  server test_blue_1 test_blue_1:80 check inter 2000 rise 2 fall 3 weight 1
  server test_green_1 test_green_1:80 check inter 2000 rise 2 fall 3 weight 2

but actual result is

backend default_service
  server test_blue_1 test_blue_1:80 check inter 2000 rise 2 fall 3 weight 2
  server test_green_1 test_green_1:80 check inter 2000 rise 2 fall 3 weight 2
@tifayuki
Copy link
Contributor

@kakawait
Looks like it is a bug. I will take a look at it.

Thank you for pointing it out :)

@tifayuki tifayuki added the bug label Sep 28, 2016
@tifayuki tifayuki self-assigned this Sep 28, 2016
@hierynomus
Copy link

It's not just EXTRA_ROUTE_SETTINGS. Also for instance HEALTH_CHECK suffers from the same problem.

@tifayuki
Copy link
Contributor

@hierynomus

True. The code is written under the assumption that all the routes in the same backend have the same route settings.

If you set VIRTUAL_HOST on each service, the routes are configured as expected. Without VIRTUAL_HOST, all the routes from all the services are put into the default_service backend, and the script simply pick one of the settings randomly and apply to all the routes.

Let me think how to solve the issue easily in your use case.

@hierynomus
Copy link

@tifayuki, Thanks. The main use-case I have is that I wanted to inject the backup keyword in the EXTRA_ROUTE_SETTINGS so that I can configure a hot-failover scenario.

@hierynomus
Copy link

@tifayuki I've submitted PR #120 which fixes my scenario at least. If you know can suggest a better way of fixing (or implementing) this, I'd be more than happy to take another stab at this.

@MicOestergaard
Copy link

if I set the same VIRTUAL_HOST for two services and specify EXTRA_ROUTE_SETTINGS for one of them, that setting will affect both. I want to use this to append "backup" to one of the services.

Unfortunately the solution in #120 does not work for me. I still get backup appended to both services.

@hierynomus
Copy link

@MicOestergaard, as per #120, you can add FAILOVER=true to the environment of the node to fix the backup route.

@MicOestergaard
Copy link

Unfortunately that doesn't work for me. Adding FAILOVER to the backup service results in all other services getting backup route as well.

@MicOestergaard
Copy link

@tifayuki I have submitted PR #222 which seems to fix the issue for me. Let me know if I have missed something and I'll take another look at it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants