Use sdnotify for systemd (#768)
* Use sdnotify for systemd This is useful if a configuration is long to load. Systemd will continue dependency chain only when server have finish to start. https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= * Extract the waiting behavior from Start()
This commit is contained in:
parent
870f378782
commit
649cb548d0
5 changed files with 24 additions and 4 deletions
|
@ -24,6 +24,8 @@ import (
|
|||
"github.com/containous/traefik/version"
|
||||
"github.com/docker/libkv/store"
|
||||
"github.com/satori/go.uuid"
|
||||
|
||||
"github.com/coreos/go-systemd/daemon"
|
||||
)
|
||||
|
||||
var versionTemplate = `Version: {{.Version}}
|
||||
|
@ -268,6 +270,11 @@ func run(traefikConfiguration *TraefikConfiguration) {
|
|||
server := NewServer(globalConfiguration)
|
||||
server.Start()
|
||||
defer server.Close()
|
||||
sent, err := daemon.SdNotify("READY=1")
|
||||
if !sent && err != nil {
|
||||
log.Error("Fail to notify", err)
|
||||
}
|
||||
server.Wait()
|
||||
log.Info("Shutting down")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue