mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
The binary is s3 and the product is Hanzo S3; the rest of the tree now says so too. - Environment: WEED_* and SEAWEEDFS_* are S3_*, no aliases. fla9's flag prefix is S3, matching viper's existing "s3" prefix, so the S3_S3_SSE_* names mini.go exports are the ones viper reads (WEED_S3_SSE_KEK was never seen once viper moved to "s3"). - Java and Hadoop: packages, fs.hanzofs.* keys and the hanzofs:// scheme under the hanzofs namespace the protos already declare; classes take a neutral Filer prefix and file names match them again (the earlier pass left Seas3*.java holding Seaweed* classes). Client, hdfs3, examples, s3copier, random_access and the Spark tests compile. - Helm chart: helpers are hanzo.*, values live under global.s3; the chart renders and lints, which it did not before. - Terraform: the s3.service.tftpl reference matches the file; 12/12 render tests pass. Config paths point at /etc/hanzo, which the binary reads. - loadtest.pb.go regenerated from loadtest.proto. - Upstream logo, sponsor images and unreferenced diagrams removed from note/. Kept: NOTICE attribution, LICENSE, the erasure-coding fixture s3/storage/erasure_coding/1.dat (test bytes), and unmaintained/ and third_party/ (vendored). No on-disk format, wire protocol or metadata key changed. Co-authored-by: Hanzo Dev <[email protected]>
133 lines
3.4 KiB
Bash
Executable File
133 lines
3.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Enable FIPS 140-3 mode by default (Go 1.24+)
|
|
# To disable: docker run -e GODEBUG=fips140=off ...
|
|
export GODEBUG="${GODEBUG:+$GODEBUG,}fips140=on"
|
|
|
|
# Fix permissions for mounted volumes
|
|
# If /data is mounted from host, it might have different ownership
|
|
# Fix this by ensuring hanzo user owns the directory
|
|
if [ "$(id -u)" = "0" ]; then
|
|
# Running as root, check and fix permissions if needed
|
|
S3_UID=$(id -u hanzo)
|
|
S3_GID=$(id -g hanzo)
|
|
|
|
# Verify hanzo user and group exist
|
|
if [ -z "$S3_UID" ] || [ -z "$S3_GID" ]; then
|
|
echo "Error: 'hanzo' user or group not found. Cannot fix permissions." >&2
|
|
exit 1
|
|
fi
|
|
|
|
DATA_UID=$(stat -c '%u' /data 2>/dev/null)
|
|
DATA_GID=$(stat -c '%g' /data 2>/dev/null)
|
|
|
|
# Only run chown -R if ownership doesn't already match (avoids expensive
|
|
# recursive chown on subsequent starts, and is a no-op on OpenShift when
|
|
# fsGroup has already set correct ownership on the PVC).
|
|
if [ "$DATA_UID" != "$S3_UID" ] || [ "$DATA_GID" != "$S3_GID" ]; then
|
|
echo "Fixing /data ownership for hanzo user (uid=$S3_UID, gid=$S3_GID)"
|
|
if ! chown -R hanzo:hanzo /data; then
|
|
echo "Warning: Failed to change ownership of /data. This may cause permission errors." >&2
|
|
echo "If /data is read-only or has mount issues, the application may fail to start." >&2
|
|
fi
|
|
fi
|
|
|
|
# Use su-exec to drop privileges and run as hanzo user
|
|
exec su-exec hanzo "$0" "$@"
|
|
fi
|
|
|
|
isArgPassed() {
|
|
# Match both `-flag` and `--flag` (and their `=value` forms): the Go fla9
|
|
# library accepts both, and users may pick either form on the CLI.
|
|
arg="$1"
|
|
argWithEqualSign="$1="
|
|
argDouble="-$1"
|
|
argDoubleWithEqualSign="-$1="
|
|
shift
|
|
while [ $# -gt 0 ]; do
|
|
passedArg="$1"
|
|
shift
|
|
case $passedArg in
|
|
"$arg"|"$argDouble")
|
|
return 0
|
|
;;
|
|
"$argWithEqualSign"*|"$argDoubleWithEqualSign"*)
|
|
return 0
|
|
;;
|
|
esac
|
|
done
|
|
return 1
|
|
}
|
|
|
|
case "$1" in
|
|
|
|
'master')
|
|
ARGS="-mdir=/data -volumeSizeLimitMB=1024"
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true master $ARGS $@
|
|
;;
|
|
|
|
'volume')
|
|
ARGS="-dir=/data -max=0"
|
|
if isArgPassed "-max" "$@"; then
|
|
ARGS="-dir=/data"
|
|
fi
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true volume $ARGS $@
|
|
;;
|
|
|
|
'volume-rust')
|
|
ARGS="-dir /data -max 0"
|
|
if isArgPassed "-max" "$@"; then
|
|
ARGS="-dir /data"
|
|
fi
|
|
shift
|
|
if [ ! -s /usr/bin/s3-volume ]; then
|
|
echo "Error: Rust volume server is not available on this platform ($(uname -m))." >&2
|
|
echo "Use 'volume' for the Go volume server instead." >&2
|
|
exit 1
|
|
fi
|
|
exec /usr/bin/s3-volume $ARGS $@
|
|
;;
|
|
|
|
'server')
|
|
ARGS="-dir=/data -volume.max=0 -master.volumeSizeLimitMB=1024"
|
|
if isArgPassed "-volume.max" "$@"; then
|
|
ARGS="-dir=/data -master.volumeSizeLimitMB=1024"
|
|
fi
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true server $ARGS $@
|
|
;;
|
|
|
|
'mini')
|
|
ARGS="-dir=/data"
|
|
if isArgPassed "-dir" "$@"; then
|
|
ARGS=""
|
|
fi
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true mini $ARGS $@
|
|
;;
|
|
|
|
'filer')
|
|
ARGS=""
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true filer $ARGS $@
|
|
;;
|
|
|
|
's3')
|
|
ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
|
|
shift
|
|
exec /usr/bin/s3 -logtostderr=true s3 $ARGS $@
|
|
;;
|
|
|
|
'shell')
|
|
ARGS="-cluster=$SHELL_CLUSTER -filer=$SHELL_FILER -filerGroup=$SHELL_FILER_GROUP -master=$SHELL_MASTER -options=$SHELL_OPTIONS"
|
|
shift
|
|
exec echo "$@" | /usr/bin/s3 -logtostderr=true shell $ARGS
|
|
;;
|
|
|
|
*)
|
|
exec /usr/bin/s3 $@
|
|
;;
|
|
esac
|