A small, deployable S3-compatible object storage server written in MoonBit.
git clone https://github.com/zzSmall6/moon-s3-server.git
cd moon-s3-server
moon build cmd/main --target native
MOON_S3_ROOT=./data MOON_S3_LISTEN=127.0.0.1:9000 \
_build/native/debug/build/cmd/main/main.execurl --noproxy '*' -X PUT http://127.0.0.1:9000/demo
printf 'Hello MoonBit!\n' > hello.txt
curl --noproxy '*' -X PUT --data-binary @hello.txt http://127.0.0.1:9000/demo/hello.txt
curl --noproxy '*' http://127.0.0.1:9000/demo/hello.txt
curl --noproxy '*' 'http://127.0.0.1:9000/demo?list-type=2'| Environment variable | Default | Purpose |
|---|---|---|
| MOON_S3_CONFIG | Unset | JSON configuration file; environment variables override file values |
| MOON_S3_ROOT | ./data | Data directory |
| MOON_S3_LISTEN | 127.0.0.1:9000 | Listen address |
| MOON_S3_ACCESS_KEY | Unset | Enable SigV4 authentication |
| MOON_S3_SECRET_KEY | Unset | Secret paired with the access key |
| MOON_S3_CORS_ORIGIN | * | Fallback origin for buckets without CORS rules |
| MOON_S3_MULTIPART_TTL_SECONDS | 604800 | Upload lifetime from creation; 1–31536000 seconds |
| MOON_S3_WEBHOOK_URL | Unset | Enable object-event delivery to an HTTP(S) endpoint |
| MOON_S3_WEBHOOK_SECRET | Unset | Sign webhook bodies with HMAC-SHA256 |
| MOON_S3_WEBHOOK_TIMEOUT_MS | 5000 | Callback timeout; 100–60000 milliseconds |
| MOON_S3_SHUTDOWN_TIMEOUT_MS | 10000 | Drain active requests on SIGINT/SIGTERM; 100–300000 milliseconds |
| MOON_S3_MAX_REQUEST_BYTES | 67108864 | Maximum buffered request body; 1–536870912 bytes |
| MOON_S3_MAX_BUFFERED_BYTES | 134217728 | Shared body budget; at least the per-request limit, up to 536870912 bytes |
| MOON_S3_MAX_CONNECTIONS | 128 | Maximum simultaneous connections; 1–4096 |
| MOON_S3_REQUEST_TIMEOUT_MS | 30000 | Header-read and request-handling deadlines; 100–3600000 ms |
python3 scripts/admin.py check --root ./data
python3 scripts/admin.py backup --root ./data --output ./backup.tar
python3 scripts/admin.py restore --archive ./backup.tar --root ./restored-datamoon test --target native
moon info && moon fmt
bash scripts/smoke.sh
for suite in auth list object presigned multipart storage copy admin cors version policy event cli console operations safety delete; do
python3 "scripts/${suite}_regression.py"
donepub(all) struct ParsedAuth {
access_key : String
date : String
region : String
service : String
signed_headers : String
signature : String
}fn signing_key(secret : StringView, date : StringView, region : StringView, service : StringView) -> FixedArray[Byte]fn verify_sigv4(http_method : StringView, canonical_uri : StringView, query : Array[QueryParam], signed_header_pairs : Array[(String, String)], payload_hash : StringView, authorization : StringView, access_key : StringView, secret_key : StringView) -> BoolInstall
Download zipA small, deployable S3-compatible object storage server written in MoonBit.