mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Metrics: Disable toggle. Set default port to 9090
This commit is contained in:
parent
6126d6d9b5
commit
9a61725e9f
8 changed files with 22 additions and 42 deletions
3
app.go
3
app.go
|
@ -72,7 +72,6 @@ const (
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ServerURL string
|
ServerURL string
|
||||||
Addr string
|
Addr string
|
||||||
MetricsEnabled bool
|
|
||||||
MetricsAddr string
|
MetricsAddr string
|
||||||
GRPCAddr string
|
GRPCAddr string
|
||||||
GRPCAllowInsecure bool
|
GRPCAllowInsecure bool
|
||||||
|
@ -658,7 +657,6 @@ func (h *Headscale) Serve() error {
|
||||||
log.Info().
|
log.Info().
|
||||||
Msgf("listening and serving HTTP on: %s", h.cfg.Addr)
|
Msgf("listening and serving HTTP on: %s", h.cfg.Addr)
|
||||||
|
|
||||||
if h.cfg.MetricsEnabled {
|
|
||||||
promRouter := h.createPrometheusRouter()
|
promRouter := h.createPrometheusRouter()
|
||||||
|
|
||||||
promHTTPServer := &http.Server{
|
promHTTPServer := &http.Server{
|
||||||
|
@ -679,7 +677,6 @@ func (h *Headscale) Serve() error {
|
||||||
|
|
||||||
log.Info().
|
log.Info().
|
||||||
Msgf("listening and serving metrics on: %s", h.cfg.MetricsAddr)
|
Msgf("listening and serving metrics on: %s", h.cfg.MetricsAddr)
|
||||||
}
|
|
||||||
|
|
||||||
return errorGroup.Wait()
|
return errorGroup.Wait()
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,6 @@ func getHeadscaleConfig() headscale.Config {
|
||||||
return headscale.Config{
|
return headscale.Config{
|
||||||
ServerURL: viper.GetString("server_url"),
|
ServerURL: viper.GetString("server_url"),
|
||||||
Addr: viper.GetString("listen_addr"),
|
Addr: viper.GetString("listen_addr"),
|
||||||
MetricsEnabled: viper.GetBool("metrics_enabled"),
|
|
||||||
MetricsAddr: viper.GetString("metrics_listen_addr"),
|
MetricsAddr: viper.GetString("metrics_listen_addr"),
|
||||||
GRPCAddr: viper.GetString("grpc_listen_addr"),
|
GRPCAddr: viper.GetString("grpc_listen_addr"),
|
||||||
GRPCAllowInsecure: viper.GetBool("grpc_allow_insecure"),
|
GRPCAllowInsecure: viper.GetBool("grpc_allow_insecure"),
|
||||||
|
|
|
@ -55,8 +55,7 @@ func (*Suite) TestConfigLoading(c *check.C) {
|
||||||
// Test that config file was interpreted correctly
|
// Test that config file was interpreted correctly
|
||||||
c.Assert(viper.GetString("server_url"), check.Equals, "http://127.0.0.1:8080")
|
c.Assert(viper.GetString("server_url"), check.Equals, "http://127.0.0.1:8080")
|
||||||
c.Assert(viper.GetString("listen_addr"), check.Equals, "0.0.0.0:8080")
|
c.Assert(viper.GetString("listen_addr"), check.Equals, "0.0.0.0:8080")
|
||||||
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9915")
|
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9090")
|
||||||
c.Assert(viper.GetString("metrics_enabled"), check.Equals, "true")
|
|
||||||
c.Assert(viper.GetString("db_type"), check.Equals, "sqlite3")
|
c.Assert(viper.GetString("db_type"), check.Equals, "sqlite3")
|
||||||
c.Assert(viper.GetString("db_path"), check.Equals, "/var/lib/headscale/db.sqlite")
|
c.Assert(viper.GetString("db_path"), check.Equals, "/var/lib/headscale/db.sqlite")
|
||||||
c.Assert(viper.GetString("tls_letsencrypt_hostname"), check.Equals, "")
|
c.Assert(viper.GetString("tls_letsencrypt_hostname"), check.Equals, "")
|
||||||
|
|
|
@ -16,14 +16,11 @@ server_url: http://127.0.0.1:8080
|
||||||
#
|
#
|
||||||
listen_addr: 0.0.0.0:8080
|
listen_addr: 0.0.0.0:8080
|
||||||
|
|
||||||
# Enable Prometheus metrics endpoint
|
|
||||||
metrics_enabled: true
|
|
||||||
|
|
||||||
# Address to listen to /metrics, you may want
|
# Address to listen to /metrics, you may want
|
||||||
# to keep this endpoint private to your internal
|
# to keep this endpoint private to your internal
|
||||||
# network
|
# network
|
||||||
#
|
#
|
||||||
metrics_listen_addr: 127.0.0.1:9915
|
metrics_listen_addr: 127.0.0.1:9090
|
||||||
|
|
||||||
# Address to listen for gRPC.
|
# Address to listen for gRPC.
|
||||||
# gRPC is used for controlling a headscale server
|
# gRPC is used for controlling a headscale server
|
||||||
|
|
|
@ -5,6 +5,5 @@ metadata:
|
||||||
data:
|
data:
|
||||||
server_url: $(PUBLIC_PROTO)://$(PUBLIC_HOSTNAME)
|
server_url: $(PUBLIC_PROTO)://$(PUBLIC_HOSTNAME)
|
||||||
listen_addr: "0.0.0.0:8080"
|
listen_addr: "0.0.0.0:8080"
|
||||||
metrics_enabled: "true"
|
metrics_listen_addr: "127.0.0.1:9090"
|
||||||
metrics_listen_addr: "127.0.0.1:9915"
|
|
||||||
ephemeral_node_inactivity_timeout: "30m"
|
ephemeral_node_inactivity_timeout: "30m"
|
||||||
|
|
|
@ -30,11 +30,6 @@ spec:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: headscale-config
|
name: headscale-config
|
||||||
key: metrics_listen_addr
|
key: metrics_listen_addr
|
||||||
- name: METRICS_ENABLED
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: headscale-config
|
|
||||||
key: metrics_enabled
|
|
||||||
- name: DERP_MAP_PATH
|
- name: DERP_MAP_PATH
|
||||||
value: /vol/config/derp.yaml
|
value: /vol/config/derp.yaml
|
||||||
- name: EPHEMERAL_NODE_INACTIVITY_TIMEOUT
|
- name: EPHEMERAL_NODE_INACTIVITY_TIMEOUT
|
||||||
|
|
|
@ -31,11 +31,6 @@ spec:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: headscale-config
|
name: headscale-config
|
||||||
key: metrics_listen_addr
|
key: metrics_listen_addr
|
||||||
- name: METRICS_ENABLED
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: headscale-config
|
|
||||||
key: metrics_enabled
|
|
||||||
- name: DERP_MAP_PATH
|
- name: DERP_MAP_PATH
|
||||||
value: /vol/config/derp.yaml
|
value: /vol/config/derp.yaml
|
||||||
- name: EPHEMERAL_NODE_INACTIVITY_TIMEOUT
|
- name: EPHEMERAL_NODE_INACTIVITY_TIMEOUT
|
||||||
|
|
|
@ -14,8 +14,7 @@ dns_config:
|
||||||
db_path: /tmp/integration_test_db.sqlite3
|
db_path: /tmp/integration_test_db.sqlite3
|
||||||
private_key_path: private.key
|
private_key_path: private.key
|
||||||
listen_addr: 0.0.0.0:8080
|
listen_addr: 0.0.0.0:8080
|
||||||
metrics_enabled: true
|
metrics_listen_addr: 127.0.0.1:9090
|
||||||
metrics_listen_addr: 127.0.0.1:9915
|
|
||||||
server_url: http://headscale:8080
|
server_url: http://headscale:8080
|
||||||
|
|
||||||
derp:
|
derp:
|
||||||
|
|
Loading…
Reference in a new issue