FrostFS REST Gateway for using FrostFS via REST API
Find a file
Liza 2f41bf229b [#9] Add Issue Template
Add bug report and feature request templates

Signed-off-by: Liza <e.chichindaeva@yadro.com>
2023-03-23 12:24:24 +03:00
.github [#9] Add Issue Template 2023-03-23 12:24:24 +03:00
cmd/frostfs-rest-gw Rename package name 2023-03-13 09:47:55 +03:00
config [#2] Rename internals 2022-12-21 13:46:10 +03:00
docs [#2] Update docs 2022-12-21 11:49:19 +03:00
gen Rename package name 2023-03-13 09:47:55 +03:00
handlers Rename package name 2023-03-13 09:47:55 +03:00
internal/util Rename package name 2023-03-13 09:47:55 +03:00
metrics Rename package name 2023-03-13 09:47:55 +03:00
spec [#2] Update spec 2022-12-21 11:49:19 +03:00
static/docs [#2] Update docs 2022-12-21 11:49:19 +03:00
templates [#83] Update flag bindings 2022-12-02 16:50:22 +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 [#71] Update changelog 2022-11-10 11:30:06 +03:00
CONTRIBUTING.md [#2] Update docs 2022-12-21 11:49:19 +03:00
Dockerfile [#2] Update building 2022-12-21 11:49:19 +03:00
Dockerfile.dirty [#2] Update building 2022-12-21 11:49:19 +03:00
go.mod Rename package name 2023-03-13 09:47:55 +03:00
go.sum Rename package name 2023-03-13 09:47:55 +03:00
LICENSE [#1] Add basic structure and operations 2022-04-29 10:20:37 +03:00
Makefile [#2] Update building 2022-12-21 11:49:19 +03:00
README.md Rename package name 2023-03-13 09:47:55 +03:00
VERSION Release v0.5.0 2022-10-07 16:03:49 +03:00

FrostFS

REST server to interact with FrostFS.


Report

frostfs-rest-gw

FrostFS REST Gateway bridges FrostFS 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://git.frostfs.info/TrueCloudLab/frostfs-rest-gw

Then run make to build bin/frostfs-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 FrostFS node, so to access FrostFS 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_POOL_PEERS_<N>_ADDRESS and REST_GW_POOL_PEERS_<N>_WEIGHT environment variables (the gate supports multiple FrostFS nodes with weighted load balancing).

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

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

$ frostfs-rest-gw -p 192.168.130.72:8080
$ REST_GW_POOL_PEERS_0_ADDRESS=192.168.130.72:8080 frostfs-rest-gw

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

$ frostfs-rest-gw -p grpc://192.168.130.72:8080
$ REST_GW_POOL_PEERS_0_ADDRESS=grpcs://192.168.130.72:8080 frostfs-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.

$ frostfs-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.