Skip to content

Commit bb0dacd

Browse files
authored
Drop HTTP, update REST (#75)
2 parents 662efc4 + cbe79f5 commit bb0dacd

File tree

10 files changed

+27
-105
lines changed

10 files changed

+27
-105
lines changed

.env

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
NEOGO_VERSION=0.105.1
22
AIO_VERSION=0.40.1
3-
HTTPGW_VERSION=0.28.0
4-
RESTGW_VERSION=0.7.1
3+
RESTGW_VERSION=0.8.2

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,5 @@ jobs:
7171
NEOGO_HUB_TAG=${{ steps.setver.outputs.NEOGO_VERSION }}
7272
NEOFS_HUB_IMAGE=nspccdev/neofs
7373
NEOFS_HUB_TAG=${{ steps.setver.outputs.AIO_VERSION }}
74-
NEOFS_HTTP_HUB_TAG=${{ steps.setver.outputs.HTTPGW_VERSION }}
7574
NEOFS_REST_HUB_TAG=${{ steps.setver.outputs.RESTGW_VERSION }}
7675
tags: nspccdev/neofs-aio:${{ steps.setver.outputs.AIO_VERSION }}${{ steps.setlatest.outputs.latest }}

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ ARG NEOFS_HUB_IMAGE=nspccdev/neofs
22
ARG NEOFS_HUB_TAG=latest
33
ARG NEOGO_HUB_IMAGE=nspccdev/neo-go
44
ARG NEOGO_HUB_TAG=latest
5-
ARG NEOFS_HTTP_HUB_TAG=latest
65
ARG NEOFS_REST_HUB_TAG=latest
76

87
FROM ${NEOGO_HUB_IMAGE}:${NEOGO_HUB_TAG} as neo-go
98
FROM ${NEOFS_HUB_IMAGE}-cli:${NEOFS_HUB_TAG} as neofs-cli
109
FROM ${NEOFS_HUB_IMAGE}-ir:${NEOFS_HUB_TAG} as neofs-ir
1110
FROM ${NEOFS_HUB_IMAGE}-storage:${NEOFS_HUB_TAG} as neofs-storage
1211
FROM ${NEOFS_HUB_IMAGE}-adm:${NEOFS_HUB_TAG} as neofs-adm
13-
FROM ${NEOFS_HUB_IMAGE}-http-gw:${NEOFS_HTTP_HUB_TAG} as neofs-http-gw
1412
FROM ${NEOFS_HUB_IMAGE}-rest-gw:${NEOFS_REST_HUB_TAG} as neofs-rest-gw
1513

1614
# Executable image
@@ -31,22 +29,19 @@ COPY --from=neofs-cli /bin/neofs-cli /usr/bin/neofs-cli
3129
COPY --from=neofs-ir /bin/neofs-ir /usr/bin/neofs-ir
3230
COPY --from=neofs-storage /bin/neofs-node /usr/bin/neofs-node
3331
COPY --from=neofs-adm /bin/neofs-adm /usr/bin/neofs-adm
34-
COPY --from=neofs-http-gw /bin/neofs-http-gw /usr/bin/neofs-http-gw
3532
COPY --from=neofs-rest-gw /bin/neofs-rest-gw /usr/bin/neofs-rest-gw
3633

3734
COPY ./sn/cli-cfg.yaml /config/cli-cfg-sn.yaml
3835
COPY ./sn/wallet.json /config/wallet-sn.json
3936
COPY ./sn/config.yaml /config/config-sn.yaml
40-
COPY ./http/wallet.json /config/wallet-http.json
4137
COPY ./rest-gw/wallet.json /config/wallet-rest.json
4238
COPY ./ir/cli-cfg.yaml /config/cli-cfg-ir.yaml
4339
COPY ./ir/config.yaml /config/config-ir.yaml
4440
COPY ./ir/node-wallet.json /config/node-wallet.json
4541
COPY ./ir/node-config.yaml /config/node-config.yaml
4642
COPY ./bin/ /config/bin
4743

48-
COPY ./http/http.env /config/http.env
4944
COPY ./rest-gw/rest.env /config/rest.env
50-
RUN sed -ri 's,^([^=]+)=(.*)+$,\1=${\1-\2},' /config/http.env /config/rest.env
45+
RUN sed -ri 's,^([^=]+)=(.*)+$,\1=${\1-\2},' /config/rest.env
5146

5247
ENTRYPOINT ["/config/bin/init-aio.sh"]

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ image-aio:
2121
--build-arg NEOFS_HUB_TAG=$(AIO_VERSION) \
2222
--build-arg NEOGO_HUB_IMAGE=$(NEOGO_HUB_IMAGE) \
2323
--build-arg NEOGO_HUB_TAG=$(NEOGO_VERSION) \
24-
--build-arg NEOFS_HTTP_HUB_TAG=$(HTTPGW_VERSION) \
2524
--build-arg NEOFS_REST_HUB_TAG=$(RESTGW_VERSION) \
2625
-f Dockerfile \
2726
-t $(AIO_IMAGE):$(AIO_VERSION) .
@@ -35,6 +34,5 @@ version:
3534
@echo $(VERSION)
3635
@echo "neofs-node: $(AIO_VERSION)"
3736
@echo "neo-go: $(NEOGO_VERSION)"
38-
@echo "neofs-http-gw: $(HTTPGW_VERSION)"
3937
@echo "neofs-rest-gw: $(RESTGW_VERSION)"
4038

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ First, you need to create a container to store your object. Because there is
8888
only one storage node in the All-in-One setup, you can only have one replica of
8989
your data. Let's create a container using `neofs-cli`. Container creation
9090
requires on-chain operations, so it may take up to 5-10 seconds to complete.
91-
Here we use the pre-generated key of the HTTP Gateway for simplicity.
91+
Here we use the pre-generated key of the REST Gateway for simplicity.
9292

9393
Password for wallet is `one`.
9494

9595
``` sh
96-
$ neofs-cli -r localhost:8080 -w http/wallet.json \
96+
$ neofs-cli -r localhost:8080 -w rest-gw/wallet.json \
9797
--address NPFCqWHfi9ixCJRu7DABRbVfXRbkSEr9Vo \
9898
container create \
9999
--policy "REP 1" --basic-acl public-read --await
@@ -126,7 +126,7 @@ $ curl http://localhost:8090/v1/containers/GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ
126126
## Put an object with neofs-cli
127127

128128
``` sh
129-
$ neofs-cli -r localhost:8080 -w http/wallet.json \
129+
$ neofs-cli -r localhost:8080 -w rest-gw/wallet.json \
130130
--address NPFCqWHfi9ixCJRu7DABRbVfXRbkSEr9Vo \
131131
object put \
132132
--cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \
@@ -136,19 +136,21 @@ $ neofs-cli -r localhost:8080 -w http/wallet.json \
136136
CID: GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46
137137
```
138138

139-
## Put an object via http
139+
## Put an object via REST
140140

141141
``` sh
142142
$ curl -F 'file=@cat.jpg;filename=cat.jpg' \
143-
http://localhost:8081/upload/ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo
143+
http://localhost:8090/v1/upload/ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo
144144
{
145145
"object_id": "B4J4L61X6zFcz5fcmZaCJJNZfFFTE6uT4pz7dqP87m6m",
146146
"container_id": "ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo"
147147
}
148148
```
149149

150-
The full description of HTTP API supported by HTTP Gateway can be found in
151-
[neofs-http-gw repository](https://github.com/nspcc-dev/neofs-http-gw).
150+
The full description of REST API supported by NeoFS REST gateway can be found in
151+
its OpenAPI specification ([http://localhost:8090](http://localhost:8090) shows
152+
it), for more info take a look at [neofs-rest-gw repository](https://github.com/nspcc-dev/neofs-rest-gw)
153+
as well.
152154

153155
## Get an object via nginx
154156

@@ -167,7 +169,7 @@ x-container-id: ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo
167169
Content-Disposition: inline; filename=cat.jpg
168170
```
169171

170-
Having nginx as a reverse proxy behind NeoFS HTTP Gateway allows you to tune the
172+
Having nginx as a reverse proxy for NeoFS REST Gateway allows you to tune the
171173
behaviour according to your application needs. For example, you can set the
172174
rewriting rules to use the pre-configured container for a specific domain to
173175
simplify the URL. Together with `FilePath` attribute in objects it would give
@@ -179,19 +181,20 @@ For example:
179181
location / {
180182
set $cid ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo;
181183
182-
rewrite '^(/[0-9a-zA-Z\-]{43,44})$' /get/$cid/$1 break;
183-
rewrite '^/$' /get_by_attribute/$cid/FileName/index.html break;
184-
rewrite '^/([^/]*)$' /get_by_attribute/$cid/FileName/$1 break;
185-
rewrite '^(/.*)$' /get_by_attribute/$cid/FilePath/$1 break;
184+
rewrite '^(/v1/.*)$' $1 break;
185+
rewrite '^(/[0-9a-zA-Z\-]{43,44})$' /v1/get/$cid/$1 break;
186+
rewrite '^/$' /v1/get_by_attribute/$cid/FileName/index.html break;
187+
rewrite '^/([^/]*)$' /v1/get_by_attribute/$cid/FileName/$1 break;
188+
rewrite '^(/.*)$' /v1/get_by_attribute/$cid/FilePath/$1 break;
186189
187-
proxy_pass http://localhost:8081;
190+
proxy_pass http://localhost:8083;
188191
```
189192

190193
This allow us to upload objects with `FilePath` attached and get them as if they
191194
were put in a directory structure of the regular web server.
192195

193196
``` sh
194-
curl -F 'file=@cat.jpg;filename=cat.jpg' -H "X-Attribute-FilePath: /pic/cat.jpg" http://localhost:8081/upload/ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo
197+
curl -F 'file=@cat.jpg;filename=cat.jpg' -H "X-Attribute-FilePath: /pic/cat.jpg" http://localhost:8090/v1/upload/ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo
195198
{
196199
"object_id": "4s3T11pktSfSxRfjpJ7BsiuYr2hi7po6nUQ333SPYkWF",
197200
"container_id": "ADsJLhJhLQRGMufFin56PCTtPK1BiSxbg6bDmdgSB1Mo"

bin/init-aio.sh

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
## When we start AIO as a separate container or part of a docker-compose. In this case we move background tasks to foreground.
44
## Otherwise we may use AIO container like a base for own container, thus we need just run all AIO services, before our service.
55
IS_PURE_START="true"
6-
## if "true" http service will be started
7-
IS_START_HTTP="true"
86
## if "true" rest service will be started
97
IS_START_REST="true"
108

@@ -13,9 +11,6 @@ while getopts d:h:r: option; do
1311
d)
1412
IS_PURE_START="$OPTARG"
1513
;;
16-
h)
17-
IS_START_HTTP="$OPTARG"
18-
;;
1914
r)
2015
IS_START_REST="$OPTARG"
2116
;;
@@ -41,9 +36,8 @@ ${NEOGO} wallet nep17 transfer \
4136
--from ${CONSADDR} --force \
4237
--to ${SNADDR} \
4338
--token GAS \
44-
--amount 100
45-
46-
sleep 2 # https://github.com/nspcc-dev/neo-go/issues/3244
39+
--amount 100 \
40+
--await
4741

