Files
rustfs/scripts/run.sh
2025-05-29 13:24:56 +08:00

89 lines
3.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash -e
# check ./rustfs/static/index.html not exists
if [ ! -f ./rustfs/static/index.html ]; then
echo "Downloading rustfs-console-latest.zip"
# download rustfs-console-latest.zip do not show log
curl -s -L "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" -o tempfile.zip && unzip -q -o tempfile.zip -d ./rustfs/static && rm tempfile.zip
fi
if [ -z "$SKIP_BUILD" ]; then
cargo build -p rustfs --bins
fi
current_dir=$(pwd)
# mkdir -p ./target/volume/test
mkdir -p ./target/volume/test{0..4}
if [ -z "$RUST_LOG" ]; then
export RUST_BACKTRACE=1
# export RUST_LOG="rustfs=debug,ecstore=debug,s3s=debug,iam=debug"
export RUST_LOG="rustfs=info,ecstore=info,s3s=info,iam=info,rustfs-obs=info"
fi
# export RUSTFS_ERASURE_SET_DRIVE_COUNT=5
# export RUSTFS_STORAGE_CLASS_INLINE_BLOCK="512 KB"
export RUSTFS_VOLUMES="./target/volume/test{0...4}"
# export RUSTFS_VOLUMES="./target/volume/test"
export RUSTFS_ADDRESS=":9000"
export RUSTFS_CONSOLE_ENABLE=true
export RUSTFS_CONSOLE_ADDRESS=":9002"
# export RUSTFS_SERVER_DOMAINS="localhost:9000"
# HTTPS 证书目录
# export RUSTFS_TLS_PATH="./deploy/certs"
# 具体路径修改为配置文件真实路径obs.example.toml 仅供参考 其中 `RUSTFS_OBS_CONFIG` 和下面变量二选一
# export RUSTFS_OBS_CONFIG="./deploy/config/obs.toml"
# 如下变量需要必须参数都有值才可以,以及会覆盖配置文件中的值
export RUSTFS_OBSERVABILITY_ENDPOINT=http://localhost:4317
#export RUSTFS_OBSERVABILITY_ENDPOINT=http://localhost:4317
#export RUSTFS_OBSERVABILITY_USE_STDOUT=false
#export RUSTFS_OBSERVABILITY_SAMPLE_RATIO=2.0
#export RUSTFS_OBSERVABILITY_METER_INTERVAL=31
#export RUSTFS_OBSERVABILITY_SERVICE_NAME=rustfs
#export RUSTFS_OBSERVABILITY_SERVICE_VERSION=0.1.0
#export RUSTFS_OBSERVABILITY_ENVIRONMENT=develop
#export RUSTFS_OBSERVABILITY_LOGGER_LEVEL=debug
#export RUSTFS_OBSERVABILITY_LOCAL_LOGGING_ENABLED=true
#
#export RUSTFS__SINKS_0__type=File
#export RUSTFS__SINKS_0__path=./deploy/logs/rustfs.log
#export RUSTFS__SINKS_0__buffer_size=12
#export RUSTFS__SINKS_0__flush_interval_ms=1000
#export RUSTFS__SINKS_0__flush_threshold=100
#
#export RUSTFS__SINKS_1__type=Kakfa
#export RUSTFS__SINKS_1__brokers=localhost:9092
#export RUSTFS__SINKS_1__topic=logs
#export RUSTFS__SINKS_1__batch_size=100
#export RUSTFS__SINKS_1__batch_timeout_ms=1000
#
#export RUSTFS__SINKS_2__type=Webhook
#export RUSTFS__SINKS_2__endpoint=http://localhost:8080/webhook
#export RUSTFS__SINKS_2__auth_token=you-auth-token
#export RUSTFS__SINKS_2__batch_size=100
#export RUSTFS__SINKS_2__batch_timeout_ms=1000
#
#export RUSTFS__LOGGER__QUEUE_CAPACITY=10
export OTEL_INSTRUMENTATION_NAME="rustfs"
export OTEL_INSTRUMENTATION_VERSION="0.1.1"
export OTEL_INSTRUMENTATION_SCHEMA_URL="https://opentelemetry.io/schemas/1.31.0"
export OTEL_INSTRUMENTATION_ATTRIBUTES="env=production"
# 事件消息配置
#export RUSTFS_EVENT_CONFIG="./deploy/config/event.example.toml"
if [ -n "$1" ]; then
export RUSTFS_VOLUMES="$1"
fi
# 启动 webhook 服务器
#cargo run --example webhook -p rustfs-event-notifier &
# 启动主服务
cargo run --bin rustfs