[#45] Add Makefile targets to register wallet files in FrostFS ID

This is required in frostfs-node since AIO 1.6.0

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2024-09-17 14:19:44 +03:00
parent e1b048c013
commit 0438608a3e
3 changed files with 30 additions and 9 deletions

View file

@ -63,11 +63,19 @@ clean: down
# Generate S3 credentials # Generate S3 credentials
s3cred: s3cred:
@docker exec aio /usr/bin/issue-creds.sh @docker exec aio /usr/bin/issue-creds.sh s3
# Generate S3 credentials based on imported wallets # Generate S3 credentials based on imported wallets
s3cred-custom: s3cred-custom:
@docker exec aio /usr/bin/issue-creds.sh $(wallet) @docker exec aio /usr/bin/issue-creds.sh s3 $(wallet)
# Register user-wallet.json in FrostFS ID contract
cred:
@docker exec aio /usr/bin/issue-creds.sh native
# Register custom wallet in FrostFS ID contract
cred-custom:
@docker exec aio /usr/bin/issue-creds.sh native $(wallet)
enable-oracle: enable-oracle:
@docker exec aio neo-go contract invokefunction -r http://localhost:30333 \ @docker exec aio neo-go contract invokefunction -r http://localhost:30333 \

View file

@ -291,13 +291,23 @@ wallet successfully created, file location is /wallets/new-wallet.json
## frostfs-cli interface ## frostfs-cli interface
### Native credentials
To use wallet file, it should be register in FrostFS ID contract and have
policies to perform FrostFS operations.
Use `make cred` to register `s3-gw/user-wallet.json`. For custom wallets from
`wallet` dir, use `make cred-custom wallet=wallet1.json`.
These commands are similar to `make s3cred` and `make s3cred-custom`.
### Create container with frostfs-cli ### Create container with frostfs-cli
``` sh ``` sh
$ frostfs-cli -r localhost:8080 -w /config/user-wallet.json \ $ frostfs-cli -r localhost:8080 -w s3-gw/user-wallet.json \
--address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \ --address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \
container create \ container create \
--policy "REP 1" --basic-acl public-read-write --await --policy "REP 1" --await
container ID: GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 container ID: GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46
awaiting... awaiting...
container has been persisted on sidechain container has been persisted on sidechain
@ -306,7 +316,7 @@ container has been persisted on sidechain
### Put an object with frostfs-cli ### Put an object with frostfs-cli
``` sh ``` sh
$ frostfs-cli -r localhost:8080 -w /config/user-wallet.json \ $ frostfs-cli -r localhost:8080 -w s3-gw/user-wallet.json \
--address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \ --address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \
object put \ object put \
--cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \ --cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \
@ -319,7 +329,7 @@ $ frostfs-cli -r localhost:8080 -w /config/user-wallet.json \
### Get and object with frostfs-cli ### Get and object with frostfs-cli
``` sh ``` sh
$ frostfs-cli -r localhost:8080 -w /config/user-wallet.json \ $ frostfs-cli -r localhost:8080 -w s3-gw/user-wallet.json \
--address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \ --address NWeByJPgNC97F83hTUnSbnZSBKaFvk5HNw \
object get \ object get \
--cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \ --cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \

View file

@ -17,8 +17,8 @@ issueAWS() {
} }
S3_GATE_PUBLIC_KEY=$(neo-go wallet dump-keys -w /config/s3-gw-wallet.json | tail -1) S3_GATE_PUBLIC_KEY=$(neo-go wallet dump-keys -w /config/s3-gw-wallet.json | tail -1)
WALLET_PATH=/wallets/$1 WALLET_PATH=/wallets/$2
if [[ -z "$1" ]]; then if [[ -z "$2" ]]; then
WALLET_PATH=/config/user-wallet.json WALLET_PATH=/config/user-wallet.json
fi fi
@ -29,4 +29,7 @@ USERNAME=$(echo $WALLET_PATH | md5sum | cut -d' ' -f1)
if [ ! -e $WALLET_CACHE/$USERNAME ]; then if [ ! -e $WALLET_CACHE/$USERNAME ]; then
initUser initUser
fi fi
if [ $1 == "s3" ]; then
issueAWS issueAWS
fi