FrostFS REST Gateway for using FrostFS via REST API
This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Alex Vanin 360e80b949 [#63] Fail build on dirty version
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2022-09-06 13:44:52 +03:00
.github [#63] Fail build on dirty version 2022-09-06 13:44:52 +03:00
cmd/neofs-rest-gw [#61] Fix tests 2022-08-30 16:45:50 +03:00
config [#45] Add documentation for defaults parameters 2022-08-12 09:57:28 +03:00
docs [#45] Add documentation for defaults parameters 2022-08-12 09:57:28 +03:00
gen [#54] Support keys in eacl 2022-08-30 10:00:41 +03:00
handlers [#62] Add expiration header tests 2022-09-01 17:24:35 +04:00
internal/util [#54] Support keys in eacl 2022-08-30 10:00:41 +03:00
metrics [#52] Use gauge instead of counter for metrics 2022-08-25 10:48:21 +03:00
spec [#54] Support keys in eacl 2022-08-30 10:00:41 +03:00
static/docs [#15] Update doc url 2022-07-12 11:36:32 +03:00
templates [#44] Expose metrics 2022-08-11 18:14:30 +03:00
.gitignore [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
.golangci.yml [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
CHANGELOG.md [#62] Fix expiration epoch calculation 2022-09-01 17:24:35 +04:00
CONTRIBUTING.md [#42] Add contribution guide 2022-08-11 15:53:29 +03:00
Dockerfile [#61] Update go version to 1.19 2022-08-30 16:45:50 +03:00
Dockerfile.dirty [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
go.mod [#58] Update SDK 2022-08-29 15:03:50 +03:00
go.sum [#58] Update SDK 2022-08-29 15:03:50 +03:00
LICENSE [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
Makefile [#63] Fix commit abbrev length in version 2022-09-06 13:44:52 +03:00
README.md [#46] Add building in docker 2022-08-15 13:01:18 +03:00
VERSION Release v0.4.0 2022-08-30 12:12:45 +03:00

NeoFS

REST server to interact with NeoFS.


Report GitHub release (latest SemVer) License

neofs-rest-gw

NeoFS REST Gateway bridges NeoFS internal protocol and REST API server.

Installation

Building

Before building make sure you have the following tools:

  • go
  • make
  • git
  • curl
  • docker

First clone this repository:

$ git clone https://github.com/nspcc-dev/neofs-rest-gw

Then run make to build bin/neofs-rest-gw binary:

$ make

Or you can build it using docker:

$ make docker/all

Generate go-swagger boilerplate code

If you change the spec file you have to re-generate go-swagger server code.

You have several approaches:

  1. Run make. It automatically downloads swagger and generates boilerplate.
$ make
  1. Generate code separately:
$ make generate-server

Or using docker:

$ make docker/generate-server

Other targets

Notable make targets:

dep             Check and ensure dependencies
image           Build clean docker image
image-dirty     Build dirty docker image with host-built binaries
formats         Run all code formatters
lint            Run linters
version         Show current version
generate-server Generate boilerplate by spec

Docker

Or you can also use a Docker image provided for released (and occasionally unreleased) versions of gateway (:latest points to the latest stable release).

Execution

REST gateway itself is not a NeoFS node, so to access NeoFS it uses node's gRPC interface and you need to provide some node that it will connect to. This can be done either via -p parameter or via REST_GW_PEERS_<N>_ADDRESS and REST_GW_PEERS_<N>_WEIGHT environment variables (the gate supports multiple NeoFS nodes with weighted load balancing).

If you're launching REST gateway in bundle with neofs-dev-env, you can get an IP address of the node in output of make hosts command (with s0*.neofs.devenv name).

These two commands are functionally equivalent, they run the gate with one backend node (and otherwise default settings):

$ neofs-rest-gw -p 192.168.130.72:8080
$ REST_GW_PEERS_0_ADDRESS=192.168.130.72:8080 neofs-rest-gw

It's also possible to specify uri scheme (grpc or grpcs) when using -p:

$ neofs-rest-gw -p grpc://192.168.130.72:8080
$ REST_GW_PEERS_0_ADDRESS=grpcs://192.168.130.72:8080 neofs-rest-gw

Configuration

In general, everything available as CLI parameter can also be specified via environment variables, so they're not specifically mentioned in most cases (see --help also). If you prefer a config file you can use it in yaml format. See config and defaults for example.

$ neofs-rest-gw --config config.yaml

Docs

You can see additional docs and swagger specification using the following url (suppose you ran rest-gw on localhost:8090):

Contributing

Feel free to contribute to this project after reading the contributing guidelines.

Before starting to work on a certain topic, create a new issue first, describing the feature/topic you are going to implement.

License

This project is licensed under the GNU GPL v3 License - see the LICENSE file for details.