Giter Site home page Giter Site logo

kirillovdenis / neofs-rest-gw Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nspcc-dev/neofs-rest-gw

0.0 0.0 0.0 630 KB

NeoFS REST Gateway for using NeoFS via REST API

License: GNU General Public License v3.0

Shell 2.32% Go 94.19% Makefile 2.85% HTML 0.28% Dockerfile 0.35%

neofs-rest-gw's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.