Skip to content

Commit beb35bc

Browse files
ci: improve RustFS startup diagnostics and readiness
Expose server logs, retry bucket initialization, verify native downloads, and disable the unused console. Generated-by: Codex
1 parent 7ce5eec commit beb35bc

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

‎ci/scripts/start_object_store.sh‎

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ OBJECT_STORE_CONTAINER_NAME="${OBJECT_STORE_CONTAINER_NAME:-iceberg-object-store
2525
OBJECT_STORE_ACCESS_KEY="${AWS_ACCESS_KEY_ID:-admin}"
2626
OBJECT_STORE_SECRET_KEY="${AWS_SECRET_ACCESS_KEY:-password}"
2727
OBJECT_STORE_PORT="${OBJECT_STORE_PORT:-9000}"
28-
OBJECT_STORE_CONSOLE_PORT="${OBJECT_STORE_CONSOLE_PORT:-9001}"
2928
OBJECT_STORE_BUCKET="${OBJECT_STORE_BUCKET:-iceberg-test}"
3029
OBJECT_STORE_ENDPOINT="${AWS_ENDPOINT_URL:-http://127.0.0.1:${OBJECT_STORE_PORT}}"
3130
OBJECT_STORE_DIR="${RUNNER_TEMP:-/tmp}/iceberg-object-store"
3231

3332
wait_for_object_store() {
3433
for ((attempt = 0; attempt < 60; attempt++)); do
35-
if curl -fsS --connect-timeout 1 --max-time 2 "${OBJECT_STORE_ENDPOINT}/health/ready" >/dev/null; then
34+
if curl -fs --connect-timeout 1 --max-time 2 "${OBJECT_STORE_ENDPOINT}/health/ready" >/dev/null; then
3635
return 0
3736
fi
3837
sleep 1
@@ -52,10 +51,11 @@ start_object_store_docker() {
5251
fi
5352

5453
docker run -d --name "${OBJECT_STORE_CONTAINER_NAME}" \
55-
-p "${OBJECT_STORE_PORT}:9000" -p "${OBJECT_STORE_CONSOLE_PORT}:9001" \
54+
-p "${OBJECT_STORE_PORT}:9000" \
5655
-e "RUSTFS_ACCESS_KEY=${OBJECT_STORE_ACCESS_KEY}" \
5756
-e "RUSTFS_SECRET_KEY=${OBJECT_STORE_SECRET_KEY}" \
58-
-e RUSTFS_CONSOLE_ENABLE=true \
57+
-e RUSTFS_CONSOLE_ENABLE=false \
58+
-e RUSTFS_OBS_LOG_STDOUT_ENABLED=true \
5959
"${OBJECT_STORE_IMAGE}" /data
6060
}
6161

@@ -76,17 +76,27 @@ start_object_store_native() {
7676
;;
7777
esac
7878

79+
local archive="rustfs-${platform}-v${OBJECT_STORE_VERSION}.zip"
80+
local release_url="https://github.com/rustfs/rustfs/releases/download/${OBJECT_STORE_VERSION}"
7981
mkdir -p "${OBJECT_STORE_DIR}/data"
8082
curl -fsSL --retry 3 \
81-
"https://github.com/rustfs/rustfs/releases/download/${OBJECT_STORE_VERSION}/rustfs-${platform}-v${OBJECT_STORE_VERSION}.zip" \
82-
-o "${OBJECT_STORE_DIR}/rustfs.zip"
83-
unzip -o "${OBJECT_STORE_DIR}/rustfs.zip" -d "${OBJECT_STORE_DIR}"
83+
"${release_url}/${archive}" -o "${OBJECT_STORE_DIR}/${archive}"
84+
curl -fsSL --retry 3 "${release_url}/SHA256SUMS" -o "${OBJECT_STORE_DIR}/SHA256SUMS"
85+
(
86+
cd "${OBJECT_STORE_DIR}"
87+
grep -F " ${archive}" SHA256SUMS > rustfs.sha256
88+
if command -v sha256sum >/dev/null 2>&1; then
89+
sha256sum --check rustfs.sha256
90+
else
91+
shasum -a 256 --check rustfs.sha256
92+
fi
93+
)
94+
unzip -o "${OBJECT_STORE_DIR}/${archive}" -d "${OBJECT_STORE_DIR}"
8495
chmod +x "${OBJECT_STORE_DIR}/${binary}"
8596
RUSTFS_ACCESS_KEY="${OBJECT_STORE_ACCESS_KEY}" \
8697
RUSTFS_SECRET_KEY="${OBJECT_STORE_SECRET_KEY}" \
8798
RUSTFS_ADDRESS=":${OBJECT_STORE_PORT}" \
88-
RUSTFS_CONSOLE_ADDRESS=":${OBJECT_STORE_CONSOLE_PORT}" \
89-
RUSTFS_CONSOLE_ENABLE=true \
99+
RUSTFS_CONSOLE_ENABLE=false \
90100
"${OBJECT_STORE_DIR}/${binary}" "${OBJECT_STORE_DIR}/data" \
91101
>"${OBJECT_STORE_DIR}/rustfs.log" 2>&1 &
92102
}
@@ -95,8 +105,16 @@ create_bucket() {
95105
export AWS_ACCESS_KEY_ID="${OBJECT_STORE_ACCESS_KEY}"
96106
export AWS_SECRET_ACCESS_KEY="${OBJECT_STORE_SECRET_KEY}"
97107
export AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
98-
aws --endpoint-url "${OBJECT_STORE_ENDPOINT}" s3api head-bucket --bucket "${OBJECT_STORE_BUCKET}" || \
99-
aws --endpoint-url "${OBJECT_STORE_ENDPOINT}" s3api create-bucket --bucket "${OBJECT_STORE_BUCKET}"
108+
# The health endpoint can pass before S3 requests are accepted.
109+
for ((attempt = 0; attempt < 5; attempt++)); do
110+
if aws --endpoint-url "${OBJECT_STORE_ENDPOINT}" s3api head-bucket --bucket "${OBJECT_STORE_BUCKET}" >/dev/null 2>&1 || \
111+
aws --endpoint-url "${OBJECT_STORE_ENDPOINT}" s3api create-bucket --bucket "${OBJECT_STORE_BUCKET}"; then
112+
return 0
113+
fi
114+
sleep 2
115+
done
116+
echo "Failed to create bucket ${OBJECT_STORE_BUCKET} at ${OBJECT_STORE_ENDPOINT}." >&2
117+
return 1
100118
}
101119

102120
if ! command -v aws >/dev/null 2>&1; then

0 commit comments

Comments
 (0)