2021-08-18 19:18:49 +00:00
|
|
|
# Configuration
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
There are three ways to configure the S3 GW:
|
|
|
|
1. CLI parameters
|
|
|
|
2. YAML file
|
|
|
|
3. Environment variables
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Everything available as a CLI parameter can also be specified via environment variables and almost everything can be
|
|
|
|
specified via `.yaml` configuration file.
|
|
|
|
|
|
|
|
But **not vice versa**, some parameters can be configured only with environment variables/configuration file.
|
|
|
|
Most of these parameters have default values, therefore, these ways to configure the gateway are optional and
|
|
|
|
basic configuration can be completed with CLI parameters only.
|
|
|
|
|
2022-04-27 07:15:46 +00:00
|
|
|
1. [CLI parameters](#cli-parameters)
|
|
|
|
1. [Nodes and weights](#nodes-and-weights)
|
|
|
|
2. [Wallet](#wallet)
|
|
|
|
3. [Binding and TLS](#listening-on-address-and-TLS)
|
|
|
|
4. [RPC endpoint and resolving of bucket names](#rpc-endpoint-and-resolving-of-bucket-names)
|
|
|
|
5. [Processing of requests](#processing-of-requests)
|
|
|
|
6. [Connection to NeoFS](#connection-to-NeoFS)
|
|
|
|
7. [Monitoring and metrics](#monitoring-and-metrics)
|
|
|
|
2. [YAML file and environment variables](#yaml-file-and-environment-variables)
|
|
|
|
1. [Notifications](#notifications)
|
2022-04-06 14:31:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
## CLI parameters
|
|
|
|
|
|
|
|
### Nodes and weights
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2021-08-19 12:46:41 +00:00
|
|
|
You can specify multiple `-p` options to add more NeoFS nodes; this will make
|
|
|
|
a gateway spread requests equally among them (using weight 1 for every node):
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
```shell
|
2021-08-18 19:18:49 +00:00
|
|
|
$ neofs-s3-gw -p 192.168.130.72:8080 -p 192.168.130.71:8080
|
|
|
|
```
|
2022-04-06 14:31:32 +00:00
|
|
|
If you want some specific load distribution proportions, use weights and priorities, they
|
2022-04-13 16:56:58 +00:00
|
|
|
can only be specified via environment variables or a configuration file.
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### Wallet
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Wallet (`--wallet`) is a mandatory parameter. It is a path to a wallet file. You can provide a passphrase to decrypt
|
|
|
|
a wallet via env variable or conf file, or you will be asked to enter a password interactively.
|
|
|
|
You can also specify an account address to use from a wallet using the `--address` parameter.
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### Listening on address and TLS
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Gateway listens on `0.0.0.0:8080` by default, and you can change that with the `--listen_address` option.
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2021-08-19 12:46:41 +00:00
|
|
|
It can also provide TLS interface for its users, just specify paths to the key and
|
2021-08-18 19:18:49 +00:00
|
|
|
certificate files via `--tls.key_file` and `--tls.cert_file` parameters. Note
|
2022-04-13 16:56:58 +00:00
|
|
|
that using these options makes gateway TLS-only. If you need to serve both TLS
|
|
|
|
and plain text, you either have to run two gateway instances or use some
|
2021-08-18 19:18:49 +00:00
|
|
|
external redirecting solution.
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Example to bind to `192.168.130.130:443` and serve TLS there (keys and nodes are
|
2021-08-18 19:18:49 +00:00
|
|
|
omitted):
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
```shell
|
2021-08-18 19:18:49 +00:00
|
|
|
$ neofs-s3-gw --listen_address 192.168.130.130:443 \
|
|
|
|
--tls.key_file=key.pem --tls.cert_file=cert.pem
|
|
|
|
```
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### RPC endpoint and resolving of bucket names
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-14 18:10:57 +00:00
|
|
|
To set RPC endpoint specify a value of parameter `-r` or `--rpc_endpoint`. The parameter is **required if** another
|
|
|
|
parameter's `--resolve_order` value contains `nns`.
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
```shell
|
2022-04-14 18:10:57 +00:00
|
|
|
$ neofs-s3-gw --rpc_endpoint http://morph-chain.neofs.devenv:30333/ --resolve_order nns,dns
|
2021-08-18 19:18:49 +00:00
|
|
|
```
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### Processing of requests
|
|
|
|
|
|
|
|
Maximum number of clients whose requests can be handled by the gateway can be specified by the value of
|
|
|
|
`--max_clients_count` parameter, the default value is 100.
|
|
|
|
`--max_clients_deadline` defines deadline after which the gate sends error `RequestTimeout` to a client, default value
|
|
|
|
is 30 seconds.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ neofs-s3-gw --max_clients_count 150 --max_clients_deadline 1m
|
2021-08-18 19:18:49 +00:00
|
|
|
```
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### Connection to NeoFS
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Timeout to connect to NeoFS nodes can be set with `--connect_timeout` (default 30s)
|
2022-04-14 15:09:57 +00:00
|
|
|
and timeout to check node health during rebalance`--healthcheck_timeout` (default 15s).
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-14 15:09:57 +00:00
|
|
|
Also, interval to check node health can be specified by `--rebalance_interval` value, default value is 15s.
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
```shell
|
2022-04-14 15:09:57 +00:00
|
|
|
$ neofs-s3-gw --healthcheck_timeout 15s --connect_timeout 1m --rebalance_interval 1h
|
2021-08-18 19:18:49 +00:00
|
|
|
```
|
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
### Monitoring and metrics
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
Pprof and Prometheus are integrated into the gateway, but not enabled by
|
|
|
|
default. To enable them, use `--pprof` and `--metrics` flags or
|
|
|
|
`S3_GW_PPROF`/`S3_GW_METRICS` environment variables.
|
2021-08-23 19:06:26 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
## YAML file and environment variables
|
2021-08-23 19:06:26 +00:00
|
|
|
|
2022-04-13 16:56:58 +00:00
|
|
|
Example of a YAML configuration file: [.yaml-example](/config/config.yaml)
|
2022-04-06 14:31:32 +00:00
|
|
|
Examples of environment variables: [.env-example](/config/config.env).
|
2021-08-23 19:06:26 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
A path to a configuration file can be specified with `--config` parameter:
|
2021-08-18 19:18:49 +00:00
|
|
|
|
2022-04-06 14:31:32 +00:00
|
|
|
```shell
|
|
|
|
$ neofs-s3-gw --config your-config.yaml
|
2021-08-18 19:18:49 +00:00
|
|
|
```
|
2022-04-06 14:31:32 +00:00
|
|
|
|
2022-04-13 16:56:58 +00:00
|
|
|
Parameters of the following groups can be configured via a `.yaml` file or environment variables only:
|
2022-04-06 14:31:32 +00:00
|
|
|
1. logging -- logging level
|
|
|
|
2. caching -- lifetime and size for each cache
|
|
|
|
3. notifications
|
|
|
|
4. CORS
|
|
|
|
5. default policy of placing containers in NeoFS
|
|
|
|
|
|
|
|
### Notifications
|
|
|
|
|
|
|
|
You can turn on notifications about successful completions of basic operations, and the gateway will send notifications
|
|
|
|
via NATS JetStream.
|
|
|
|
|
|
|
|
To enable notifications you need:
|
|
|
|
1. to configure the NATS server with JetStream
|
|
|
|
2. to specify NATS parameters for the S3 GW. It's ***necessary*** to define a values of `nats.enable` or
|
|
|
|
`S3_GW_NATS_ENABLED` as `True`
|
|
|
|
3. to configure notifications in a bucket
|
|
|
|
|