Skip to content

feat(elasticache): add an explicit shell-less backend path for Redis-compatible images - #8642

Merged
pgermosen merged 1 commit into
floci-io:mainfrom
murtazayusuf:feat/elasticache-backend-images
Nov 16, 2026
Merged

pgermosen merged 1 commit into
floci-io:mainfrom
murtazayusuf:feat/elasticache-backend-images

Conversation

@murtazayusuf

Copy link
Copy Markdown
Contributor

Summary

Closes #8209

ElastiCache starts its Redis/Valkey backend through the image's VALKEY_EXTRA_FLAGS hook and takes and restores snapshots with valkey-cli/redis-cli run inside the container (exec, DEBUG RELOAD). That only works for images built like valkey/valkey. An image with no shell and no CLI cannot be used as a backend, so this adds a second path for those, as agreed in the issue.

The path is chosen by a new setting, floci.services.elasticache.shell-less-backend (FLOCI_SERVICES_ELASTICACHE_SHELL_LESS_BACKEND). It is false by default and is never inferred from the image name, so which path runs is always the one the user configured. With the default, nothing changes: valkey/valkey still gets VALKEY_EXTRA_FLAGS and the CLI path, with --enable-debug-command local.

With shell-less-backend: true:

  • Server flags are passed as container arguments (--port 6379 --protected-mode no --loglevel verbose, plus the cluster-mode flags for a cluster-mode group) instead of VALKEY_EXTRA_FLAGS. The image's own default arguments are replaced, so the port and protected mode are stated explicitly.
  • CreateSnapshot runs SAVE and CONFIG GET dir / CONFIG GET dbfilename over the existing RESP connection to the backend, then reads the file out of the container with the Docker archive API. Nothing is executed inside the container.
  • CreateReplicationGroup with SnapshotName creates the container, puts the snapshot file in its data directory (the image's working directory, where a server started without --dir keeps its data), then starts it, so the server loads the file itself. There is no DEBUG RELOAD, and DEBUG is not enabled anywhere new. After start, Floci checks over RESP that the server's dir is the directory the file was placed in, so a server that reads somewhere else cannot look like a successful restore.
  • If the file cannot be placed, or the server cannot start with it, only the new container is removed and the create fails with InvalidSnapshotState. The replication group the snapshot came from and the snapshot are not touched.

A second setting, floci.services.elasticache.shell-less-backend-dbfilename (default dump.rdb), names the file the server loads at startup. A restore has to place the file before the server runs, so it cannot ask the server; a snapshot export uses what the server reports for dbfilename and falls back to this setting when the server reports nothing. KiviDB, for example, keeps dump.kdb and reports an empty dbfilename.

MemoryDB is not touched: it has its own container manager, which does not use any of the changed classes (it only shares RespLineReader, unchanged).

Small supporting changes: ContainerLifecycleManager.createAndStart(spec, beforeStart) (create, run a callback, start; removes the container if either step fails), and a read timeout argument on the package-private ValkeyClusterFormation.RespClient, so SAVE can wait longer than the 10 s default.

Docs: the setting is described in docs/services/elasticache.md (new section "Images with no shell or CLI", configuration table, snapshots paragraph), docs/configuration/environment-variables.md and docs/configuration/advanced/application-yml.md.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

No change to the ElastiCache wire protocol, request or response shapes: the setting only changes how the backend container is started and how its data is read and loaded. CreateSnapshot and CreateReplicationGroup with SnapshotName answer the same as before.

Testing

Run on an Ubuntu VM (Docker, Temurin/OpenJDK 25).

  • ElastiCacheShellLessContainerManagerTest (unit): flags as container arguments, normal and cluster mode; no VALKEY_EXTRA_FLAGS and no --enable-debug-command with the setting on; the default path still uses VALKEY_EXTRA_FLAGS and no arguments; a startup seed is refused with the setting off.
  • ElastiCacheShellLessSnapshotServiceTest (unit, container layer mocked): the snapshot goes to the start and never to restore; a start the snapshot cannot be loaded in rolls back only the new group and leaves the source group and snapshot; no daemon leaves nothing behind.
  • ElastiCacheShellLessBackendIntegrationTest (Docker-gated, skipped without a daemon) against the public KiviDB image ghcr.io/kividbio/kividb:v1.2.2, pinned by digest sha256:8853c7b1e73e604502fd584533440cb1205ae311fe805d520543b4e85a4b71e9, a distroless image with no shell: the test first checks that sh cannot be executed in it; arguments delivered; data through the proxy; snapshot export and restore (data written after the snapshot is absent from the restored group, --enable-debug-command not passed); group auth token enforced by the proxy; a user with an access string (on ~app:* -@all +get +set +ping) is refused SET other:key and FLUSHALL with the backend's -NOPERM reaching the client; a snapshot the server cannot load fails the start and leaves no container, source group and snapshot intact; deleting groups removes their containers.
  • ElastiCacheShellLessClusterIntegrationTest (Docker-gated): cluster-mode flags arrive as container arguments on every node, the cluster forms, slots are served and MOVED is returned, delete removes every node container. This one uses valkey/valkey:8 with the setting on, because KiviDB v1.2.2 does not accept --cluster-announce-client-ipv4, which Floci passes to every cluster-mode node.
  • The existing default-image tests are unchanged.

Results on the VM (Ubuntu 24.04, OpenJDK 25, Docker 29): ./mvnw test -Dtest="io.floci.aws.services.elasticache.**.*Test,*ElastiCache*Test,io.floci.aws.services.memorydb.**.*Test,io.floci.aws.core.common.docker.**.*Test" gave Tests run: 1300, Failures: 0, Errors: 0, Skipped: 3, BUILD SUCCESS. The 3 skips are the GPU and platform Docker tests in core.common.docker, which need hardware or an emulated platform. All the new tests above ran and passed, as did ElastiCacheIntegrationTest, ElastiCacheClusterIntegrationTest and ElastiCacheAclProxyIntegrationTest on the default image. ./mvnw checkstyle:check, make docs-check and make partition-check pass. A single ./mvnw test over the whole suite did not finish on a 4-vCPU, 16 GB machine: the Quarkus build ran out of heap (-Xmx6g) before the first reports, so CI's five shards remain the check for the rest.

Checklist

  • The ElastiCache, MemoryDB and Docker tests pass locally (the full suite is left to CI's shards, see Testing)
  • New or updated integration test added
  • Commit messages follow Conventional Commits
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

@github-actions

Copy link
Copy Markdown

🎉 Thanks for your first pull request to Floci!

Your CI checks need a maintainer to approve them before they run. That is GitHub's standard gate on first-time contributors, not a problem with your PR — so if the checks look like they are doing nothing, that is why. Once a maintainer approves, CI and the compatibility suite start automatically. Nothing is needed from you in the meantime.

While you wait, a couple of things that make review faster:

  • Link the issue this fixes with Closes #N in the description
  • Commits follow Conventional Commits (feat(s3): ..., fix(dynamodb): ...)
  • Behaviour changes come with a test — see CONTRIBUTING.md

Come join us in Slack — it is the fastest way to reach maintainers if you get stuck, or want feedback on an approach before investing more time in it.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add an explicit shell-less backend path for ElastiCache

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Add an opt-in backend path for Redis-compatible images without a shell or CLI.
• Export snapshots over RESP and Docker; restore them before server startup without enabling DEBUG.
• Preserve the default Valkey path and test startup, snapshots, cluster mode, authentication, and
 cleanup.
Diagram

graph TD
  Config["Backend settings"] --> Mode{"Backend path"}
  Mode -->|default| Legacy["Flags and CLI"] --> Backend["Redis backend"]
  Mode -->|shell-less| Args["Container arguments"] --> Backend
  Backend -->|SAVE and CONFIG| Resp["RESP client"] --> Archive["Docker archive"] --> Stored["Stored snapshot"]
  Stored -->|restore| Archive -->|file before start| Backend
Loading
High-Level Assessment

Keep the explicit opt-in path. It preserves existing Valkey behavior while reusing the RESP client and Docker archive facilities; a helper container with a CLI would add image and filesystem dependencies without serving shell-less images as directly.

Files changed (16) +1181 / -15

Enhancement (4) +232 / -15
ContainerLifecycleManager.javaAllow container setup before process startup +18/-0

Allow container setup before process startup

• Adds a create-and-start overload that runs a setup callback against the created container and removes it if setup or startup fails.

src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java

ElastiCacheService.javaSeed shell-less groups during backend startup +14/-2

Seed shell-less groups during backend startup

• Passes snapshot data to container startup in shell-less mode instead of restoring into a running server. Converts snapshot startup failures to InvalidSnapshotState while retaining provisioning rollback.

src/main/java/io/floci/aws/services/elasticache/ElastiCacheService.java

ElastiCacheContainerManager.javaAdd shell-free backend launch and snapshot handling +195/-12

Add shell-free backend launch and snapshot handling

• Selects container arguments or the existing Valkey environment hook, exports snapshots using RESP and Docker archives, and places restore files before startup. Checks readiness and the server's data directory for seeded backends.

src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java

ValkeyClusterFormation.javaPermit longer RESP reads for synchronous saves +5/-1

Permit longer RESP reads for synchronous saves

• Adds a configurable read-timeout constructor so snapshot SAVE can use a longer timeout without changing existing RESP callers.

src/main/java/io/floci/aws/services/elasticache/container/ValkeyClusterFormation.java

Tests (6) +876 / -0
ElastiCacheShellLessBackendIntegrationTest.javaExercise a shell-less image end to end +396/-0

Exercise a shell-less image end to end

• Tests startup and flags against a pinned image without a shell, snapshot export and restore, proxy authentication and ACLs, and container cleanup.

src/test/java/io/floci/aws/services/elasticache/ElastiCacheShellLessBackendIntegrationTest.java

ElastiCacheShellLessClusterIntegrationTest.javaVerify shell-less cluster-mode flags and routing +171/-0

Verify shell-less cluster-mode flags and routing

• Tests container arguments on cluster nodes, slot routing through the configuration endpoint, and deletion of node containers.

src/test/java/io/floci/aws/services/elasticache/ElastiCacheShellLessClusterIntegrationTest.java

ElastiCacheShellLessSnapshotServiceTest.javaTest snapshot seeding and service rollback +109/-0

Test snapshot seeding and service rollback

• Verifies that shell-less restores seed at startup rather than call the running-server restore path. Covers failure mapping, rollback, and preservation of the source group and snapshot.

src/test/java/io/floci/aws/services/elasticache/ElastiCacheShellLessSnapshotServiceTest.java

ShellLessBackendProfile.javaConfigure the distroless backend test profile +29/-0

Configure the distroless backend test profile

• Enables shell-less mode with a digest-pinned KiviDB image and its dump.kdb snapshot filename.

src/test/java/io/floci/aws/services/elasticache/ShellLessBackendProfile.java

ShellLessClusterProfile.javaConfigure shell-less cluster tests with Valkey +19/-0

Configure shell-less cluster tests with Valkey

• Enables container-argument mode with the default Valkey image to exercise cluster flags that the KiviDB fixture does not support.

src/test/java/io/floci/aws/services/elasticache/ShellLessClusterProfile.java

ElastiCacheShellLessContainerManagerTest.javaTest backend flag selection in the container manager +152/-0

Test backend flag selection in the container manager

• Checks shell-less server and cluster arguments, absence of DEBUG flags, preservation of the legacy hook, and startup-seeding restrictions.

src/test/java/io/floci/aws/services/elasticache/container/ElastiCacheShellLessContainerManagerTest.java

Documentation (3) +50 / -0
application-yml.mdShow shell-less backend YAML settings +2/-0

Show shell-less backend YAML settings

• Adds the opt-in switch and startup snapshot filename to the example configuration.

docs/configuration/advanced/application-yml.md

environment-variables.mdDocument shell-less backend environment variables +2/-0

Document shell-less backend environment variables

• Lists both environment variables, their defaults, and their roles in shell-free snapshot handling.

docs/configuration/environment-variables.md

elasticache.mdExplain shell-less images and snapshot behavior +46/-0

Explain shell-less images and snapshot behavior

• Describes explicit mode selection, container arguments, shell-free export and restore, and a KiviDB configuration example. Clarifies that MemoryDB is unaffected.

docs/services/elasticache.md

Other (3) +23 / -0
EmulatorConfig.javaDeclare backend mode and snapshot filename settings +21/-0

Declare backend mode and snapshot filename settings

• Adds a disabled-by-default shell-less switch and a configurable startup snapshot filename defaulting to dump.rdb.

src/main/java/io/floci/aws/config/EmulatorConfig.java

application.ymlKeep shell-less mode disabled by default +1/-0

Keep shell-less mode disabled by default

• Sets the application default to the existing Valkey backend path.

src/main/resources/application.yml

application.ymlDefault tests to the existing backend path +1/-0

Default tests to the existing backend path

• Sets shell-less mode to false for tests unless a test profile explicitly enables it.

src/test/resources/application.yml

@qodo-code-review

qodo-code-review Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Remote clients can bypass cache auth 🐞 Bug ⛨ Security
Description
start passes --protected-mode no to shell-less backends while native-mode Docker publishing
leaves the backend port bound to the host's interfaces. Before proxy-driven backend ACL
initialization, anyone who can reach that published port can send cache commands without passing
through the group's token, IAM, or user-access checks.
Code

src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[R195-196]

+            List<String> arguments = new ArrayList<>(List.of("--port", String.valueOf(BACKEND_PORT),
+                    "--protected-mode", "no", "--loglevel", "verbose"));
Relevance

●● Moderate

Exposure of an unauthenticated host-bound listener is a design-level concern; a similar host-bind
exposure finding was dismissed as rejected, but this is not a close match.

PR-#8522

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new shell-less arguments explicitly disable protected mode. Native mode publishes port 6379, and
the binding helper supplies no host IP unless loopback was requested; Docker documents that an
unspecified host IP binds published ports to all host addresses. Authentication and backend ACL
initialization occur in the proxy rather than at container startup.

src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[190-213]
src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java[1813-1821]
src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheAuthProxy.java[83-109]
src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheBackendAcl.java[39-55]
🌐 Docker states that ports published without a specified host address bind to all host addresses by default.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Shell-less mode disables backend protected mode, but native-mode Docker publishes the unauthenticated backend port without a host-IP restriction. Clients reaching that port bypass the ElastiCache proxy.

### Fix Focus Areas
- src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[190-213]
- src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java[1813-1821]

### Recommended Fix
Restrict native backend bindings to an interface reachable by Floci but not remote clients, such as loopback for a local daemon. For remote-daemon configurations, provide an isolated backend transport or initialize backend authentication before making a port reachable; test that a remote client cannot connect directly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Remediation recommended

2. Cache users prevent shell-less snapshots 🐞 Bug ≡ Correctness
Description
snapshotWithoutShell opens a fresh backend connection and sends SAVE without authenticating it.
After a user-group client authenticates through the proxy, backend ACL initialization disables the
default user, so the direct command receives NOAUTH and CreateSnapshot fails.
Code

src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[R408-410]

+        try (ValkeyClusterFormation.RespClient client = new ValkeyClusterFormation.RespClient(
+                handle.getHost(), handle.getPort(), SNAPSHOT_SAVE_TIMEOUT_MS)) {
+            Object reply = client.call("SAVE");
Relevance

●●● Strong

Concrete ElastiCache snapshot bug: unauthenticated SAVE fails under user-group ACLs; team accepted
ElastiCache snapshot correctness fixes.

PR-#7744

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new client sends commands directly with no AUTH. The proxy's first user-group backend
authentication executes ACL SETUSER default reset off, and the RESP client turns the resulting
backend error into an exception that the service reports as snapshot failure.

src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[408-417]
src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheBackendAcl.java[39-55]
src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheAuthProxy.java[83-98]
src/main/java/io/floci/aws/services/elasticache/ElastiCacheService.java[1420-1428]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The shell-less snapshot client cannot issue SAVE or CONFIG GET once proxy-driven ACL initialization disables the backend default user.

### Fix Focus Areas
- src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[401-416]
- src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheBackendAcl.java[26-55]

### Recommended Fix
Give the snapshot operation a narrowly scoped way to authenticate with the proxy-managed backend administrator before issuing SAVE and CONFIG GET. Cover a snapshot taken after a user-group client has authenticated.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


3. Wrong snapshot file name restores an empty cache ✓ Resolved

Resolving commit: aa517f0

Resolution reason
The commit passes the configured shell-less dbfilename into verifySnapshotDirectory and, after the
dir check, reads CONFIG GET dbfilename. If the server reports a non-blank filename that differs from
the placed name, it throws SnapshotRestoreException naming both filenames and the config key to set.
This is the suggested remediation. Tests cover a matching filename, a mismatched filename (dump.kdb
vs dump.rdb), a mismatched directory, and a server reporting no filename. The docs also state the
image requirements.
Description
verifySnapshotDirectory compares the server’s CONFIG GET dir with the directory used by
placeSnapshot, but never checks whether the server’s dbfilename matches
shellLessBackendDbfilename, the name used for the placed file. When the server loads a different
filename from that directory, such as dump.kdb instead of dump.rdb, it can start empty while
CreateReplicationGroup with SnapshotName publishes the group as available.

4. Shell-less image requirements omit ACL support from the docs ✓ Resolved

Resolving commit: aa517f0

Resolution reason
The commit adds a bulleted list to the same docs section stating the image must accept the server
flags (including cluster-mode flags), answer SAVE/CONFIG GET dir/dbfilename and load a snapshot file
of that name, and must support ACL users with access strings (ACL SETUSER, AUTH), with an explicit
note that an image without ACL support works only for groups with no user group. This closely
matches the suggested fix prompt.
Description
The new "Images with no shell or CLI" section lists the server flags, the commands and the snapshot
file name, but says nothing about whether the image must support ACL users and access strings, which
the integration tests exercise through the proxy. A user cannot tell from this section whether an
image without ACL support is usable with shell-less-backend, so the documented compatibility check
is incomplete.

View medium (1)
5. Test container helpers are copied into two integration test classes ✓ Resolved

Resolving commit: aa517f0

Resolution reason
The Docker CLI lookup, process handling and RESP request/reply helpers were extracted into
ElastiCacheTestConnections as static package-private methods; both integration test classes now
import them instead of keeping their own copies, so the label filter and Docker invocation live in
one place.
Description
The containerOf and docker helpers in ElastiCacheShellLessClusterIntegrationTest repeat the
same Docker CLI lookup and process handling already written in
ElastiCacheShellLessBackendIntegrationTest, and the RESP command writer in the cluster test
repeats its write/command logic. Any change to the container label filter or the Docker
invocation has to be made in both files, and the two copies can drift apart silently. The
duplication is in new test code, so it is introduced by this PR.

Grey Divider

Context sources
✅ Compliance rules (platform): 15 rules
✅ Web pages:
  +12 more
✅ Cross-repo context — repo relationships
  Explored: repo: floci-io/testcontainers-floci-go (sha: 8db9d48e) — View relationship
  Explored: repo: floci-io/testcontainers-floci-python (sha: e6b79f58) — View relationship
  Explored: repo: floci-io/testcontainers-floci (sha: e900a79e) — View relationship
  Explored: repo: floci-io/testcontainers-floci-node (sha: 1251b1d3) — View relationship
  Explored: repo: floci-io/testcontainers-floci-dotnet (sha: a011afd5) — View relationship
✅ Context preparation
  Past issues: summarized; full text retained for this review
Review mode: Auto: 🧠 Deep: Substantial container, snapshot, restore, and cluster logic spans many independent paths.

Grey Divider

Tip of the day
💡 Did you know, you can choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread docs/services/elasticache.md Resolved
Comment on lines +195 to +196
List<String> arguments = new ArrayList<>(List.of("--port", String.valueOf(BACKEND_PORT),
"--protected-mode", "no", "--loglevel", "verbose"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Remote clients can bypass cache auth 🐞 Bug ⛨ Security

start passes --protected-mode no to shell-less backends while native-mode Docker publishing
leaves the backend port bound to the host's interfaces. Before proxy-driven backend ACL
initialization, anyone who can reach that published port can send cache commands without passing
through the group's token, IAM, or user-access checks.
Agent Prompt
### Issue description
Shell-less mode disables backend protected mode, but native-mode Docker publishes the unauthenticated backend port without a host-IP restriction. Clients reaching that port bypass the ElastiCache proxy.

### Fix Focus Areas
- src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[190-213]
- src/main/java/io/floci/aws/core/common/docker/ContainerLifecycleManager.java[1813-1821]

### Recommended Fix
Restrict native backend bindings to an interface reachable by Floci but not remote clients, such as loopback for a local daemon. For remote-daemon configurations, provide an isolated backend transport or initialize backend authentication before making a port reachable; test that a remote client cannot connect directly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +408 to +410
try (ValkeyClusterFormation.RespClient client = new ValkeyClusterFormation.RespClient(
handle.getHost(), handle.getPort(), SNAPSHOT_SAVE_TIMEOUT_MS)) {
Object reply = client.call("SAVE");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Cache users prevent shell-less snapshots 🐞 Bug ≡ Correctness

snapshotWithoutShell opens a fresh backend connection and sends SAVE without authenticating it.
After a user-group client authenticates through the proxy, backend ACL initialization disables the
default user, so the direct command receives NOAUTH and CreateSnapshot fails.
Agent Prompt
### Issue description
The shell-less snapshot client cannot issue SAVE or CONFIG GET once proxy-driven ACL initialization disables the backend default user.

### Fix Focus Areas
- src/main/java/io/floci/aws/services/elasticache/container/ElastiCacheContainerManager.java[401-416]
- src/main/java/io/floci/aws/services/elasticache/proxy/ElastiCacheBackendAcl.java[26-55]

### Recommended Fix
Give the snapshot operation a narrowly scoped way to authenticate with the proxy-managed backend administrator before issuing SAVE and CONFIG GET. Cover a snapshot taken after a user-group client has authenticated.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

@pgermosen pgermosen added elasticache Amazon ElastiCache enhancement New feature or request labels Nov 16, 2026

@pgermosen pgermosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murtazayusuf welcome, and thanks for your first PR! It follows the plan agreed in #8209: an explicit setting, flags as arguments, and restore by placing the file before start, with no DEBUG.

A couple of small things. The commit isn't signed, which main requires; could you sign it and force-push (GitHub's guide)? And verifySnapshotDirectory checks dir but not dbfilename, so a server loading another file name starts empty yet looks restored; could it compare the name when the server reports one?

It would also help to share containerOf, docker and the RESP helpers between the two new integration tests through ElastiCacheTestConnections, and to fold createAndStart(spec, beforeStart) into the existing private createAndStart.

@pgermosen pgermosen added the waiting-author Review posted; waiting on the PR author to respond label Nov 16, 2026
…compatible images

An image with no shell and no CLI cannot take VALKEY_EXTRA_FLAGS or the
valkey-cli based snapshot export and restore. floci.services.elasticache.shell-less-backend
(off by default, never inferred from the image name) selects another path:
server flags are container arguments, a snapshot is taken with SAVE and
CONFIG GET dir/dbfilename over the RESP connection and read out of the
container through the Docker archive API, and a snapshot is restored by
placing its file in the data directory before the server starts, so DEBUG
is not enabled anywhere. A failed restore removes only the new container.
The default valkey/valkey path is unchanged.


After a restore the server's dir and, when it reports one, its dbfilename
are compared with where the file was placed, so a server that loads
another file cannot look restored. The docs list what such an image has
to support.
@murtazayusuf
murtazayusuf force-pushed the feat/elasticache-backend-images branch from aa517f0 to 08d1aeb Compare November 16, 2026 19:42
@murtazayusuf

Copy link
Copy Markdown
Contributor Author

Thanks @pgermosen. All done in 08d1aeb, one signed commit, force-pushed as you asked:

  • File name check: verifySnapshotDirectory now compares dbfilename as well as dir when the server reports one, and the error names the file the server loads and the setting to change. A server that reports none (KiviDB) keeps the configured name. Unit tests cover a matching name, a different name, a different directory and no name reported.
  • Shared helpers: containerOf, docker and the RESP helpers moved into ElastiCacheTestConnections; both integration tests use that one copy.
  • createAndStart: the callback is now an optional parameter of the existing private createAndStart; the public createAndStart(spec, beforeStart) only delegates to it.

On the two Qodo findings I did not change in code:

  • Protected mode / published port: this is the same as the default path. valkey/valkey:8 also runs with protected-mode no, and the backend port is published by the shared code in ElastiCacheContainerManager.start (withDynamicPort / withExposedPort) before the shell-less branch. The new path only states --protected-mode no because replacing the image's arguments drops the image's own default. The docs now say the port is published as for the default image.
  • Snapshot after a user has authenticated: real, and the same limit as the CLI path, which also connects with no credentials once the proxy has switched the backend's default user off. The backend admin credentials are private to each ElastiCacheAuthProxy, so fixing it needs a channel from the proxy to the snapshot code, for both paths. I'd rather do that as its own PR if you want it; here an integration test pins the current behaviour (InvalidReplicationGroupState) and the docs state the limit.

The docs section also lists what an image has to support now, ACL users with access strings included. Same test selection as before: 1304 run, 0 failures, 3 skipped (the GPU and platform Docker tests); checkstyle and make docs-check pass.

@pgermosen pgermosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murtazayusuf thanks, all of it is in: the commit is signed, a server loading another file name now fails the restore and names the setting to change, the two integration tests share ElastiCacheTestConnections, and createAndStart takes the callback in one place. Your reasoning on protected mode holds too, since the default image runs the same way on the same published port.

(follow-up, separate PR) Giving the snapshot connection credentials once the proxy has turned the backend's default user off, on both paths, as you suggested.

@pgermosen pgermosen removed the waiting-author Review posted; waiting on the PR author to respond label Nov 16, 2026
@pgermosen
pgermosen merged commit b7a95fc into floci-io:main Nov 16, 2026
26 checks passed
@murtazayusuf

Copy link
Copy Markdown
Contributor Author

Thanks @pgermosen and @hectorvent for the quick reviews, and @AndreKurait for checking the plan before I started; it made this an easy one to land. I'll open the follow-up for the snapshot connection's credentials (both paths) as its own PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

elasticache Amazon ElastiCache enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] ElastiCache: support Redis-compatible backend images other than valkey/valkey

2 participants