3 Commits
v2.8 ... alpine

Author SHA1 Message Date
Quentin McGaw
fe294f52a9 Add healthcheck triggered log line 2020-09-29 22:44:07 +00:00
Quentin McGaw
62e700c82c Alpine image, refers to #100 2020-09-29 22:44:07 +00:00
Quentin McGaw
5d0e8548a1 Healthcheck listens on all interfaces, see #100 2020-09-29 22:44:06 +00:00
3 changed files with 3 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ RUN go test ./...
RUN go build -trimpath -ldflags="-s -w" -o app
RUN golangci-lint run --timeout=10m
FROM scratch
FROM alpine:${ALPINE_VERSION}
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION

View File

@@ -150,7 +150,7 @@ func _main(ctx context.Context, timeNow func() time.Time) int {
go func() {
serverErrors <- server.RunServers(ctx,
server.Settings{Name: "production", Addr: "0.0.0.0:" + p.listeningPort, Handler: productionHandlerFunc},
server.Settings{Name: "healthcheck", Addr: "127.0.0.1:9999", Handler: healthcheckHandlerFunc},
server.Settings{Name: "healthcheck", Addr: "0.0.0.0:9999", Handler: healthcheckHandlerFunc},
)
}()

View File

@@ -14,6 +14,7 @@ type lookupIPFunc func(host string) ([]net.IP, error)
// IsHealthy checks all the records were updated successfully and returns an error if not
func IsHealthy(db data.Database, lookupIP lookupIPFunc, logger logging.Logger) (err error) {
logger.Info("Healthcheck triggered!")
defer func() {
if err != nil {
logger.Warn("unhealthy: %s", err)