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 lifecycle checks at the service level #156

Closed iangkent closed 8 years ago

iangkent commented 8 years ago

Currently maestro only supports lifecycle checks defined in service instance level. http://maestro-ng.readthedocs.org/en/latest/#lifecycle-checks

However, when the lifecycle check is the same for each instance of the service it would be nice to define the check at service level. We did refactor the checks to service level and did not receive error when maestro parsed the yaml. It tool us a while to notice that only the default checks were happening.

  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}

versus

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

Thanks for reporting this. I just re-read the documentation I wrote and it is indeed confusing in that it clearly lets people believe that lifecycle checks at the service level are possible (there's even an example!).

The main problem with service-level lifecycle checks is when would you want them to be executed? Maestro is internally completely container-granularity, and services are really only a construct of configuration, not of execution. One thing that is easily done is to consider lifecycle checks defined at the service level in the configuration to be executed for each container in that service (basically as a way to de-duplicate configuration).

iangkent commented 8 years ago

Yes, we just want to simply/refactor configuration so we don't need to repeat ourselves with the same lifecycle check for each container/instance in a service.

mpetazzoni commented 8 years ago

Cool. That can be done. I'll look into it.