Repository navigation
feat(docs): add migration script for switching between RustFS and AWS S3 - #809
Conversation
There was a problem hiding this comment.
Caution
The --to s3 path reports success but leaves the API talking to the RustFS endpoint: the empty STORAGE_ENDPOINT / STORAGE_PUBLIC_URL values this script writes are replaced by the compose defaults, so uploads fail and downloads 404 after the migration.
Approach: sound — it reuses the mc-in-a-throwaway-container pattern the existing MinIO migration docs already use, copies without touching the source, and keeps a restorable .env backup; the problems are in how the switched config reaches the API, not in the copy/verify design.
Reviewed changes
scripts/migrate-storage.sh— new 425-line migration script that mirrors the bucket withmc, verifies object count and size, rewritesSTORAGE_*in.env, restartsapi, and rolls back on failure.docs/deployment/README.md— new "Switching between RustFS and AWS S3" section documenting both directions,--dry-run, and the--scale rustfs=0follow-up.
ℹ️ The new script has no automated check
.github/workflows/scripts-pr-ci.yml runs shellcheck and end-to-end smoke tests for the other install/upgrade scripts, but neither its paths: filter nor its shellcheck file list includes scripts/migrate-storage.sh, so a script that rewrites .env and moves production objects gets no CI signal at all. Running shellcheck locally also exits 1 today, so enrolling it needs a couple of annotations first.
Technical details
# scripts CI doesn't cover migrate-storage.sh
## Affected sites
- `.github/workflows/scripts-pr-ci.yml:5-17` — `paths:` filter lists install/upgrade/skills scripts, not `migrate-storage.sh`
- `.github/workflows/scripts-pr-ci.yml:56` — `shellcheck ... scripts/install.sh scripts/upgrade.sh scripts/install-paca-skills.sh`
- `scripts/migrate-storage.sh:310,313,320,343,352` — five `SC2016` (info) warnings for the intentional container-side `$VAR` expansions; shellcheck exits 1 on them
## Required outcome
- At least lint coverage for the new script, with the intentional single-quoted expansions explicitly disabled.
## Suggested approach
- Add `scripts/migrate-storage.sh` to the workflow's `paths:` and to the shellcheck invocation, plus `# shellcheck disable=SC2016` above the `mc_run` call sites (or on the helper) so the existing job stays green. A small smoke test in the style of the existing upgrade.sh storage tests would be valuable given it rewrites `.env`.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
…d update CI workflow
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — the --to s3 fix writes explicit endpoint/public-URL values instead of relying on empty strings surviving Compose interpolation, so it sidesteps the ${VAR:-default} substitution trap without touching the compose file.
Reviewed changes
- Enrolled the script in CI — added to the
scripts-pr-cipaths:filter and shellcheck list, with a file-wideSC2016disable for the intentional container-side expansions; the lint job passes. - Docs now fetch the script — the section curls
migrate-storage.shinto the install directory instead of assuming ascripts/folder that a standard install never creates. --to s3writes real storage values —STORAGE_ENDPOINTandSTORAGE_PUBLIC_URLare set to the regional endpoint, so Compose no longer substitutes the RustFS defaults and the presigned-URL rewrite is a no-op.- Second mirror pass — when the API is left running, a second
mc mirrorruns before the switch, and the warning now states the residual upload window accurately. - Secrets leave the docker argv — credentials are exported and passed as
-e NAME, so they no longer appear inps.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Summary
Adds
scripts/migrate-storage.sh, which moves Paca's object storage between the bundled RustFS and AWS S3 (or any S3-compatible service), in either direction. Documented indocs/deployment/README.mdunder "Switching between RustFS and AWS S3".How it works
STORAGE_*values from.envas the source; refuses if the provider already matches--to.PLUGINS_STORE=s3) withmcin a throwaway container on the compose network, since the RustFS port isn't published.apiduring the copy by default so nothing is uploaded mid-migration (PACA_STOP_API=noto skip)..env, rewritesSTORAGE_*, restartsapi. On any failure.envis restored andapirestarted with the old config.--dry-runpreviews the copy;PACA_YES=1runs unattended.Not covered
apiis restarted; the script prints the follow-up (--scale rustfs=0after moving to S3) rather than doing it.Testing
Both directions run end to end against throwaway containers (a second RustFS container standing in for S3), including a key with spaces, verification,
.envrewrite,apirestart and the.envrollback on failure. Not yet tried against real AWS S3.