4842
set -m
4943
/usr/bin/neofs-node --config /config/config-sn.yaml &
@@ -60,16 +54,6 @@ set -a
6054

6155
./bin/config.sh ContainerFee 0 && ./bin/config.sh ContainerAliasFee 0
6256

63-
if [ $IS_START_HTTP = "true" ]; then
64-
. /config/http.env
65-
/usr/bin/neofs-http-gw &
66-
67-
while [[ "$(curl -s -o /dev/null -w %{http_code} $HTTP_GW_SERVER_0_ADDRESS)" != "404" ]];
68-
do
69-
sleep 1;
70-
done
71-
fi
72-
7357
if [ $IS_START_REST = "true" ]; then
7458
. /config/rest.env
7559
/usr/bin/neofs-rest-gw &

docker-compose.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ services:
1010
restart: always
1111
stop_signal: SIGKILL
1212
env_file:
13-
- "./http/http.env"
1413
- "./rest-gw/rest.env"
1514
volumes:
1615
- ./sn/cli-cfg.yaml:/config/cli-cfg-sn.yaml
1716
- ./sn/wallet.json:/config/wallet-sn.json
1817
- ./sn/config.yaml:/config/config-sn.yaml
19-
- ./http/wallet.json:/config/wallet-http.json
2018
- ./rest-gw/wallet.json:/config/wallet-rest.json
2119
- ./ir/cli-cfg.yaml:/config/cli-cfg-ir.yaml
2220
- ./ir/config.yaml:/config/config-ir.yaml
@@ -25,7 +23,6 @@ services:
2523
- "30333:30333" # RPC
2624
- "8080:8080" # NeoFS API RPC
2725
- "16513:16513" # Control service
28-
- "8081:8081" # HTTP Gateway endpoint
2926
- "8090:8090" # REST Gateway endpoint
3027

