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
Denis Kirillov d9798cbce8 [#1] Add global logging middleware
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-04-29 10:20:37 +03:00
.github [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
cmd/neofs-rest-gw [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
config [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
gen [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
handlers [#1] Add global logging middleware 2022-04-29 10:20:37 +03:00
spec [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
templates [#1] Add basic structure and operations 2022-04-29 10:20:37 +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
Dockerfile [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
Dockerfile.dirty [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
go.mod [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
go.sum [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
LICENSE [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
Makefile [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
README.md [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
VERSION [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00

NeoFS

NeoFS is a decentralized distributed object storage integrated with the NEO Blockchain.


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
  • jq
  • git
  • curl

To build neofs-rest-gw call make the cloned repository (the binary will end up in bin/neofs-rest-gw).

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 examples for details.