Skip to content

Commit

Permalink
docs: remote backend configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed May 20, 2024
1 parent faadc91 commit 7d0f612
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
27 changes: 27 additions & 0 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,33 @@ queries from these safelisted peers, serving locally cached blocks if requested.
Default: `false` (no cache sharing)

### `RAINBOW_DHT_ROUTING`

Control the type of Amino DHT client used for for routing. Options are `accelerated`, `standard` and `off`.

Default: `accelerated`

### `RAINBOW_REMOTE_BACKENDS`

> [!WARNING]
> Experimental feature. Requires setting `RAINBOW_DHT_ROUTING=off` and `RAINBOW_BITSWAP=false`.
URL(s) of of remote [trustless gateways](https://docs.ipfs.tech/reference/http/gateway/#trustless-verifiable-retrieval)
to use as backend instead of libp2p node with Bitswap.

Default: not set

### `RAINBOW_REMOTE_BACKENDS_MODE`

Requires `RAINBOW_REMOTE_BACKENDS` to be set.

Controls how requests to remote backend are made.

- `block` will use [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) to fetch raw blocks one by one
- `car` will use [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) and [IPIP-402: Partial CAR Support on Trustless Gateways](https://specs.ipfs.tech/ipips/ipip-0402/) for fetching multiple blocks per request

Default: `block`

## Logging

### `GOLOG_LOG_LEVEL`
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Generate an identity seed and launch a gateway:
Name: "peering",
Value: cli.NewStringSlice(),
EnvVars: []string{"RAINBOW_PEERING"},
Usage: "Multiaddresses of peers to stay connected to (comma-separated)",
Usage: "(EXPERIMENTAL) Multiaddresses of peers to stay connected to and ask for missing blocks over Bitswap (comma-separated)",
},
&cli.BoolFlag{
Name: "peering-shared-cache",
Expand Down Expand Up @@ -258,13 +258,13 @@ Generate an identity seed and launch a gateway:
Name: "remote-backends",
Value: cli.NewStringSlice(),
EnvVars: []string{"RAINBOW_REMOTE_BACKENDS"},
Usage: "Trustless gateways to use as backend instead of Bitswap (comma-separated urls)",
Usage: "(EXPERIMENTAL) Trustless gateways to use as backend instead of Bitswap (comma-separated urls)",
},
&cli.StringFlag{
Name: "remote-backends-mode",
Value: "block",
EnvVars: []string{"RAINBOW_REMOTE_BACKENDS_MODE"},
Usage: "Whether to fetch raw blocks or CARs from the remote backends. Options are 'block' or 'car'",
Usage: "(EXPERIMENTAL) Whether to fetch raw blocks or CARs from the remote backends. Options are 'block' or 'car'",
Action: func(ctx *cli.Context, s string) error {
switch RemoteBackendMode(s) {
case RemoteBackendBlock, RemoteBackendCAR:
Expand Down
4 changes: 2 additions & 2 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ func SetupNoLibp2p(ctx context.Context, cfg Config, dnsCache *cachedDNS) (*Node,

// The stars aligned and Libp2p does not need to be turned on at all.
if len(cfg.RemoteBackends) == 0 {
return nil, errors.New("remote backends must be set when bitswap and dht are disabled")
return nil, errors.New("URL of RAINBOW_REMOTE_BACKENDS must be set when RAINBOW_BITSWAP and RAINBOW_DHT_ROUTING are disabled")

Check warning on line 140 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L139-L140

Added lines #L139 - L140 were not covered by tests
}

// Setup a Value Store composed of both the remote backends and the delegated
// routers, if they exist. This vs is only used for the namesystem.
// routers, if they exist. This vs is only used for resolving IPNS Records.
vs, err := setupRoutingNoLibp2p(cfg, dnsCache)
if err != nil {
return nil, err

Check warning on line 147 in setup.go

View check run for this annotation

Codecov / codecov/patch

setup.go#L145-L147

Added lines #L145 - L147 were not covered by tests
Expand Down

0 comments on commit 7d0f612

Please sign in to comment.