3128
nginx_gw:
@@ -36,7 +33,7 @@ services:
3633
restart: on-failure
3734
stop_signal: SIGKILL
3835
volumes:
39-
- ./http/nginx.conf:/etc/nginx/nginx.conf
36+
- ./rest-gw/nginx.conf:/etc/nginx/nginx.conf
4037
- cache:/cache
4138
ports:
4239
- "8082:8082" # nginx gateway endpoint

http/http.env

Lines changed: 0 additions & 23 deletions
This file was deleted.

http/wallet.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

http/nginx.conf renamed to rest-gw/nginx.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ http {
2727
return 204;
2828
}
2929

30-
rewrite '^(/[0-9a-zA-Z]{43,44}/[0-9a-zA-Z\-]{43,44})$' /get/$1 break;
31-
rewrite '^/([0-9a-zA-Z]{43,44})/$' /get_by_attribute/$1/FileName/index.html break;
32-
rewrite '^/([0-9a-zA-Z]{43,44})/([^/]*)$' /get_by_attribute/$1/FileName/$2 break;
33-
rewrite '^/([0-9a-zA-Z]{43,44})/(.*)$' /get_by_attribute/$1/FilePath/$2 break;
30+
rewrite '^(/[0-9a-zA-Z]{43,44}/[0-9a-zA-Z\-]{43,44})$' /v1/get/$1 break;
31+
rewrite '^/([0-9a-zA-Z]{43,44})/$' /v1/get_by_attribute/$1/FileName/index.html break;
32+
rewrite '^/([0-9a-zA-Z]{43,44})/([^/]*)$' /v1/get_by_attribute/$1/FileName/$2 break;
33+
rewrite '^/([0-9a-zA-Z]{43,44})/(.*)$' /v1/get_by_attribute/$1/FilePath/$2 break;
3434

35-
proxy_pass http://aio:8081;
35+
proxy_pass http://aio:8090;
3636
proxy_http_version 1.1;
3737
proxy_intercept_errors on;
3838
proxy_buffering on;

0 commit comments

Comments
 (0)