signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
685 stars 83 forks source link

Ability to define ports mapping at the service level #165

Closed zsuzhengdu closed 8 years ago

zsuzhengdu commented 8 years ago

Currently maestro only supports ports mapping defined in service 'instance' level.

http://maestro-ng.readthedocs.org/en/latest/port_mapping.html

However, when the ports mapping is the same for each instance of the service, it would be nice to define ports mapping at service level. We did refactor the ports mapping to service level and did not receive error when maestro parsed the yaml. It took us a while to notice that ports mapping only apply to instance level.

  zookeeper:
    image: docker.cenx.localnet:5000/zookeeper
    lifecycle:
      running: [{type: tcp, port: client}]
    ports: {client: 2181, peer: 2888, election: 3888, jmx: 9000}
    instances:
      zk1:
        ship: ship1
      zk2:
        ship: ship2
      zk3:
        ship: ship3

versus

  zookeeper:
    image: docker.cenx.localnet:5000/zookeeper
    lifecycle:
      running: [{type: tcp, port: client}]
    instances:
      zk1:
        ship: ship1
        ports: {client: 2181, peer: 2888, election: 3888, jmx: 9000}
      zk2:
        ship: ship2
        ports: {client: 2181, peer: 2888, election: 3888, jmx: 9000}
      zk3:
        ship: ship3
        ports: {client: 2181, peer: 2888, election: 3888, jmx: 9000}