Repository navigation
feat: per-task setup hook so stock AL2023 works (#47) - #48
Merged
Merged
Conversation
nf-spawn ran the task container with `docker run` on the instance but provided no way to install Docker/tools first, so every task instance had to be a custom AMI with Docker (+ pigz etc.) pre-baked — even after ext.volumes (#45) moved the reference DB out of the AMI. This adds a per-task bootstrap, injected into the staging script before the task: - Auto-ensure Docker when a `container` directive is set — install + start it if absent (idempotent; stock AL2023 has the AWS CLI but no Docker). Opt out with `ext.ensureDocker = false` for a pre-baked tools AMI. - `ext.packages = ['pigz', ...]` → dnf install of host tools (list or space/comma string). - `ext.setup = '<shell>'` → arbitrary bootstrap, run last. buildSetupScript composes the three (parsePackages normalizes the list); buildStagingScript runs the setup before the work-dir sync and the task. With ext.volumes, the full stock-AMI + DB-on-EBS + tools-at-launch setup is now reachable — no custom AMI required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #47. (Good news in the report: #45 is validated end-to-end in the demo.) After moving the Kraken2 DB onto an EBS volume, the only remaining reason to maintain a custom AMI was Docker/pigz on the task instances — this removes it.
The gap
nf-spawn runs the task's container with
docker runon the instance, and demo processes callpigz/ethtool/awson the host — but there was no hook to install anything, so every task instance had to be a custom AMI with Docker + tools pre-baked. Stock AL2023 has the AWS CLI but no Docker, so it couldn't be used.Fix — a per-task setup step, injected into the staging script before the task
All three composable layers from the issue:
containerdirective (nf-spawn always runs it viadocker run), install + start Docker if it isn't present. Idempotent:command -v dockerguards the install, so a pre-baked AMI pays nothing. Opt out withext.ensureDocker = false. This is the part that makes stock AL2023 "just work" for the common containerized case, zero config.ext.packages = ['pigz', 'ethtool']→dnf install -yof host tools. Accepts a list or a space/comma string.ext.setup = '<shell>'→ arbitrary bootstrap, run last.buildSetupScript(ext, container)composes them;buildStagingScriptruns the result before the work-dir sync and the task. Empty when there's nothing to do.Combined with
ext.volumes(0.3.0), the full stock AMI + DB-on-EBS + tools-at-launch setup is now reachable — no custom AMI.Caveat (documented)
Per-task installs add boot latency + a repo failure mode. The README notes that a small pre-baked tools AMI is the lower-latency option for wide fan-out — but now it's a choice, not a requirement.
Tests
48 total, 0 failures. Added: auto-ensure Docker only when a container is set; idempotent guard present;
ext.ensureDocker=falseopt-out;ext.packagesdnf line;ext.setupordering (after docker);parsePackages(list / space / comma / empty); and end-to-end that setup runs before the sync and the task. READMEexttable + stock-AMI note updated. Built/tested on JDK 17.