* feat(core): make the init hook directory configurable
Hook directories were fixed at /etc/floci/init/{boot,start,ready,stop,
shutdown}.d, which only the image can provide. floci.init-hooks.dir
(FLOCI_INIT_HOOKS_DIR) now sets that root, defaulting to /etc/floci/init so
the image is unchanged; the LocalStack-compat tree is still read as well.
Hooks also run on Windows, where there is no /bin/sh: .ps1 with
PowerShell, .cmd and .bat with cmd, and .py with python. A .sh hook there
is skipped with a warning unless another shell is configured; on Linux and
macOS the Windows script types are ignored.
Refs #5767
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): match Windows hook extensions in any case and warn about a skip once
Review follow-ups for the configurable hook directory:
- Windows file names are case-insensitive, so SETUP.BAT and Init.PS1 are
now hooks there; elsewhere the extension must stay lower case, as before.
- The warning for a hook Windows cannot run is logged once per file
instead of on every directory listing, and Windows script types are
ignored silently on Linux and macOS.
- The environment variable reference and application.yml list shutdown.d
with the other hook directories.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(core): always resolve hook directories from the configured root
findMergedScripts called getPrimaryPaths() for the default root and
getPrimaryPaths(hooksRoot) otherwise, though both return the same
directories; the no-argument form only survived because five tests stub
it on a mocked hook. The runner now always passes its root, the overload
is gone, and those tests stub getPrimaryPaths(anyString()).
The runner tests this branch added drop @DisplayName, per AGENTS.md.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
- 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
* docs: update Docker image references to floci/floci
* docs: keep README Docker Hub badges pointing to hectorvent/floci
The hectorvent/floci image has accumulated pull and size metrics; switch
the badges to floci/floci once the new image has comparable numbers.
Shutdown hooks could not reach Floci's HTTP endpoint (e.g.
`aws --endpoint-url http://localhost:4566 ...`) because they ran in
the ShutdownEvent observer, which Quarkus fires only AFTER the HTTP
server has already stopped.
Split the lifecycle:
- onPreShutdown(@Observes ShutdownDelayInitiatedEvent) runs stop hooks
while the HTTP server is still accepting connections.
- onStop(@Observes ShutdownEvent) handles resource cleanup only.
Enable the pre-shutdown phase via `quarkus.shutdown.delay-enabled:
true`. No `delay` value is set, so observers run synchronously with
no artificial sleep introduced.
Swallow all hook failures (including InterruptedException) without
restoring the interrupt flag, so the subsequent ShutdownEvent cleanup
phase always runs with a clean thread state and resource shutdown is
guaranteed even when hooks fail.
Fixesfloci-io/floci#431
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.
- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
(they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
following the 1.5.2 upstream release
The init hook executor defaulted to /bin/bash, which is not available on
Alpine-based Docker images (eclipse-temurin:25-jre-alpine). This caused
startup hooks to fail with "No such file or directory". /bin/sh is
universally available and POSIX-compatible.
Startup hooks that make HTTP calls back to floci (e.g. aws cli) deadlocked
because they ran synchronously during StartupEvent, before the HTTP server
bound to port 4566. Hooks now run on a virtual thread that polls for port
readiness first. When no hooks are configured, behavior is unchanged.
* 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