Update README files

- Removes use of "our" from CONTRIBUTING guide
- Updates/adds README.md files
- Commnents and typo fix in watchdog
- Adds good/bad examples of commit messages

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2018-10-03 14:07:41 +01:00
parent bd39b9267a
commit 7db8ad1bda
9 changed files with 123 additions and 47 deletions

View File

@ -9,6 +9,10 @@ The watchdog provides an unmanaged and generic interface between the outside wor
Every function needs to embed this binary and use it as its `ENTRYPOINT` or `CMD`, in effect it is the init process for your container. Once your process is forked the watchdog passses in the HTTP request via `stdin` and reads a HTTP response via `stdout`. This means your process does not need to know anything about the web or HTTP.
### Next-gen: of-watchdog
Are you looking for more control over your HTTP responses, "hot functions", persistent connection pools or to cache a machine-learning model in memory? Then check out the *http mode* of the new [of-watchdog](https://github.com/openfaas-incubator/of-watchdog).
## Create a new function the easy way
**Create a function via the CLI**
@ -34,7 +38,7 @@ Here's how to package your function if you don't want to use the CLI or have exi
Example Dockerfile for an `echo` function:
```
FROM alpine:3.7
FROM alpine:3.8
ADD https://github.com/openfaas/faas/releases/download/0.9.4/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog

View File

@ -20,6 +20,10 @@ import (
"github.com/openfaas/faas/watchdog/types"
)
type requestInfo struct {
headerWritten bool
}
// buildFunctionInput for a GET method this is an empty byte array.
func buildFunctionInput(config *WatchdogConfig, r *http.Request) ([]byte, error) {
var res []byte
@ -48,16 +52,13 @@ func buildFunctionInput(config *WatchdogConfig, r *http.Request) ([]byte, error)
return res, err
}
// debugHeaders prints HTTP headers as key/value pairs
func debugHeaders(source *http.Header, direction string) {
for k, vv := range *source {
fmt.Printf("[%s] %s=%s\n", direction, k, vv)
}
}
type requestInfo struct {
headerWritten bool
}
func pipeRequest(config *WatchdogConfig, w http.ResponseWriter, r *http.Request, method string) {
startTime := time.Now()

View File

@ -1,6 +1,9 @@
// Copyright (c) Alex Ellis 2017. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Package main provides the OpenFaaS Classic Watchdog. The Classic Watchdog is a HTTP
// shim for serverless functions providing health-checking, graceful shutdowns,
// timeouts and a consistent logging experience.
package main
import (
@ -73,6 +76,10 @@ func markUnhealthy() error {
return removeErr
}
// listenUntilShutdown will listen for HTTP requests until SIGTERM
// is sent at which point the code will wait `shutdownTimeout` before
// closing off connections and a futher `shutdownTimeout` before
// exiting
func listenUntilShutdown(shutdownTimeout time.Duration, s *http.Server, suppressLock bool) {
idleConnsClosed := make(chan struct{})

View File

@ -1,18 +1,18 @@
package main
var (
//Version release version of the watchdog
// Version release version of the watchdog
Version string
//GitCommit SHA of the last git commit
// GitCommit SHA of the last git commit
GitCommit string
//DevVerison string for the development version
DevVerison = "dev"
// DevVersion string for the development version
DevVersion = "dev"
)
//BuildVersion returns current version of watchdog
// BuildVersion returns current version of watchdog
func BuildVersion() string {
if len(Version) == 0 {
return DevVerison
return DevVersion
}
return Version
}