Files
floci/docs/configuration/initialization-hooks.md
T
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

1.2 KiB

Initialization Hooks

Floci can execute shell scripts during startup and shutdown.

Directories

  • Startup hooks are loaded from /etc/floci/init/start.d
  • Shutdown hooks are loaded from /etc/floci/init/stop.d

Only files ending with .sh are executed.

Execution Model

  • Scripts are executed in lexicographical order
  • Hook scripts are executed sequentially
  • Hook execution is fail-fast: execution stops at the first script that fails or times out

Configuration

Key Default Description
floci.init-hooks.shell-executable /bin/bash Shell executable used to run hook scripts
floci.init-hooks.timeout-seconds 30 Maximum execution time per hook script before it is considered failed
floci.init-hooks.shutdown-grace-period-seconds 2 Time to wait after destroy() before forcing process termination

Example

floci:
  init-hooks:
    shell-executable: /bin/bash
    timeout-seconds: 30
    shutdown-grace-period-seconds: 2

Docker Compose Example

services:
  floci:
    image: hectorvent/floci:latest
    ports:
      - "4566:4566"
    volumes:
      - ./init/start.d:/etc/floci/init/start.d:ro
      - ./init/stop.d:/etc/floci/init/stop.d:ro