fix(start): enable persistent storage mode when --persist is set#9
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
floci start --persist <dir>did not actually persist anything — emulator state was lost on every restart.The
--persistflag only bind-mounted the host directory to/app/data, but the server defaults toFLOCI_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
--persistis 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):StartCommand(AWS)FLOCI_STORAGE_MODE=persistentGcpStartCommandFLOCI_GCP_STORAGE_MODE=persistentAzStartCommandFLOCI_AZ_STORAGE_MODE=persistentVerification
mvn test).stop --removefollowed bystart --persist <same dir>. The bucket, object content, and DynamoDB item all survived the restart. Confirmed the container receivesFLOCI_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.