Skip to content

fix(start): enable persistent storage mode when --persist is set#9

Merged
hectorvent merged 1 commit into
mainfrom
fix/persist-storage-mode
Jun 21, 2026
Merged

fix(start): enable persistent storage mode when --persist is set#9
hectorvent merged 1 commit into
mainfrom
fix/persist-storage-mode

Conversation

@hectorvent

Copy link
Copy Markdown
Contributor

Problem

floci start --persist <dir> did not actually persist anything — emulator state was lost on every restart.

The --persist flag only bind-mounted the host directory to /app/data, but the server defaults to FLOCI_STORAGE_MODE=memory (see storage docs). In memory mode the server never writes to the mounted directory, so the mount was effectively a no-op.

Fix

When --persist is provided, also set the storage mode env var so state is written to the mounted host directory. Each cloud uses its own prefix (confirmed from the actual image env defaults):

Command Variable added
StartCommand (AWS) FLOCI_STORAGE_MODE=persistent
GcpStartCommand FLOCI_GCP_STORAGE_MODE=persistent
AzStartCommand FLOCI_AZ_STORAGE_MODE=persistent

Verification

  • All 33 unit tests pass (mvn test).
  • End-to-end through the real CLI: created an S3 bucket + object and a DynamoDB table + item, then ran stop --remove followed by start --persist <same dir>. The bucket, object content, and DynamoDB item all survived the restart. Confirmed the container receives FLOCI_STORAGE_MODE=persistent.

Notes

This builds on #8 (which fixed the mount target to /app/data); that fix mounted the correct path but persistence still required the storage mode to be enabled.

The server defaults to FLOCI_STORAGE_MODE=memory, so the --persist
bind mount to /app/data was a no-op: state was never written to disk
and did not survive a container restart.

Set FLOCI_STORAGE_MODE=persistent (per-cloud prefixed variant for GCP
and Azure) whenever --persist is provided, so emulator state is written
to the mounted host directory and survives restarts. Verified
end-to-end with S3 and DynamoDB across a stop --remove + start cycle.
@hectorvent hectorvent merged commit 6af6ee0 into main Jun 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant