brooklyncentral / clocker

Apache Brooklyn cloud native infrastructure blueprints
Apache License 2.0
428 stars 66 forks source link

Link aliases using containerName makes it impossible to link 2 containers which expect different aliases #277

Closed johnmccabe closed 8 years ago

johnmccabe commented 8 years ago

Its doesn't appear to be possibly to link 2 containers which use different aliases to the same container via clocker yaml, for example this compose has 2 containers connecting to the same db, but they are implemented expecting different aliases.

dbbackup:
  image: mydbbackup
  links:
    - db:db

wordpress:
  image: wordpress
  links:
    - db:mysql
  ports:
    - 9090:80

db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: example

We can't currently support this in Clocker as the alias is instead pulled from the entity being connected to via the ContainerName and as such can only be set to one value so only one of the connecting containers can be satisfied. Perhaps switching docker.container.links from a list to a map of ' alias: targetEntity'? wdyt @grkvlt ?

grkvlt commented 8 years ago

@johnmccabe yes, could do that - would be nice to support autodetect of aliases as well, somehow - maybe two config keys?

johnmccabe commented 8 years ago

@grkvlt could you elaborate on the autodetection idea?

johnmccabe commented 8 years ago

It should also resolve the current problem using containerName where you're limited to only one occurrence of that entity as we should be able to switch to using randomly generated unique container names only.

grkvlt commented 8 years ago

Fixed by #272