openshift/geard — pull request #175 by mfojtik (2014-06-05 12:04:59+00:00)
Title: [WIP] Prototype of systemd container 'readiness' notification support in geard

Based on: https://trello.com/c/E61dzHR5/227-5-r-d-prototype-a-readiness-notification-for-containers-managed-by-systemd

When you add `notify: true` into deploy JSON, then:

* A `Type=notify` systemd service is created for container instead of `Type=simple`
* The `docker run` is launched using the `docker-notify` wrapper that provide a UNIX pipe ($SYSTEMD_NOTIFY) inside container, which is used to send a message to systemd (echo 'READY=1' > $SYSTEMD_NOTIFY)
* Container will turn into *running* in systemd *only* when the notification is sent to systemd. The unit has 5m timeout.

To test this works:

```
$ gear deploy deployments/fixtures/notify_deploy.json
$ gear start web-1
$ gear status web-1 # => Activating...
$ switchns --container=web-1 -- /bin/sh -c "echo 1 > /.notify"
$ gear status web-1 # => Running

```

TODO:

* How we gonna detect whether the image/scripts support 'notification' deployment ?
* Provide a sample image and STI script (`notify-ready`?)