[#217] Add rest-gw service

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-09-21 13:26:19 +03:00 committed by Alex Vanin
parent 446bbb6a56
commit 4217506ab7
8 changed files with 141 additions and 0 deletions

4
.env
View file

@ -29,6 +29,10 @@ NATS_IMAGE=nats
HTTP_GW_VERSION=0.24.0
HTTP_GW_IMAGE=nspccdev/neofs-http-gw
# REST Gate
REST_GW_VERSION=0.4.0
REST_GW_IMAGE=nspccdev/neofs-rest-gw
# S3 Gate
S3_GW_VERSION=0.24.0
S3_GW_IMAGE=nspccdev/neofs-s3-gw

View file

@ -2,4 +2,5 @@
# Will start from top to bottom and stop in reverse
http_gate
s3_gate
rest_gate
coredns

70
docs/rest_gate.md Normal file
View file

@ -0,0 +1,70 @@
# REST Gateway
REST Gateway to access data in NeoFS using REST.
Source code and more information can be found in [project's GitHub repository](https://github.com/nspcc-dev/neofs-rest-gw)
## .env settings
### REST_GW_VERSION=0.4.0
Image version label to use for containers.
If you want to use locally built image, just set its label here.
Instead of pulling from DockerHub, the local image will be used.
### REST_GW_IMAGE=nspccdev/neofs-rest-gw
Image label prefix to use for containers.
## Usage example
- List container for specific owner:
```shell
$ curl http://rest.neofs.devenv:8090/v1/containers?ownerId=NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM | jq
{
"containers": [
{
"attributes": [
{
"key": "Timestamp",
"value": "1663755230"
}
],
"basicAcl": "fbfbfff",
"cannedAcl": "eacl-public-read-write",
"containerId": "BKcAvz8awKKy9NGsGKi1Hoxxu9AjTGvjKMNMQamvdLmX",
"containerName": "",
"ownerId": "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM",
"placementPolicy": "REP 1 IN X\nCBF 1\nSELECT 1 FROM * AS X",
"version": "v2.13"
}
],
"size": 1
}
```
- Get container info:
```shell
$ curl http://rest.neofs.devenv:8090/v1/containers/BKcAvz8awKKy9NGsGKi1Hoxxu9AjTGvjKMNMQamvdLmX | jq
{
"attributes": [
{
"key": "Timestamp",
"value": "1663755230"
}
],
"basicAcl": "fbfbfff",
"cannedAcl": "eacl-public-read-write",
"containerId": "BKcAvz8awKKy9NGsGKi1Hoxxu9AjTGvjKMNMQamvdLmX",
"containerName": "",
"ownerId": "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM",
"placementPolicy": "REP 1 IN X\nCBF 1\nSELECT 1 FROM * AS X",
"version": "v2.13"
}
```
See all available routes http://rest.neofs.devenv:8090/v1/docs

1
services/rest_gate/.env Symbolic link
View file

@ -0,0 +1 @@
../../.env

View file

@ -0,0 +1 @@
IPV4_PREFIX.83 rest.LOCAL_DOMAIN

View file

@ -0,0 +1 @@
../../.int_test.env

View file

@ -0,0 +1,33 @@
---
version: "2.4"
services:
rest_gate:
image: ${REST_GW_IMAGE}:${REST_GW_VERSION}
domainname: ${LOCAL_DOMAIN}
hostname: rest
container_name: rest_gate
restart: on-failure
networks:
rest_gate_int:
internet:
ipv4_address: ${IPV4_PREFIX}.83
volumes:
- ./wallet.json:/wallet.json
- ./../../vendor/hosts:/etc/hosts
stop_signal: SIGKILL
env_file: [ ".env", ".int_test.env" ]
environment:
- REST_GW_WALLET_PATH=/wallet.json
- REST_GW_WALLET_PASSPHRASE=one
- REST_GW_LISTEN_ADDRESS=0.0.0.0:8090
- REST_GW_PEERS_0_ADDRESS=s01.${LOCAL_DOMAIN}:8080
- REST_GW_PEERS_1_ADDRESS=s02.${LOCAL_DOMAIN}:8080
- REST_GW_PEERS_2_ADDRESS=s03.${LOCAL_DOMAIN}:8080
- REST_GW_PEERS_3_ADDRESS=s04.${LOCAL_DOMAIN}:8080
networks:
rest_gate_int:
internet:
external: true
name: basenet_internet

View file

@ -0,0 +1,30 @@
{
"version": "3.0",
"accounts": [
{
"address": "NPFCqWHfi9ixCJRu7DABRbVfXRbkSEr9Vo",
"key": "6PYTAGjdaeicUDPqGv9mmgwb9kTwimWJJmmfNqJSDGH9qM79zSRcL9oHiB",
"label": "REST Gateway",
"contract": {
"script": "DCECcuPzZCZ2VyDsm2jKEOMnU6xEWO2bF1dvOvBWTDFYB1ZBVuezJw==",
"parameters": [
{
"name": "parameter0",
"type": "Signature"
}
],
"deployed": false
},
"lock": false,
"isDefault": false
}
],
"scrypt": {
"n": 16384,
"r": 8,
"p": 8
},
"extra": {
"Tokens": null
}
}