mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-17 23:16:11 +08:00
feat: explicit announce-on/off profiles (#10524)
moving reprovide on/off to separate profile to avoid footgun where node no longer announces to DHT + ipfs daemon check that prints warning on start if reprovide system is disabled
This commit is contained in:
@ -600,8 +600,25 @@ take effect.
|
|||||||
fmt.Println("(Hit ctrl-c again to force-shutdown the daemon.)")
|
fmt.Println("(Hit ctrl-c again to force-shutdown the daemon.)")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Give the user heads up if daemon running in online mode has no peers after 1 minute
|
|
||||||
if !offline {
|
if !offline {
|
||||||
|
// Warn users who were victims of 'lowprofile' footgun (https://github.com/ipfs/kubo/pull/10524)
|
||||||
|
if cfg.Experimental.StrategicProviding {
|
||||||
|
fmt.Print(`
|
||||||
|
⚠️ Reprovide system is disabled due to 'Experimental.StrategicProviding=true'
|
||||||
|
⚠️ Local CIDs will not be announced to Amino DHT, making them impossible to retrieve without manual peering
|
||||||
|
⚠️ If this is not intentional, call 'ipfs config profile apply announce-on'
|
||||||
|
|
||||||
|
`)
|
||||||
|
} else if cfg.Reprovider.Interval.WithDefault(config.DefaultReproviderInterval) == 0 {
|
||||||
|
fmt.Print(`
|
||||||
|
⚠️ Reprovider system is disabled due to 'Reprovider.Interval=0'
|
||||||
|
⚠️ Local CIDs will not be announced to Amino DHT, making them impossible to retrieve without manual peering
|
||||||
|
⚠️ If this is not intentional, call 'ipfs config profile apply announce-on', or set 'Reprovider.Interval=22h'
|
||||||
|
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give the user heads up if daemon running in online mode has no peers after 1 minute
|
||||||
time.AfterFunc(1*time.Minute, func() {
|
time.AfterFunc(1*time.Minute, func() {
|
||||||
cfg, err := cctx.GetConfig()
|
cfg, err := cctx.GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -174,10 +174,12 @@ functionality - performance of content discovery and data
|
|||||||
fetching may be degraded.
|
fetching may be degraded.
|
||||||
`,
|
`,
|
||||||
Transform: func(c *Config) error {
|
Transform: func(c *Config) error {
|
||||||
|
// Disable "server" services (dht, autonat, limited relay)
|
||||||
c.Routing.Type = NewOptionalString("autoclient")
|
c.Routing.Type = NewOptionalString("autoclient")
|
||||||
c.AutoNAT.ServiceMode = AutoNATServiceDisabled
|
c.AutoNAT.ServiceMode = AutoNATServiceDisabled
|
||||||
c.Reprovider.Interval = NewOptionalDuration(0)
|
c.Swarm.RelayService.Enabled = False
|
||||||
|
|
||||||
|
// Keep bare minimum connections around
|
||||||
lowWater := int64(20)
|
lowWater := int64(20)
|
||||||
highWater := int64(40)
|
highWater := int64(40)
|
||||||
gracePeriod := time.Minute
|
gracePeriod := time.Minute
|
||||||
@ -188,6 +190,29 @@ fetching may be degraded.
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"announce-off": {
|
||||||
|
Description: `Disables Reprovide system (and announcing to Amino DHT).
|
||||||
|
|
||||||
|
USE WITH CAUTION:
|
||||||
|
The main use case for this is setups with manual Peering.Peers config.
|
||||||
|
Data from this node will not be announced on the DHT. This will make
|
||||||
|
DHT-based routing an data retrieval impossible if this node is the only
|
||||||
|
one hosting it, and other peers are not already connected to it.
|
||||||
|
`,
|
||||||
|
Transform: func(c *Config) error {
|
||||||
|
c.Reprovider.Interval = NewOptionalDuration(0) // 0 disables periodic reprovide
|
||||||
|
c.Experimental.StrategicProviding = true // this is not a typo (the name is counter-intuitive)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"announce-on": {
|
||||||
|
Description: `Re-enables Reprovide system (reverts announce-off profile).`,
|
||||||
|
Transform: func(c *Config) error {
|
||||||
|
c.Reprovider.Interval = NewOptionalDuration(DefaultReproviderInterval) // have to apply explicit default because nil would be ignored
|
||||||
|
c.Experimental.StrategicProviding = false // this is not a typo (the name is counter-intuitive)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
"randomports": {
|
"randomports": {
|
||||||
Description: `Use a random port number for swarm.`,
|
Description: `Use a random port number for swarm.`,
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [🔦 Highlights](#-highlights)
|
- [🔦 Highlights](#-highlights)
|
||||||
|
- [`lowpower` profile no longer breaks DHT announcements](#lowpower-profile-no-longer-breaks-dht-announcements)
|
||||||
- [📝 Changelog](#-changelog)
|
- [📝 Changelog](#-changelog)
|
||||||
- [👨👩👧👦 Contributors](#-contributors)
|
- [👨👩👧👦 Contributors](#-contributors)
|
||||||
|
|
||||||
@ -13,6 +14,18 @@
|
|||||||
|
|
||||||
### 🔦 Highlights
|
### 🔦 Highlights
|
||||||
|
|
||||||
|
#### `lowpower` profile no longer breaks DHT announcements
|
||||||
|
|
||||||
|
We've notices users were applying `lowpower` profile, and then reporting content routing issues. This was because `lowpower` disabled reprovider system and locally hosted data was no longer announced on Amino DHT.
|
||||||
|
|
||||||
|
This release changes [`lowpower` profile](https://github.com/ipfs/kubo/blob/master/docs/config.md#lowpower-profile) to not change reprovider settings, ensuring the new users are not sabotaging themselves. It also adds [`annouce-on`](https://github.com/ipfs/kubo/blob/master/docs/config.md#announce-on-profile) and [`announce-off`](https://github.com/ipfs/kubo/blob/master/docs/config.md#announce-off-profile) profiles for controlling announcement settings separately.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> If you've ever applied the `lowpower` profile before, there is a high chance your node is not announcing to DHT anymore.
|
||||||
|
> If you have `Reprovider.Interval` set to `0` you may want to wet it to `22h` (or run `ipfs config profile apply announce-on`) to fix your system.
|
||||||
|
>
|
||||||
|
> As a convenience, `ipfs daemon` will warn if reprovide system is disabled, creating oportinity to fix configuration if it was not intentional.
|
||||||
|
|
||||||
### 📝 Changelog
|
### 📝 Changelog
|
||||||
|
|
||||||
### 👨👩👧👦 Contributors
|
### 👨👩👧👦 Contributors
|
||||||
|
@ -183,6 +183,8 @@ config file at runtime.
|
|||||||
- [`flatfs` profile](#flatfs-profile)
|
- [`flatfs` profile](#flatfs-profile)
|
||||||
- [`badgerds` profile](#badgerds-profile)
|
- [`badgerds` profile](#badgerds-profile)
|
||||||
- [`lowpower` profile](#lowpower-profile)
|
- [`lowpower` profile](#lowpower-profile)
|
||||||
|
- [`announce-off` profile](#announce-off-profile)
|
||||||
|
- [`announce-on` profile](#announce-on-profile)
|
||||||
- [`legacy-cid-v0` profile](#legacy-cid-v0-profile)
|
- [`legacy-cid-v0` profile](#legacy-cid-v0-profile)
|
||||||
- [`test-cid-v1` profile](#test-cid-v1-profile)
|
- [`test-cid-v1` profile](#test-cid-v1-profile)
|
||||||
- [Types](#types)
|
- [Types](#types)
|
||||||
@ -299,7 +301,7 @@ Map of HTTP headers to set on responses from the RPC (`/api/v0`) HTTP server.
|
|||||||
Example:
|
Example:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Foo": ["bar"]
|
"Foo": ["bar"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -534,27 +536,27 @@ Default:
|
|||||||
```
|
```
|
||||||
{
|
{
|
||||||
"mounts": [
|
"mounts": [
|
||||||
{
|
{
|
||||||
"child": {
|
"child": {
|
||||||
"path": "blocks",
|
"path": "blocks",
|
||||||
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
|
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
|
||||||
"sync": true,
|
"sync": true,
|
||||||
"type": "flatfs"
|
"type": "flatfs"
|
||||||
},
|
},
|
||||||
"mountpoint": "/blocks",
|
"mountpoint": "/blocks",
|
||||||
"prefix": "flatfs.datastore",
|
"prefix": "flatfs.datastore",
|
||||||
"type": "measure"
|
"type": "measure"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"child": {
|
"child": {
|
||||||
"compression": "none",
|
"compression": "none",
|
||||||
"path": "datastore",
|
"path": "datastore",
|
||||||
"type": "levelds"
|
"type": "levelds"
|
||||||
},
|
},
|
||||||
"mountpoint": "/",
|
"mountpoint": "/",
|
||||||
"prefix": "leveldb.datastore",
|
"prefix": "leveldb.datastore",
|
||||||
"type": "measure"
|
"type": "measure"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "mount"
|
"type": "mount"
|
||||||
}
|
}
|
||||||
@ -1145,7 +1147,7 @@ Example:
|
|||||||
"API" : {
|
"API" : {
|
||||||
"Endpoint" : "https://pinningservice.tld:1234/my/api/path",
|
"Endpoint" : "https://pinningservice.tld:1234/my/api/path",
|
||||||
"Key" : "someOpaqueKey"
|
"Key" : "someOpaqueKey"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2439,18 +2441,30 @@ This profile may only be applied when first initializing the node.
|
|||||||
|
|
||||||
### `lowpower` profile
|
### `lowpower` profile
|
||||||
|
|
||||||
Reduces daemon overhead on the system. Affects node
|
Reduces daemon overhead on the system by disabling optional swarm services.
|
||||||
functionality - performance of content discovery and data
|
|
||||||
fetching may be degraded.
|
- [`Routing.Type`](#routingtype) set to `autoclient` (no DHT server, only client).
|
||||||
|
- `Swarm.ConnMgr` set to maintain minimum number of p2p connections at a time.
|
||||||
|
- Disables [`AutoNAT`](#autonat).
|
||||||
|
- Disables [`Swam.RelayService`](#swarmrelayservice).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This profile is provided for legacy reasons.
|
||||||
|
> With modern Kubo setting the above should not be necessary.
|
||||||
|
|
||||||
|
### `announce-off` profile
|
||||||
|
|
||||||
|
Disables [Reprovider](#reprovider) system (and announcing to Amino DHT).
|
||||||
|
|
||||||
> [!CAUTION]
|
> [!CAUTION]
|
||||||
> Local data won't be announced on routing systems like Amino DHT.
|
> The main use case for this is setups with manual Peering.Peers config.
|
||||||
|
> Data from this node will not be announced on the DHT. This will make
|
||||||
|
> DHT-based routing an data retrieval impossible if this node is the only
|
||||||
|
> one hosting it, and other peers are not already connected to it.
|
||||||
|
|
||||||
- `Swarm.ConnMgr` set to maintain minimum number of p2p connections at a time.
|
### `announce-on` profile
|
||||||
- Disables [`Reprovider`](#reprovider) service → no CID will be announced on Amino DHT and other routing systems(!)
|
|
||||||
- Disables [`AutoNAT`](#autonat).
|
|
||||||
|
|
||||||
Use this profile with caution.
|
(Re-)enables [Reprovider](#reprovider) system (reverts [`announce-off` profile](#annouce-off-profile).
|
||||||
|
|
||||||
### `legacy-cid-v0` profile
|
### `legacy-cid-v0` profile
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user