Skip to content

Commit 6af6ee0

Browse files
authored
fix(start): enable persistent storage mode when --persist is set (#9)
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.
1 parent 529d857 commit 6af6ee0

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/io/floci/cli/commands/StartCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public Integer call() {
8484
args.addAll(DockerClient.dockerSocketRunArgs());
8585
if (persistDir != null) {
8686
args.addAll(List.of("-v", persistDir + ":/app/data"));
87+
// The server defaults to in-memory storage; enable persistent mode so
88+
// state is actually written to the mounted directory and survives restarts.
89+
args.addAll(List.of("-e", "FLOCI_STORAGE_MODE=persistent"));
8790
}
8891
if (services != null && !services.isBlank()) {
8992
args.addAll(List.of("-e", "FLOCI_SERVICES=" + services));

src/main/java/io/floci/cli/commands/az/AzStartCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public Integer call() {
7979
args.addAll(DockerClient.dockerSocketRunArgs());
8080
if (persistDir != null) {
8181
args.addAll(List.of("-v", persistDir + ":/app/data"));
82+
// The server defaults to in-memory storage; enable persistent mode so
83+
// state is actually written to the mounted directory and survives restarts.
84+
args.addAll(List.of("-e", "FLOCI_AZ_STORAGE_MODE=persistent"));
8285
}
8386
if (services != null && !services.isBlank()) {
8487
args.addAll(List.of("-e", "FLOCI_AZ_SERVICES=" + services));

src/main/java/io/floci/cli/commands/gcp/GcpStartCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public Integer call() {
7979
args.addAll(DockerClient.dockerSocketRunArgs());
8080
if (persistDir != null) {
8181
args.addAll(List.of("-v", persistDir + ":/app/data"));
82+
// The server defaults to in-memory storage; enable persistent mode so
83+
// state is actually written to the mounted directory and survives restarts.
84+
args.addAll(List.of("-e", "FLOCI_GCP_STORAGE_MODE=persistent"));
8285
}
8386
if (services != null && !services.isBlank()) {
8487
args.addAll(List.of("-e", "FLOCI_GCP_SERVICES=" + services));

0 commit comments

Comments
 (0)