Commit Graph
16 Commits
Author SHA1 Message Date
Kurt McAlpineandkurtmc 97ff0bc3e9 feat(elasticache): support cluster-mode replication groups (#2633)
* 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>
2026-08-28 16:00:33 -04:00
Hector Ventura fb546d54c4 fix(docker): enable TLS and sync docker test runner with compatibility workflow (#1714)
* 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>
2026-07-03 01:10:06 -05:00
Hector Ventura 800f4aea13 fix(floci-core): improve floci logs structure level and clean noisy logs (#847)
* fix(floci-core): improve floci logs structure level
* fix(floci-core): revert docker-compose.yml
2026-05-14 23:39:53 -05:00
Hector Ventura 01dbc76fc8 feat(docker): named-volume storage for child containers (#743)
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
2026-05-08 17:12:36 -05:00
Hector Ventura 023880b7d9 feat(parity): LocalStack drop-in compatibility (#696)
- 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
2026-05-04 01:15:59 -05:00
Hector Ventura 3c98efe615 chore: new docker image tag and compatibility (#691)
* chore: new docker image tag and compatibility
* chore: change nightly workflow schedule time
2026-05-02 22:46:25 -05:00
Hector Ventura 404b42bdc0 feat(lambda): bind-mount hot-reload via S3Bucket=hot-reload (#601)
* 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
2026-04-25 19:38:03 -05:00
Hector Ventura e023936a81 feat(lambda): embedded DNS server for virtual-hosted S3 resolution (#585)
* 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
2026-04-25 09:33:00 -05:00
Hector Ventura ee08d3ad44 feat(opensearch): add real os with docker image (#528)
* feat(opensearch): add real os with docker image
* fix: fix opensearch network issue
2026-04-19 19:04:31 -05:00
TiMandRicardo Lima f837be0051 fix(lambda): fix container lifecycle on timeout (rebase of #504) (#529)
* 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>
2026-04-19 18:34:48 -05:00
Hector Ventura e9f6417713 fix(ecr): fixing port and network issues on ecr (#483)
* 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
2026-04-16 21:34:26 -05:00
Hector Ventura 91071aaae7 feat: implement Amazon MSK service with Redpanda orchestration (#419)
* feat: implement Amazon MSK service with Redpanda orchestration
* fix: adding missing msk service on the test
2026-04-13 20:22:37 -05:00
Hector Ventura 788ccc8404 fix(ecr,s3): fix CDK compatibility and resolve macOS ECR port conflict (#354)
* fix(ecr,s3): fix CDK compatibility and resolve macOS ECR port conflict
* fix: remove go.mod
2026-04-11 15:32:06 -05:00
Hector Ventura 46e7f7e040 doc: improve readme showing better test description 2026-04-03 23:48:26 -05:00
Cyril Schumacher 7b2576fb42 feat(lifecycle): add support for startup and shutdown initialization hooks (#128)
* 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
2026-03-30 11:00:44 -05:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00