97 Commits

Author SHA1 Message Date
Alex Ellis (VMware)
bbbb4b536a Bump watchdog to 1.9.4
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-04-03 17:55:44 +01:00
Alex Ellis (VMware)
de2c74fcdb Add feature for graceful shutdown of HTTP server
If the watchdog is sent SIGTERM from an external process then it
should stop accepting new connections and attempt to finish the
work in progress. This change makes use of the new ability in Go
1.9 and onwards to cancel a HTTP server gracefully.

The write_timeout duration is used as a grace period to allow all
in-flight requests to complete. The pattern is taken directly from
the offical example in the Golang documentation. [1]

Further tuning and testing may be needed for Windows containers which
have a different set of signals for closing work. This change aims
to cover the majority use-case for Linux containers.

The HTTP health-check is also invalidated by creating an and
expression with the existing lock file.

Tested with Kubernetes by deploying a custom watchdog and the
fprocess of `env`. Log message was observed when scaling down and
connections stopped being accepted on terminating replica.

Also corrects some typos from previous PR.

[1] https://golang.org/pkg/net/http/#Server.Shutdown

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-24 16:38:46 +00:00
John McCabe
f9d081accb Remove invalid UPDATE HTTP Method from watchdog
The UPDATE HTTP Method isn't valid and not currently in use by the
watchdog so removing it.

Signed-off-by: John McCabe <john@johnmccabe.net>
2018-03-23 16:37:33 +00:00
John McCabe
fac3345668 Use http package consts for http methods
This commit replaces occurences of http method strings with the
corresponding consts from the http package.

*Note* UPDATE is not strictly speaking a valid method and as such isn't
part of the http package (should be a PUT or PATCH?)

Signed-off-by: John McCabe <john@johnmccabe.net>
2018-03-23 16:37:33 +00:00
Alex Ellis (VMware)
a841e3d7f3 Fix bug reading default value for combine_output
The default should be set to true so we maintain backwards.
compatibility.
readconfig.go was altered due to bug reading default value. This was
tested by adding unit tests to readconfig_test.go for positive and
negative scenarios.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-22 11:23:49 +00:00
Vivek Singh
c484eeecdb Add /_/health endpoint to watchdog
Introduce new endpoint `/_/health` to watchdog for health status of
functions  which check for `/tmp/.lock` file

Fixes first part of #547 issue.

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2018-03-20 08:52:22 +00:00
Alex Ellis (VMware)
30cf8de89b Update combine_output test
Integration test for combine_output should use stat instead of
man as man is not installed in the CI system.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-17 21:12:44 +00:00
Alex Ellis (VMware)
3031d0e1c2 Feature: combine_output to control stdout/stderr
This enables an often-requested feature to separate stderr
from stdout within function responses. New flag combine_output is on
by default to match existing behaviour. When combine_output is set
to false it redirects stderr to the container logs rather than
combining it into the function response.

Tested with unit tests for default behaviour and new behaviour.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-17 20:59:47 +00:00
Alex Ellis (VMware)
85d1436707 Make use of config value for HTTP port override
As added by previous commit with unit tests.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-17 20:20:06 +00:00
Alex Ellis (VMware)
70e9a83e87 Allow override of HTTP port via env-var
HTTP port can now be overriden through use of "port" environmental
variable.

Prefer messaging "want" over "wanted" in error messages, this is more
idiomatic Golang.

Move away from Go ARMv6 (RPi Zero) and give ARMv7 as a minimum
version for release binaries.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-17 20:18:09 +00:00
Alex Ellis
67bda365cd
Update for non-function based deployments
Fixes #551
2018-03-03 10:58:34 +00:00
Vivek Singh
62900cf46e added go duration support for read_timeout, write_timeout, exec_timeout in watchdog
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>

updated testcases

applied go fmt to readconfig

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>

added requested changes in code review

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2018-02-27 18:05:55 +00:00
John McCabe
19e7f4639e Complete bump to 0.7.1 watchdog and repo.
Also bumps golang builder version to 1.9.4 for sample functions.

