diff --git a/service/dnsmasq/dnsmasq.go b/service/dnsmasq/dnsmasq.go index c8a86f62..87b4d832 100644 --- a/service/dnsmasq/dnsmasq.go +++ b/service/dnsmasq/dnsmasq.go @@ -22,6 +22,13 @@ func New() model.Service { "pygmy.name": "amazeeio-dnsmasq", "pygmy.weight": "13", }, + Healthcheck: &container.HealthConfig{ + Test: []string{"CMD-SHELL", "stat /run/dnsmasq.pid"}, + Interval: 30000000000, + Timeout: 5000000000, + StartPeriod: 5000000000, + Retries: 5, + }, }, HostConfig: container.HostConfig{ AutoRemove: false, diff --git a/service/dnsmasq/dnsmasq_test.go b/service/dnsmasq/dnsmasq_test.go index 2dc74a7e..70354ea2 100644 --- a/service/dnsmasq/dnsmasq_test.go +++ b/service/dnsmasq/dnsmasq_test.go @@ -23,6 +23,10 @@ func Test(t *testing.T) { So(obj.Config.Labels["pygmy.enable"], ShouldEqual, "true") So(obj.Config.Labels["pygmy.name"], ShouldEqual, "amazeeio-dnsmasq") So(obj.Config.Labels["pygmy.weight"], ShouldEqual, "13") + So(obj.Config.Healthcheck.Test, ShouldResemble, []string{"CMD-SHELL", "stat /run/dnsmasq.pid"}) + So(obj.Config.Healthcheck.Interval, ShouldEqual, 30000000000) + So(obj.Config.Healthcheck.Timeout, ShouldEqual, 5000000000) + So(obj.Config.Healthcheck.StartPeriod, ShouldEqual, 5000000000) So(obj.HostConfig.AutoRemove, ShouldBeFalse) So(fmt.Sprint(obj.HostConfig.CapAdd), ShouldEqual, fmt.Sprint([]string{"NET_ADMIN"})) So(obj.HostConfig.IpcMode, ShouldEqual, "private") diff --git a/service/haproxy/haproxy.go b/service/haproxy/haproxy.go index 2e4f3922..1ef713eb 100644 --- a/service/haproxy/haproxy.go +++ b/service/haproxy/haproxy.go @@ -20,6 +20,13 @@ func New() model.Service { "pygmy.url": "http://docker.amazee.io/stats", "pygmy.weight": "14", }, + Healthcheck: &container.HealthConfig{ + Test: []string{"CMD-SHELL", "wget http://docker.amazee.io/stats -q -S -O - 2>&1 | grep docker.amazee.io"}, + Interval: 30000000000, + Timeout: 5000000000, + StartPeriod: 5000000000, + Retries: 5, + }, }, HostConfig: container.HostConfig{ Binds: []string{"/var/run/docker.sock:/tmp/docker.sock"}, diff --git a/service/haproxy/haproxy_test.go b/service/haproxy/haproxy_test.go index 11157329..f67696ed 100644 --- a/service/haproxy/haproxy_test.go +++ b/service/haproxy/haproxy_test.go @@ -25,6 +25,10 @@ func Test(t *testing.T) { So(obj.Config.Labels["pygmy.network"], ShouldEqual, "amazeeio-network") So(obj.Config.Labels["pygmy.url"], ShouldEqual, "http://docker.amazee.io/stats") So(obj.Config.Labels["pygmy.weight"], ShouldEqual, "14") + So(obj.Config.Healthcheck.Test, ShouldResemble, []string{"CMD-SHELL", "wget http://docker.amazee.io/stats -q -S -O - 2>&1 | grep docker.amazee.io"}) + So(obj.Config.Healthcheck.Interval, ShouldEqual, 30000000000) + So(obj.Config.Healthcheck.Timeout, ShouldEqual, 5000000000) + So(obj.Config.Healthcheck.StartPeriod, ShouldEqual, 5000000000) So(obj.HostConfig.AutoRemove, ShouldBeFalse) So(fmt.Sprint(obj.HostConfig.Binds), ShouldEqual, fmt.Sprint([]string{"/var/run/docker.sock:/tmp/docker.sock"})) So(obj.HostConfig.PortBindings, ShouldEqual, nil) diff --git a/service/mailhog/mailhog.go b/service/mailhog/mailhog.go index 89996e9d..bb5e6c85 100644 --- a/service/mailhog/mailhog.go +++ b/service/mailhog/mailhog.go @@ -32,6 +32,13 @@ func New() model.Service { "pygmy.url": "http://mailhog.docker.amazee.io", "pygmy.weight": "15", }, + Healthcheck: &container.HealthConfig{ + Test: []string{"CMD-SHELL", "wget http://mailhog.docker.amazee.io -q -S -O - 2>&1 | grep email"}, + Interval: 30000000000, + Timeout: 5000000000, + StartPeriod: 5000000000, + Retries: 5, + }, }, HostConfig: container.HostConfig{ AutoRemove: false, diff --git a/service/mailhog/mailhog_test.go b/service/mailhog/mailhog_test.go index 2a882d80..3b742e9a 100644 --- a/service/mailhog/mailhog_test.go +++ b/service/mailhog/mailhog_test.go @@ -28,6 +28,10 @@ func Test(t *testing.T) { So(obj.Config.Labels["pygmy.network"], ShouldEqual, "amazeeio-network") So(obj.Config.Labels["pygmy.url"], ShouldEqual, "http://mailhog.docker.amazee.io") So(obj.Config.Labels["pygmy.weight"], ShouldEqual, "15") + So(obj.Config.Healthcheck.Test, ShouldResemble, []string{"CMD-SHELL", "wget http://mailhog.docker.amazee.io -q -S -O - 2>&1 | grep email"}) + So(obj.Config.Healthcheck.Interval, ShouldEqual, 30000000000) + So(obj.Config.Healthcheck.Timeout, ShouldEqual, 5000000000) + So(obj.Config.Healthcheck.StartPeriod, ShouldEqual, 5000000000) So(obj.HostConfig.AutoRemove, ShouldBeFalse) So(obj.HostConfig.PortBindings, ShouldEqual, nil) So(obj.HostConfig.RestartPolicy.Name, ShouldEqual, "unless-stopped") diff --git a/service/ssh/agent/ssh_agent.go b/service/ssh/agent/ssh_agent.go index aca11678..0bf14394 100644 --- a/service/ssh/agent/ssh_agent.go +++ b/service/ssh/agent/ssh_agent.go @@ -23,6 +23,13 @@ func New() model.Service { "pygmy.purpose": "sshagent", "pygmy.weight": "30", }, + Healthcheck: &container.HealthConfig{ + Test: []string{"CMD-SHELL", "stat $SSH_AUTH_SOCK"}, + Interval: 30000000000, + Timeout: 5000000000, + StartPeriod: 5000000000, + Retries: 5, + }, }, HostConfig: container.HostConfig{ AutoRemove: false, diff --git a/service/ssh/agent/ssh_agent_test.go b/service/ssh/agent/ssh_agent_test.go index 0e029a81..789ac485 100644 --- a/service/ssh/agent/ssh_agent_test.go +++ b/service/ssh/agent/ssh_agent_test.go @@ -31,6 +31,10 @@ func Test(t *testing.T) { So(obj.Config.Labels["pygmy.network"], ShouldEqual, "amazeeio-network") So(obj.Config.Labels["pygmy.purpose"], ShouldEqual, "sshagent") So(obj.Config.Labels["pygmy.weight"], ShouldEqual, "30") + So(obj.Config.Healthcheck.Test, ShouldResemble, []string{"CMD-SHELL", "stat $SSH_AUTH_SOCK"}) + So(obj.Config.Healthcheck.Interval, ShouldEqual, 30000000000) + So(obj.Config.Healthcheck.Timeout, ShouldEqual, 5000000000) + So(obj.Config.Healthcheck.StartPeriod, ShouldEqual, 5000000000) So(obj.HostConfig.AutoRemove, ShouldBeFalse) So(obj.HostConfig.IpcMode, ShouldEqual, "private") So(obj.HostConfig.PortBindings, ShouldEqual, nil)