#!/usr/bin/env bash # next/kernel/serve.sh — run host_kernel as a PERSISTENT durable-execution service (RA-live substrate). # Loads the Erlang-on-SX runtime + next/flow + the kernel, then host_kernel:start($KERNEL_PORT) blocks # in http:listen forever — keeping the er-scheduler + flow_store's gen_server alive so durable flow # instances survive across requests. Doubles as a container entrypoint and a local launcher. The host's # RA runner drives it over HTTP (GET /flow/start/, GET /flow/resume/). set -uo pipefail cd "${SX_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || echo .)}" SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}" [ -x "$SX_SERVER" ] || SX_SERVER="/root/rose-ash/hosts/ocaml/_build/default/bin/sx_server.exe" if [ ! -x "$SX_SERVER" ]; then echo "ERROR: sx_server.exe not found." >&2; exit 1; fi PORT="${KERNEL_PORT:-8930}" # The epoch stream loads everything then calls start (which blocks in http:listen). `sleep infinity` # holds stdin open so EOF doesn't exit(0) before/while the listener serves. { cat <