-
Notifications
You must be signed in to change notification settings - Fork 870
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(blob-store): Add authentication
Signed-off-by: Diwank Singh Tomer <[email protected]>
- Loading branch information
Showing
6 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/s3.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# syntax=docker/dockerfile:1 | ||
# check=error=true | ||
|
||
FROM chrislusf/seaweedfs | ||
|
||
# Install envsubst | ||
ENV BUILD_DEPS="gettext" \ | ||
RUNTIME_DEPS="libintl" | ||
|
||
RUN set -x && \ | ||
apk add --update $RUNTIME_DEPS && \ | ||
apk add --virtual build_deps $BUILD_DEPS && \ | ||
cp /usr/bin/envsubst /usr/local/bin/envsubst && \ | ||
apk del build_deps | ||
|
||
# Expected environment variables: | ||
# - S3_ACCESS_KEY | ||
# - S3_SECRET_KEY | ||
|
||
COPY s3.json.template /s3.json.template | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Check the environment variables | ||
for var_name in S3_ACCESS_KEY S3_SECRET_KEY | ||
do | ||
if [ -z "`eval echo \\\$$var_name`" ]; then | ||
echo "Error: Environment variable '$var_name' is not set." | ||
exit 1 | ||
fi | ||
done | ||
|
||
# Generate the s3.json configuration file | ||
envsubst < /s3.json.template > /s3.json | ||
|
||
if [ "$DEBUG" = "true" ]; then | ||
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' | ||
echo '@@@ Careful: Debug mode is enabled. @@@' | ||
echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' | ||
|
||
echo 'Printing s3.json:' | ||
cat /s3.json | ||
fi | ||
|
||
# Forward all arguments to the seaweedfs binary | ||
exec weed server -s3.config=/s3.json "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"identities": [ | ||
{ | ||
"name": "anonymous", | ||
"actions": [ | ||
"Read" | ||
] | ||
}, | ||
{ | ||
"name": "julep", | ||
"credentials": [ | ||
{ | ||
"accessKey": "${S3_ACCESS_KEY}", | ||
"secretKey": "${S3_SECRET_KEY}" | ||
} | ||
], | ||
"actions": [ | ||
"Admin", | ||
"Read", | ||
"List", | ||
"Tagging", | ||
"Write" | ||
] | ||
} | ||
], | ||
"accounts": [ | ||
{ | ||
"id" : "julep", | ||
"displayName": "Julep", | ||
"emailAddress": "[email protected]" | ||
} | ||
] | ||
} |