rustfs icon indicating copy to clipboard operation
rustfs copied to clipboard

feat(config): add automatic bucket creation on startup (Issue #1027)

Open jackulau opened this issue 3 weeks ago • 5 comments

This PR implements automatic bucket creation on server startup, addressing Issue #1027.

Changes

  • Config: Added --default-buckets CLI argument with RUSTFS_DEFAULT_BUCKETS env var
  • Startup: Buckets are created during server initialization before metadata system starts

Usage

# Environment variable
RUSTFS_DEFAULT_BUCKETS=data,logs,backup rustfs /data

# CLI argument
rustfs --default-buckets "data,logs,backup" /data

Features

- Validates bucket names using existing check_valid_bucket_name_strict()
- Gracefully handles existing buckets (logs info, continues)
- Invalid bucket names are skipped with warning
- Does not fail startup on errors

Verified with cargo clippy and cargo test -p rustfs.

Closes #1027

jackulau avatar Dec 07 '25 07:12 jackulau

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 07 '25 07:12 CLAassistant

Hey @Jack-GitHub12 ,

Thank you for your contribution!

loverustfs avatar Dec 07 '25 07:12 loverustfs

@jackulau Please improve, Thank You!

houseme avatar Dec 07 '25 09:12 houseme

I've reviewed the image, and i noticed that the automated bucket creation is being performed using mc.

A much better solution would be to avoid placing core functionality like this directly within RustFS.

Implementing automatic creation within the core codebase is neither secure nor reasonable. This feature should instead be handled by third-party tooling or a mirror/wrapper application, rather than residing inside the core RustFS library itself.

myrust-go avatar Dec 07 '25 12:12 myrust-go

Hey @jackulau ,

Thank you for your contribution!

What are your thoughts on @myrust-go opinion?

loverustfs avatar Dec 07 '25 13:12 loverustfs