Signed-off-by: John McCabe <john@johnmccabe.net>
2018-02-25 11:54:21 +00:00
Alex Ellis
44609aa189
Typo fix 2017-12-30 20:44:46 +00:00
Alex Ellis
877e9d2940
Update autoscaling documentation 2017-12-28 19:00:25 +00:00
Alex Ellis
7e7a298899
Update watchdog version 2017-12-28 18:52:14 +00:00
Alex Ellis
e04319e7ec
Correct typo marshal_requests should be marshal_request 2017-12-28 18:51:06 +00:00
Alex Ellis
59d46938fe Tooltips
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-11-22 19:32:32 +00:00
Alex Ellis
4c17ccf662 Mention Afterburn update
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-11-18 12:42:12 +00:00
John McCabe
00bb13cccd Bump go version to 1.8.5
Signed-off-by: John McCabe <john@johnmccabe.net>
2017-11-09 11:48:53 +00:00
Alex Ellis
87eed35806 Handle nil body for GET
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-11-06 09:30:01 +00:00
Alex Ellis
ebd24ad285 Pass body for GET - to support ElasticSearch-type queries
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-11-06 09:30:01 +00:00
Alex Ellis
c743586899 Re-enable the suppress-lock feature
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-11-04 11:00:12 +00:00
Alex Ellis
8314b3c0b5 Log fork/duration
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-31 11:34:29 +00:00
Alex Ellis
8e4537ff73 Update README for Http_ContentLength
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-29 17:49:20 +00:00
Alex Ellis
33e794abde Add Http_ContentLength for deterministic applications
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-29 17:49:20 +00:00
Burton Rheutan
ee88d42a14 Removed extra log statement on error
Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
2017-10-23 15:13:30 +01:00
Burton Rheutan
7fa03cb7a1 Updated watchdog readme with write_debug environment variable
Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
2017-10-23 15:13:30 +01:00
Burton Rheutan
b9f59f5150 Fixes 251. Set debug_write to false by default. Added log output of byte count when debug is false. Updated tests to match new default
Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
2017-10-23 15:13:30 +01:00
Alex Ellis
dde98eb582 Forward path and query string through proxy
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-11 18:57:00 +01:00
Minh-Quan TRAN
1b9affabb4 make build fail when need to run gofmt & remove docker pull in travis
use golang 1.8.3 for gateway

Signed-off-by: Minh-Quan TRAN <account@itscaro.me>
2017-10-09 08:42:30 +01:00
John McCabe
89878f0c8a Migrate from alexellis org to openfaas
Note, not all `alexellis/github` references should be changed, there are
a number of repos which are not part of the openfaas org, this commit
excludes those.

Signed-off-by: John McCabe <john@johnmccabe.net>
2017-10-04 09:18:06 +01:00
Alex Ellis
221ed7a292 Update for ARM builds
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-01 23:36:23 +02:00
Alex Ellis
53edc286aa Fix gofmt
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-01 22:36:07 +01:00
Franklin Harding
6ebc314bdf Added os.TempDir() to replace using '/tmp/' to make the tempdir cross platform
Signed-off-by: Franklin Harding <franklinharding0.0@gmail.com>
2017-10-01 22:06:26 +02:00
Alex Ellis
1aeb978617 Remove binary
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-22 22:34:07 +01:00
Alex Ellis
b32a4e3509 Support arm64 for watchdog release
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-21 15:40:56 +01:00
Alex Ellis
7f8219ee13 Typo 2017-09-17 19:13:08 +01:00
wangguoliang
94a15e44d5 should use strings.Contains() instead of stings.Index()
Signed-off-by: wgliang <liangcszzu@163.com>
2017-09-13 09:55:45 -07:00
Alex Ellis
f6c14a70ec Add gofmt to watchdog
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-13 08:32:37 -07:00
Alex Ellis
b9be8293a8 Fix querystring passing
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-09 09:42:57 +01:00
Alex Ellis
cbfcbbb880 Strip binaries to half of size
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-04 13:45:07 +01:00
Alex Ellis
44544d80ac Mention replacing watchdog 2017-09-04 10:12:51 +01:00
Alex Ellis
c67dd6fc9d Comment out fast-fork Dockerfile change
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-02 20:12:10 +01:00
Alex Ellis
1a78ec9234 Make dockerfile multi-arch
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-02 20:12:10 +01:00
Alex Ellis
c5815d36ab add_missing_mit_header_27_aug
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-08-27 22:37:19 +01:00
Alex Ellis
5f4c731df6 Update - to _ for env vars 2017-08-25 11:19:37 +01:00
Alex
0e723c5b97 watchdog - Patch environmental header test
Signed-off-by: Alex <alexellis2@gmail.com>
2017-08-23 21:13:38 +01:00
Alex
6d436c576c watchdog - Write out headers with underscores
Signed-off-by: Alex <alexellis2@gmail.com>
2017-08-23 21:08:53 +01:00
Alex Ellis
fcdba0971c Clarify use of templating. 2017-08-19 19:08:13 +01:00