From 744713a0190a19c869fdd912a7358637f68fdb9a Mon Sep 17 00:00:00 2001 From: Nikita Zinkevich Date: Thu, 9 Jan 2025 11:23:42 +0300 Subject: [PATCH] [#98] s3_gate: Fix custom user wallets folder creation during compose up Make custom wallets volume to point to the `wallets` directory in the project's root. Fix defaults for issuing credentials. Signed-off-by: Nikita Zinkevich --- README.md | 9 +++++---- services/s3_gate/docker-compose.yml | 6 ++---- services/s3_gate/issue-creds.sh | 5 ++++- services/s3_gate/prepare.mk | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8e4b714..6cb8580 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Registers user wallet and issues s3 credentials. Usage and default parameter values: ```sh -make s3cred [password=""] [contract_password=s3] [wallet=/user_wallet.json] [gate_public_key=0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06bf] +make s3cred [password=s3] [contract_password=s3] [wallet=""] [gate_public_key=0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06bf] ``` As soon as the storage node is in the network map (see above) you can generate S3 @@ -159,8 +159,9 @@ $ make s3cred "container_id": "EXArWh8x1zeHG3851s1RtoCo7dowxF6rhLGA15nbMffT" } ``` -Running without any parameters will result in defaults which are based on the private key from -`/user-wallet.json` file and `/wallet.json` contract wallet. +Running without any parameters results in defaults which are based on the private key from +`/wallet.json` gate wallet both as a user and as a contract wallet. +If `wallet` parameter is set, gate searches custom user wallet file in `/wallets` directory. Now let's configure an S3 client (AWS CLI will be used as example): @@ -172,7 +173,7 @@ Default region name []: us-east-1 Default output format []: json ``` -If you need to create credentials for different users, put user wallets to `wallets` dir and specify them via `wallet` parameter. +If you need to create credentials for different users, put user wallet to `wallets` dir and specify it via `wallet` parameter. Pass wallet password in `password` parameter if it's not default. The same is for `contract_wallet` and `gate_public_key` params. ```sh diff --git a/services/s3_gate/docker-compose.yml b/services/s3_gate/docker-compose.yml index f7fc28d..3c1f9f6 100644 --- a/services/s3_gate/docker-compose.yml +++ b/services/s3_gate/docker-compose.yml @@ -14,10 +14,8 @@ services: volumes: # Gate wallet - ./wallet.json:/wallet.json - # Custom user wallets - - ./wallets:/wallets - # Default user wallet - - ./../../wallets/wallet.json:/wallets/wallet.json + # Folder for custom user wallets + - ./../../wallets/:/wallets/ - ./tls.key:/tls.key - ./tls.crt:/tls.crt - ./../../vendor/hosts:/etc/hosts diff --git a/services/s3_gate/issue-creds.sh b/services/s3_gate/issue-creds.sh index e2355f8..1caa40c 100755 --- a/services/s3_gate/issue-creds.sh +++ b/services/s3_gate/issue-creds.sh @@ -18,13 +18,16 @@ issueCreds() { set -e +# custom user wallet WALLET_PATH=/wallets/$2 if [[ -z "$2" ]]; then - WALLET_PATH=/wallets/wallet.json + # use gate wallet + WALLET_PATH=/wallet.json fi S3_GATE_PUBLIC_KEY=$3 if [[ -z "$3" ]]; then + # use gate wallet's public key S3_GATE_PUBLIC_KEY=0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06bf fi diff --git a/services/s3_gate/prepare.mk b/services/s3_gate/prepare.mk index c97add8..e39f90a 100644 --- a/services/s3_gate/prepare.mk +++ b/services/s3_gate/prepare.mk @@ -1,6 +1,6 @@ .PHONY: s3cred register -password?= +password?=s3 contract_password?=s3 gate_public_key?= wallet?=