Merge pull request #5 from steigr/feature/docker-entrypoint

Fixed docker entrypoint setting
This commit is contained in:
Björn Busse 2018-03-14 03:29:37 +01:00 committed by GitHub
commit bc6cfe7184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -13,5 +13,4 @@ RUN export CGO_ENABLED=0 \
FROM alpine AS goircd
COPY --from=goircd-builder /go/bin/goircd /bin/goircd
ENTRYPOINT ["sh","-c"]
CMD ["exec goircd"]
ENTRYPOINT ["goircd"]

View File

@ -29,6 +29,7 @@ import (
"strings"
"time"
healthchecking "github.com/heptiolabs/healthcheck"
"github.com/namsral/flag"
proxyproto "github.com/Freeaqingme/go-proxyproto"
@ -37,7 +38,8 @@ import (
)
const (
PROXY_TIMEOUT = 5
PROXY_TIMEOUT = 5
HEALTCHECK_PORT = 8080
)
var (
@ -54,6 +56,7 @@ var (
proxyTimeout = flag.Uint("proxytimeout", PROXY_TIMEOUT, "Timeout when using proxy protocol")
metrics = flag.Bool("metrics", false, "Enable metrics export")
verbose = flag.Bool("v", false, "Enable verbose logging.")
healtcheck = flag.Bool("healthcheck", false, "Enable healthcheck endpoint.")
clients_tls_total = prometheus.NewCounter(
prometheus.CounterOpts{
@ -190,10 +193,23 @@ func Run() {
if *metrics {
go prom_export()
}
if *healtcheck {
go health_endpoint()
}
Processor(events, make(chan struct{}))
}
func health_endpoint() {
var (
health_bind = "0.0.0.0:8086"
)
health := healthchecking.NewHandler()
health.AddLivenessCheck("goroutine-threshold", healthchecking.GoroutineCountCheck(100))
log.Printf("Healthcheck listening on http://%s", health_bind)
http.ListenAndServe(health_bind, health)
}
func prom_export() {
prometheus.MustRegister(clients_tls_total)
prometheus.MustRegister(clients_irc_total)