Skip to content

Commit

Permalink
Improve provision_s3 script documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
emnoor-reef committed Nov 4, 2024
1 parent c64ad95 commit ebc1234
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,11 @@ curl -sSfL https://github.com/backend-developers-ltd/ComputeHorde/raw/master/val
```

Replace `PROMPTS_BUCKET` and `ANSWERS_BUCKET` with the names of the S3 buckets you want to use for prompts and answers respectively. It will automatically create a dedicated user, assign permissions policy for created buckets, and add an access key, displaying it at the end so it can be copied to the validator env file. If you don't want to create a user and prefer to handle permissions manually, just skip the `--create-user` option.

At the end of the script, it will show the values for `S3_BUCKET_NAME_PROMPTS`, `S3_BUCKET_NAME_ANSWERS`.
If you used `--create-user` flag, it will also show the values for `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
You have to copy these variables in your validator `.env` file and restart your validator.

> [!WARNING]
> If you did not use `--create-user`, you still need to provide `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` in your validator .env file.
> In that case, you will have to manually generate the credentials.
11 changes: 8 additions & 3 deletions validator/provision_s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ EOF
aws iam attach-user-policy --user-name "$username" --policy-arn "arn:aws:iam::$(aws sts get-caller-identity --query Account --output text):policy/$policy_name" --no-cli-pager

echo "User created successfully. Here are the access credentials:"
echo "Access Key ID: $access_key_id"
echo "Secret Access Key: $secret_access_key"
echo "Please save these credentials securely. You won't be able to retrieve the secret key again."
echo "AWS_ACCESS_KEY_ID=$access_key_id"
echo "AWS_SECRET_ACCESS_KEY=$secret_access_key"
echo
echo "Add these credentials in your validator .env file. You won't be able to retrieve the secret key again."
}

create_bucket "$PROMPTS_BUCKET"
Expand All @@ -132,3 +133,7 @@ create_bucket "$ANSWERS_BUCKET"
if $CREATE_USER; then
create_user_and_access
fi

echo "Add the bucket info in your validator .env file:"
echo "S3_BUCKET_NAME_PROMPTS=$PROMPTS_BUCKET"
echo "S3_BUCKET_NAME_ANSWERS=$ANSWERS_BUCKET"

0 comments on commit ebc1234

Please sign in to comment.