* feat(elasticache): support cluster-mode replication groups
CreateReplicationGroup now provisions a real sharded Valkey cluster when
the request asks for one (NumNodeGroups > 1, a cluster.on parameter
group, or ClusterMode=enabled): one cluster-enabled container per node,
formed via config epochs, MEET, slot assignment and replica attachment,
each fronted by its own auth-proxy port announced to clients via
cluster-announce-client-ipv4/cluster-announce-port so CLUSTER SLOTS and
MOVED redirects point at reachable addresses.
DescribeReplicationGroups reports the topology honestly (ClusterEnabled,
NodeGroups with Slots, MemberClusters, Engine, ARN, AutomaticFailover),
and replication-group members answer DescribeCacheClusters, which is
where terraform-provider-aws reads node type, engine version and port
from.
Adds a terraform compatibility test that applies an
aws_elasticache_replication_group with num_node_groups and
replicas_per_node_group, asserts the data plane is a formed cluster
running in cluster mode (INFO cluster / CLUSTER INFO over RESP through
the proxy), and that a re-plan straight after apply is clean.
* fix(elasticache): address cluster-mode review feedback and compat CI failure
- bump compat-terraform aws-cli image to 2.34.32 so botocore models
include ReplicationGroup.Engine (old pin silently dropped the field)
- restore cluster-mode runtime state (ports, containers, proxies,
cluster formation) after restart; mark groups create-failed on error
- announce configured hostname to Valkey nodes so MOVED redirects and
CLUSTER SLOTS return client-reachable endpoints
- log swallowed socket-close failures in cluster formation
* fix(elasticache): report restore-failed members and modeled node-group quota fault
Review follow-up for cluster-mode support:
- Member cache clusters mirror their group's status instead of a
hardcoded "available", so a group marked create-failed by a failed
restore no longer contradicts its own members in
DescribeCacheClusters. CacheClusterStatus has no create-failed value,
so failed members report the documented restore-failed.
- NumNodeGroups above the 500 ceiling surfaces the modeled
NodeGroupsPerReplicationGroupQuotaExceeded fault instead of a generic
InvalidParameterValue.
- Javadoc names ClusterMode=compatible handling and the
cluster-mode-only restore scope as deliberate.
* fix(elasticache): announce a client-resolvable hostname for cluster mode
Cluster-mode nodes announced FLOCI_HOSTNAME verbatim, so the shipped
Docker Compose deployment baked the Compose-only name 'floci' into
MOVED/ASK redirects and topology responses, breaking cluster-aware
clients connecting from outside the Compose network.
Add FLOCI_SERVICES_ELASTICACHE_CLUSTER_ANNOUNCE_HOSTNAME (default:
FLOCI_HOSTNAME) used for the announced name and the reported
ConfigurationEndpoint, and set it to localhost.floci.io in
docker-compose.yml — public DNS resolves it to 127.0.0.1 on the host
while the network alias and Floci's embedded DNS resolve it to the
Floci container from inside Docker.
* fix(elasticache): restore cluster-mode groups without blocking startup
Restoring persisted cluster-mode groups ran serially in the synchronous
startup path, so a slow or unavailable Docker daemon could hold up
emulator readiness by a container-readiness plus cluster-formation
timeout per group, timing out readiness-dependent clients such as
Testcontainers.
restorePersistedRuntime now reserves each node's proxy port and marks
groups creating synchronously - so no request can claim a persisted
port or see a stale available status - then brings containers, cluster
formation and proxies back in the background, flipping each group to
available or create-failed as its restore finishes.
---------
Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
* fix(docker): enable TLS and sync docker test runner with compatibility workflow
The local docker compose stack ran without FLOCI_TLS_ENABLED and the EC2 mock,
and run-docker-tests.sh lacked the hot-reload bind mount, so the node TLS/WSS
suites and the Java Lambda hot-reload test failed locally while passing in CI.
Mirror the compatibility workflow's configuration so local runs exercise the
same setup.
* fix: remove FLOCI_SERVICES_EC2_MOCK from docker-compose
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Replace the FLOCI_STORAGE_HOST_PERSISTENT_PATH footgun with automatic
named Docker volume management for RDS, OpenSearch, MSK, and ECR.
- Each resource gets a collision-free 6-char hex volumeId generated once
at creation and stored in the model. Container and volume names both use
it: floci-{service}-{volumeId}
- Volumes are labelled floci=true for easy pruning
- Memory mode always removes volumes on resource delete. Persistent modes
retain by default; set prune-volumes-on-delete: true to remove on delete
- Mode detection: FLOCI_STORAGE_HOST_PERSISTENT_PATH set to an absolute
path → host bind-mount mode (legacy); unset or non-absolute → named-
volume mode. Volume names in host-persistent-path are not supported
- Removed the container-storage config key — no longer needed
- Updated docker-compose.yml, and all docs
- Translate LocalStack env vars (LOCALSTACK_HOST, PERSISTENCE, LAMBDA_DOCKER_NETWORK, etc.)
to Floci equivalents automatically at startup; opt out with LOCALSTACK_PARITY=false
- Serve /_localstack/init and /_localstack/health alongside /_floci/* equivalents
- Report executed scripts with path, state, and return_code in /_floci/init response
- Add /_aws/sqs/messages GET (non-destructive peek) and DELETE (purge) inspection endpoint
- Add /_aws/execute-api/{apiId}/{stageName} LocalStack-compat path for REST API invocation
- Add four-phase init hook lifecycle (boot/start/ready/stop) with dual-path discovery
(/etc/floci/init/ and /etc/localstack/init/ compat paths)
- Install Python 3, AWS CLI, boto3 in standard image; wrap aws binary to pre-configure
--endpoint-url=http://localhost:4566 so init scripts need no extra flags
- Wire entrypoint.sh + gosu privilege drop into all Dockerfile variants
- Add migration guide and update README, docker-compose, docker-images, SQS, and
initialization-hooks docs
* feat(lambda): add bind-mount hot-reload mode via S3Bucket=hot-reload
Functions created with S3Bucket=hot-reload and S3Key=/absolute/path
have their host directory bind-mounted into /var/task rather than
packaged as a ZIP. Each invocation runs an ephemeral container so
file changes on disk are picked up immediately without calling
UpdateFunctionCode or re-uploading code.
Feature is disabled by default; opt in with:
FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ENABLED=true
An optional path allowlist (FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ALLOWED_PATHS)
restricts which host directories may be bind-mounted.
* fix: missing hot reload enable env
* feat(lambda): embedded DNS server for virtual-hosted S3 resolution
Lambda containers cannot resolve virtual-hosted S3 URLs
(my-bucket.floci:4566) because Docker DNS has no wildcard support —
queries for *.floci fall through to public DNS and hit real AWS.
Adds a Vert.x UDP/53 DNS server that binds automatically when Floci
runs inside Docker. It resolves any *.{floci.hostname} query to
Floci's container IP and forwards everything else upstream. Lambda
containers receive Floci's IP as their DNS server via HostConfig.withDns().
An optional floci.dns.extra-suffixes config allows LocalStack migrants
to route *.localhost.localstack.cloud without changing Lambda code.
Netty NioDatagramChannel was tried first but silently dropped IPv4
UDP packets due to AF_INET6 socket defaults — Vert.x DatagramSocket
with setIpV6(false) resolves this.
* fix: adding missing dns class
* fix(lambda): release container handle on timeout instead of draining warm pool
* fix: fix container lifecycle on timeout
* fix(lambda): correct /next poll loop condition and restore response handling
Flip while loop to `invocation == null && !stopped` so the poll actually
runs (previous condition was unreachable because invocation starts null).
Restore the 204 response on null return and the 500 response on
InterruptedException so the handler never leaves the response open.
Without this fix, every RIC call to /next hangs, which also broke the
existing LambdaReactiveSyncIntegrationTest with SocketTimeout.
---------
Co-authored-by: Ricardo Lima <ricardo.hrlima@gmail.com>
* fix(ecr): fixing port and network issues on ecr
* fix: issue on merge with main
* fix(ecr): connect containers to network after start only when port bindings exist
* feat(lifecycle): add support for startup and shutdown initialization hooks
* test(lifecycle): add unit tests for initialization hooks
* test(lifecycle): add integration tests for initialization hooks
* docs: add documentation and configuration for initialization hooks