Fail when server is unable to bind port (#20409)

* Server: Return error when unable to bind port
* Server: Exit if a service fails
* Build: Remove graceful kill from Bra config
This commit is contained in:
Arve Knudsen
2019-11-18 09:49:08 +01:00
committed by GitHub
parent 85b7ddefc0
commit 82f4fc2783
3 changed files with 10 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ import (
"github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/services/rendering"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/errutil"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
macaron "gopkg.in/macaron.v1"
@@ -93,8 +94,7 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
listenAddr := fmt.Sprintf("%s:%s", setting.HttpAddr, setting.HttpPort)
listener, err := net.Listen("tcp", listenAddr)
if err != nil {
hs.log.Debug("server was shutdown gracefully")
return nil
return errutil.Wrapf(err, "failed to open listener on address %s", listenAddr)
}
hs.log.Info("HTTP Server Listen", "address", listener.Addr().String(), "protocol", setting.Protocol, "subUrl", setting.AppSubUrl, "socket", setting.SocketPath)