mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Merge branch 'main' into abandon-gin
This commit is contained in:
commit
bb4a9583a7
@ -31,8 +31,11 @@
|
|||||||
- Add configuration option to allow Tailscale clients to use a random WireGuard port. [kb/1181/firewalls](https://tailscale.com/kb/1181/firewalls) [#624](https://github.com/juanfont/headscale/pull/624)
|
- Add configuration option to allow Tailscale clients to use a random WireGuard port. [kb/1181/firewalls](https://tailscale.com/kb/1181/firewalls) [#624](https://github.com/juanfont/headscale/pull/624)
|
||||||
- Improve obtuse UX regarding missing configuration (`ephemeral_node_inactivity_timeout` not set) [#639](https://github.com/juanfont/headscale/pull/639)
|
- Improve obtuse UX regarding missing configuration (`ephemeral_node_inactivity_timeout` not set) [#639](https://github.com/juanfont/headscale/pull/639)
|
||||||
- Fix nodes being shown as 'offline' in `tailscale status` [648](https://github.com/juanfont/headscale/pull/648)
|
- Fix nodes being shown as 'offline' in `tailscale status` [648](https://github.com/juanfont/headscale/pull/648)
|
||||||
|
- Fix nodes being shown as 'offline' in `tailscale status` [#648](https://github.com/juanfont/headscale/pull/648)
|
||||||
|
- Improve shutdown behaviour [#651](https://github.com/juanfont/headscale/pull/651)
|
||||||
- Drop Gin as web framework in Headscale [648](https://github.com/juanfont/headscale/pull/648)
|
- Drop Gin as web framework in Headscale [648](https://github.com/juanfont/headscale/pull/648)
|
||||||
|
|
||||||
|
|
||||||
## 0.15.0 (2022-03-20)
|
## 0.15.0 (2022-03-20)
|
||||||
|
|
||||||
**Note:** Take a backup of your database before upgrading.
|
**Note:** Take a backup of your database before upgrading.
|
||||||
|
36
app.go
36
app.go
@ -55,12 +55,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AuthPrefix = "Bearer "
|
AuthPrefix = "Bearer "
|
||||||
Postgres = "postgres"
|
Postgres = "postgres"
|
||||||
Sqlite = "sqlite3"
|
Sqlite = "sqlite3"
|
||||||
updateInterval = 5000
|
updateInterval = 5000
|
||||||
HTTPReadTimeout = 30 * time.Second
|
HTTPReadTimeout = 30 * time.Second
|
||||||
privateKeyFileMode = 0o600
|
HTTPShutdownTimeout = 3 * time.Second
|
||||||
|
privateKeyFileMode = 0o600
|
||||||
|
|
||||||
registerCacheExpiration = time.Minute * 15
|
registerCacheExpiration = time.Minute * 15
|
||||||
registerCacheCleanup = time.Minute * 20
|
registerCacheCleanup = time.Minute * 20
|
||||||
@ -685,8 +686,13 @@ func (h *Headscale) Serve() error {
|
|||||||
h.shutdownChan <- struct{}{}
|
h.shutdownChan <- struct{}{}
|
||||||
|
|
||||||
// Gracefully shut down servers
|
// Gracefully shut down servers
|
||||||
promHTTPServer.Shutdown(ctx)
|
ctx, cancel := context.WithTimeout(context.Background(), HTTPShutdownTimeout)
|
||||||
httpServer.Shutdown(ctx)
|
if err := promHTTPServer.Shutdown(ctx); err != nil {
|
||||||
|
log.Error().Err(err).Msg("Failed to shutdown prometheus http")
|
||||||
|
}
|
||||||
|
if err := httpServer.Shutdown(ctx); err != nil {
|
||||||
|
log.Error().Err(err).Msg("Failed to shutdown http")
|
||||||
|
}
|
||||||
grpcSocket.GracefulStop()
|
grpcSocket.GracefulStop()
|
||||||
|
|
||||||
// Close network listeners
|
// Close network listeners
|
||||||
@ -697,7 +703,21 @@ func (h *Headscale) Serve() error {
|
|||||||
// Stop listening (and unlink the socket if unix type):
|
// Stop listening (and unlink the socket if unix type):
|
||||||
socketListener.Close()
|
socketListener.Close()
|
||||||
|
|
||||||
|
// Close db connections
|
||||||
|
db, err := h.db.DB()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Failed to get db handle")
|
||||||
|
}
|
||||||
|
err = db.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Failed to close db")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info().
|
||||||
|
Msg("Headscale stopped")
|
||||||
|
|
||||||
// And we're done:
|
// And we're done:
|
||||||
|
cancel()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc.
|
|||||||
Err(err).
|
Err(err).
|
||||||
Caller().
|
Caller().
|
||||||
Msgf("Failed to load configuration")
|
Msgf("Failed to load configuration")
|
||||||
|
os.Exit(-1) // we get here if logging is suppressed (i.e., json output)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
@ -116,6 +117,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc.
|
|||||||
conn, err := grpc.DialContext(ctx, address, grpcOptions...)
|
conn, err := grpc.DialContext(ctx, address, grpcOptions...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Caller().Err(err).Msgf("Could not connect: %v", err)
|
log.Fatal().Caller().Err(err).Msgf("Could not connect: %v", err)
|
||||||
|
os.Exit(-1) // we get here if logging is suppressed (i.e., json output)
|
||||||
}
|
}
|
||||||
|
|
||||||
client := v1.NewHeadscaleServiceClient(conn)
|
client := v1.NewHeadscaleServiceClient(conn)
|
||||||
|
Loading…
Reference in New Issue
Block a user