mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-20 19:09:07 +01:00
make database configuration change breaking (#1766)
A lot of things are breaking in 0.23 so instead of having this be a long process, just rip of the plaster. Updates #1758 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
6055d0b397
commit
c73e8476b9
@ -24,6 +24,9 @@ after improving the test harness as part of adopting [#1460](https://github.com/
|
|||||||
### BREAKING
|
### BREAKING
|
||||||
|
|
||||||
- Code reorganisation, a lot of code has moved, please review the following PRs accordingly [#1473](https://github.com/juanfont/headscale/pull/1473)
|
- Code reorganisation, a lot of code has moved, please review the following PRs accordingly [#1473](https://github.com/juanfont/headscale/pull/1473)
|
||||||
|
- Change the structure of database configuration, see [config-example.yaml](./config-example.yaml) for the new structure. [#1700](https://github.com/juanfont/headscale/pull/1700)
|
||||||
|
- Old structure has been remove and the configuration _must_ be converted.
|
||||||
|
- Adds additional configuration for PostgreSQL for setting max open, idle conection and idle connection lifetime.
|
||||||
- API: Machine is now Node [#1553](https://github.com/juanfont/headscale/pull/1553)
|
- API: Machine is now Node [#1553](https://github.com/juanfont/headscale/pull/1553)
|
||||||
- Remove support for older Tailscale clients [#1611](https://github.com/juanfont/headscale/pull/1611)
|
- Remove support for older Tailscale clients [#1611](https://github.com/juanfont/headscale/pull/1611)
|
||||||
- The latest supported client is 1.38
|
- The latest supported client is 1.38
|
||||||
@ -46,9 +49,6 @@ after improving the test harness as part of adopting [#1460](https://github.com/
|
|||||||
- Fix [TS-2023-006](https://tailscale.com/security-bulletins/#ts-2023-006) security UPnP issue [#1563](https://github.com/juanfont/headscale/pull/1563)
|
- Fix [TS-2023-006](https://tailscale.com/security-bulletins/#ts-2023-006) security UPnP issue [#1563](https://github.com/juanfont/headscale/pull/1563)
|
||||||
- Turn off gRPC logging [#1640](https://github.com/juanfont/headscale/pull/1640) fixes [#1259](https://github.com/juanfont/headscale/issues/1259)
|
- Turn off gRPC logging [#1640](https://github.com/juanfont/headscale/pull/1640) fixes [#1259](https://github.com/juanfont/headscale/issues/1259)
|
||||||
- Added the possibility to manually create a DERP-map entry which can be customized, instead of automatically creating it. [#1565](https://github.com/juanfont/headscale/pull/1565)
|
- Added the possibility to manually create a DERP-map entry which can be customized, instead of automatically creating it. [#1565](https://github.com/juanfont/headscale/pull/1565)
|
||||||
- Change the structure of database configuration, see [config-example.yaml](./config-example.yaml) for the new structure. [#1700](https://github.com/juanfont/headscale/pull/1700)
|
|
||||||
- Old structure is now considered deprecated and will be removed in the future.
|
|
||||||
- Adds additional configuration for PostgreSQL for setting max open, idle conection and idle connection lifetime.
|
|
||||||
- Add support for deleting api keys [#1702](https://github.com/juanfont/headscale/pull/1702)
|
- Add support for deleting api keys [#1702](https://github.com/juanfont/headscale/pull/1702)
|
||||||
|
|
||||||
## 0.22.3 (2023-05-12)
|
## 0.22.3 (2023-05-12)
|
||||||
|
@ -58,8 +58,6 @@ func (*Suite) TestConfigFileLoading(c *check.C) {
|
|||||||
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, "127.0.0.1:8080")
|
c.Assert(viper.GetString("listen_addr"), check.Equals, "127.0.0.1:8080")
|
||||||
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9090")
|
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9090")
|
||||||
c.Assert(viper.GetString("db_type"), check.Equals, "sqlite")
|
|
||||||
c.Assert(viper.GetString("db_path"), check.Equals, "/var/lib/headscale/db.sqlite")
|
|
||||||
c.Assert(viper.GetString("database.type"), check.Equals, "sqlite")
|
c.Assert(viper.GetString("database.type"), check.Equals, "sqlite")
|
||||||
c.Assert(viper.GetString("database.sqlite.path"), check.Equals, "/var/lib/headscale/db.sqlite")
|
c.Assert(viper.GetString("database.sqlite.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, "")
|
||||||
@ -103,8 +101,8 @@ func (*Suite) TestConfigLoading(c *check.C) {
|
|||||||
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, "127.0.0.1:8080")
|
c.Assert(viper.GetString("listen_addr"), check.Equals, "127.0.0.1:8080")
|
||||||
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9090")
|
c.Assert(viper.GetString("metrics_listen_addr"), check.Equals, "127.0.0.1:9090")
|
||||||
c.Assert(viper.GetString("db_type"), check.Equals, "sqlite")
|
c.Assert(viper.GetString("database.type"), check.Equals, "sqlite")
|
||||||
c.Assert(viper.GetString("db_path"), check.Equals, "/var/lib/headscale/db.sqlite")
|
c.Assert(viper.GetString("database.sqlite.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, "")
|
||||||
c.Assert(viper.GetString("tls_letsencrypt_listen"), check.Equals, ":http")
|
c.Assert(viper.GetString("tls_letsencrypt_listen"), check.Equals, ":http")
|
||||||
c.Assert(viper.GetString("tls_letsencrypt_challenge_type"), check.Equals, "HTTP-01")
|
c.Assert(viper.GetString("tls_letsencrypt_challenge_type"), check.Equals, "HTTP-01")
|
||||||
|
@ -158,7 +158,7 @@ database:
|
|||||||
# conn_max_idle_time_secs: 3600
|
# conn_max_idle_time_secs: 3600
|
||||||
|
|
||||||
# # If other 'sslmode' is required instead of 'require(true)' and 'disabled(false)', set the 'sslmode' you need
|
# # If other 'sslmode' is required instead of 'require(true)' and 'disabled(false)', set the 'sslmode' you need
|
||||||
# # in the 'db_ssl' field. Refers to https://www.postgresql.org/docs/current/libpq-ssl.html Table 34.1.
|
# # in the 'ssl' field. Refers to https://www.postgresql.org/docs/current/libpq-ssl.html Table 34.1.
|
||||||
# ssl: false
|
# ssl: false
|
||||||
|
|
||||||
### TLS configuration
|
### TLS configuration
|
||||||
|
@ -62,8 +62,8 @@ private_key_path: /etc/headscale/private.key
|
|||||||
noise:
|
noise:
|
||||||
private_key_path: /etc/headscale/noise_private.key
|
private_key_path: /etc/headscale/noise_private.key
|
||||||
# The default /var/lib/headscale path is not writable in the container
|
# The default /var/lib/headscale path is not writable in the container
|
||||||
db_type: sqlite3
|
database.type: sqlite3
|
||||||
db_path: /etc/headscale/db.sqlite
|
database.sqlite.path: /etc/headscale/db.sqlite
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Start the headscale server while working in the host headscale directory:
|
4. Start the headscale server while working in the host headscale directory:
|
||||||
|
@ -57,7 +57,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
errSTUNAddressNotSet = errors.New("STUN address not set")
|
errSTUNAddressNotSet = errors.New("STUN address not set")
|
||||||
errUnsupportedDatabase = errors.New("unsupported DB")
|
|
||||||
errUnsupportedLetsEncryptChallengeType = errors.New(
|
errUnsupportedLetsEncryptChallengeType = errors.New(
|
||||||
"unknown value for Lets Encrypt challenge type",
|
"unknown value for Lets Encrypt challenge type",
|
||||||
)
|
)
|
||||||
@ -79,9 +78,6 @@ const (
|
|||||||
type Headscale struct {
|
type Headscale struct {
|
||||||
cfg *types.Config
|
cfg *types.Config
|
||||||
db *db.HSDatabase
|
db *db.HSDatabase
|
||||||
dbString string
|
|
||||||
dbType string
|
|
||||||
dbDebug bool
|
|
||||||
noisePrivateKey *key.MachinePrivate
|
noisePrivateKey *key.MachinePrivate
|
||||||
|
|
||||||
DERPMap *tailcfg.DERPMap
|
DERPMap *tailcfg.DERPMap
|
||||||
|
@ -180,19 +180,6 @@ func LoadConfig(path string, isFile bool) error {
|
|||||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
viper.RegisterAlias("db_type", "database.type")
|
|
||||||
|
|
||||||
// SQLite aliases
|
|
||||||
viper.RegisterAlias("db_path", "database.sqlite.path")
|
|
||||||
|
|
||||||
// Postgres aliases
|
|
||||||
viper.RegisterAlias("db_host", "database.postgres.host")
|
|
||||||
viper.RegisterAlias("db_port", "database.postgres.port")
|
|
||||||
viper.RegisterAlias("db_name", "database.postgres.name")
|
|
||||||
viper.RegisterAlias("db_user", "database.postgres.user")
|
|
||||||
viper.RegisterAlias("db_pass", "database.postgres.pass")
|
|
||||||
viper.RegisterAlias("db_ssl", "database.postgres.ssl")
|
|
||||||
|
|
||||||
viper.SetDefault("tls_letsencrypt_cache_dir", "/var/www/.cache")
|
viper.SetDefault("tls_letsencrypt_cache_dir", "/var/www/.cache")
|
||||||
viper.SetDefault("tls_letsencrypt_challenge_type", HTTP01ChallengeType)
|
viper.SetDefault("tls_letsencrypt_challenge_type", HTTP01ChallengeType)
|
||||||
|
|
||||||
@ -215,7 +202,6 @@ func LoadConfig(path string, isFile bool) error {
|
|||||||
viper.SetDefault("cli.timeout", "5s")
|
viper.SetDefault("cli.timeout", "5s")
|
||||||
viper.SetDefault("cli.insecure", false)
|
viper.SetDefault("cli.insecure", false)
|
||||||
|
|
||||||
viper.SetDefault("db_ssl", false)
|
|
||||||
viper.SetDefault("database.postgres.ssl", false)
|
viper.SetDefault("database.postgres.ssl", false)
|
||||||
viper.SetDefault("database.postgres.max_open_conns", 10)
|
viper.SetDefault("database.postgres.max_open_conns", 10)
|
||||||
viper.SetDefault("database.postgres.max_idle_conns", 10)
|
viper.SetDefault("database.postgres.max_idle_conns", 10)
|
||||||
|
@ -67,8 +67,9 @@ func DefaultConfigYAML() string {
|
|||||||
log:
|
log:
|
||||||
level: trace
|
level: trace
|
||||||
acl_policy_path: ""
|
acl_policy_path: ""
|
||||||
db_type: sqlite3
|
database:
|
||||||
db_path: /tmp/integration_test_db.sqlite3
|
type: sqlite3
|
||||||
|
sqlite.path: /tmp/integration_test_db.sqlite3
|
||||||
ephemeral_node_inactivity_timeout: 30m
|
ephemeral_node_inactivity_timeout: 30m
|
||||||
node_update_check_interval: 10s
|
node_update_check_interval: 10s
|
||||||
ip_prefixes:
|
ip_prefixes:
|
||||||
|
Loading…
Reference in New Issue
Block a user