Skip to content

Commit 51dd4e0

Browse files
committed
More fixup
1 parent 7d3389f commit 51dd4e0

4 files changed

Lines changed: 53 additions & 73 deletions

File tree

README.md

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
# Preflight CLI
22

33
Internal CLI to run **pre-deployment checks** before running workloads.
4-
Checks are organized into groups (e.g., `System Checks`, `Scripted Checks`) and controlled via environment variables.
4+
Checks are organized into groups (e.g., `PVH Checks`, `Kernel Checks`) and controlled via environment variables.
55

66
---
77

88
## Usage
99

10-
Run inside Docker:
10+
### Run official release via Docker
1111

1212
```bash
1313
docker run \
1414
--pull always \
1515
--env RUST_LOG=debug \
1616
--env EDERA_PREFLIGHT_VERBOSE=true \
17-
--env EDERA_PREFLIGHT_TARGET_DIR='/host' \
18-
--env EDERA_PREFLIGHT_SKIP_GROUPS='ScriptedChecks;SystemChecks' \
19-
--env EDERA_PREFLIGHT_SCRIPTS_DIR=/scripts \
17+
--env EDERA_PREFLIGHT_SKIP_GROUPS='PVHChecks;KernelChecks' \
2018
--pid host \
21-
--net host \
2219
--privileged \
2320
us-central1-docker.pkg.dev/edera-protect/staging/protect-preflight:main
2421
```
2522

23+
Podman should also work.
24+
25+
### Run locally from repo root via Docker
26+
27+
Recommended way to run locally and debug/validate, will use local copy of repo.
28+
29+
```bash
30+
sh hack/debug/local.sh
31+
```
32+
2633
---
2734

2835
## Environment Variables
@@ -31,28 +38,46 @@ docker run \
3138
| ----------------------------- | ------------------------------------------------------ | ----------------------------- |
3239
| `RUST_LOG` | Log level (`error`, `warn`, `info`, `debug`, `trace`). | `debug` |
3340
| `EDERA_PREFLIGHT_VERBOSE` | Enable verbose output (`true`/`false`). | `true` |
34-
| `EDERA_PREFLIGHT_SKIP_GROUPS` | Semicolon-separated list of groups to skip. | `SystemChecks;ScriptedChecks` |
35-
| `EDERA_PREFLIGHT_SCRIPTS_DIR` | Directory containing custom shell-script checks. | `/scripts` |
36-
| `EDERA_PREFLIGHT_TARGET_DIR` | Directory to chroot to before running checks. Needed when running in a container. | `/host` |
41+
| `EDERA_PREFLIGHT_SKIP_GROUPS` | Semicolon-separated list of groups to skip. | `PVHChecks;KernelChecks` |
3742
| `EDERA_PREFLIGHT_REPORT_DIR` | Directory to write a report to. Defaults to tmpdir | `/tmp` |
3843

3944
---
4045

4146
## Example Output
4247

4348
```text
44-
[2025-09-17T05:05:33Z INFO preflight] Running Group [System Checks] - System requirement checks
45-
[2025-09-17T05:05:33Z DEBUG preflight::system] total memory = 66617298944
46-
[2025-09-17T05:05:33Z ERROR preflight] [System Checks] Errored: group errored
47-
[2025-09-17T05:05:33Z INFO preflight] [System Checks] Enough Memory: Passed
48-
[2025-09-17T05:05:33Z ERROR preflight] [System Checks] Should Error: Errored: Pretending to error
49-
[2025-09-17T05:05:33Z WARN preflight] [System Checks] Should Fail: Failed: Pretending to fail
50-
[2025-09-17T05:05:33Z INFO preflight] Running Group [Scripted Checks] - Checks composed through small shell scripts
51-
[2025-09-17T05:05:33Z ERROR preflight] [Scripted Checks] Errored: group errored
52-
[2025-09-17T05:05:33Z INFO preflight] [Scripted Checks] Should Pass: Passed
53-
[2025-09-17T05:05:33Z WARN preflight] [Scripted Checks] Should Fail: Failed: script returned Some(1)
54-
[2025-09-17T05:05:33Z ERROR preflight] [Scripted Checks] /totally/fake/script: Errored: No such file or directory (os error 2)
55-
Error: checks failed
49+
[2026-02-13T00:28:35Z INFO preflight] Writing all files to /tmp/protect-preflight-bundle-20260213-002835
50+
[2026-02-13T00:28:35Z INFO preflight] Running Group [System Checks] - System requirement checks
51+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::system] Enough space on disk mounted at / - 617760940032
52+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::system] Not enough space on disk mounted at /etc/resolv.conf - 9729925120
53+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::system] Enough space on disk mounted at /etc/hostname - 617760940032
54+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::system] Enough space on disk mounted at /etc/hosts - 617760940032[2026-02-13T00:28:35Z DEBUG preflight::checkers::system] total memory = 28762972160
55+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Checks] Passed
56+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Checks] Enough Memory: Passed
57+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Checks] Enough Disk: Passed
58+
[2026-02-13T00:28:35Z INFO preflight] Running Group [PVH Checks] - PVH capability checks
59+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::pvh] VM_CR=0x0 (svmdis=0)
60+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::pvh] EFER=0x200d01 (SVME=0)
61+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::pvh] AMD-V supported but unavailable under hypervisor
62+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::pvh] Virtualization is enabled or can be enabled
63+
[2026-02-13T00:28:35Z DEBUG preflight::helpers] [PVH Checks] Skipped
64+
[2026-02-13T00:28:35Z INFO preflight::helpers] [PVH Checks] PVH Support: Passed
65+
[2026-02-13T00:28:35Z INFO preflight] Running Group [Kernel Checks] - Kernel requirement checks
66+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::kernel] module msr
67+
[2026-02-13T00:28:35Z DEBUG preflight::checkers::kernel] module nf_tables
68+
[2026-02-13T00:28:35Z INFO preflight::helpers] [Kernel Checks] Passed
69+
[2026-02-13T00:28:35Z INFO preflight::helpers] [Kernel Checks] Host Has Necessary Modules: Passed
70+
[2026-02-13T00:28:35Z INFO preflight::helpers] [Kernel Checks] Host Kernel Version Is Good: Passed
71+
[2026-02-13T00:28:35Z INFO preflight] Running Group [System Info Recorder] - System requirement and status checks - records for informational purposes
72+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Passed
73+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record lspci -vvv: Passed
74+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record dmidecode: Passed
75+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record /proc/cpuinfo: Passed
76+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record /proc/cmdline: Passed
77+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record /boot/grub2/grub.cfg: Passed
78+
[2026-02-13T00:28:35Z INFO preflight::helpers] [System Info Recorder] Record boot/config-6.18.6: Passed
79+
[2026-02-13T00:28:35Z DEBUG preflight] Read 84023 bytes of tar
80+
[2026-02-13T00:28:35Z INFO preflight] Wrote to: /tmp/protect-preflight-bundle-20260213-002835.tar.gz
5681
```
5782

5883
* **INFO** → check passed or group started
@@ -66,8 +91,11 @@ Exit code is **non-zero** if any check/group fails or errors.
6691
## Notes
6792

6893
* Use `EDERA_PREFLIGHT_SKIP_GROUPS` to bypass slow or irrelevant checks.
69-
* Script-based checks must be **executable** and located in `EDERA_PREFLIGHT_SCRIPTS_DIR`.
7094

71-
## Script Based Checks
95+
## Dev Notes
96+
97+
* [src/recorders](src/recorders) - Special category of checkers that capture host machine state and generate informational reports.
98+
* [src/checkers](src/checkers) - All checkers that validate and actively interrogate various aspects of the host machine go here.
99+
* [src/helpers](src/helpers) - Shared bits.
72100

73-
Check the scripts [README.md](./scripts/README.md)
101+
By default, everything runs inside the container, and any system tools or binaries or other bits needed by the checkers can be installed or baked inside the container. For checks that need to jump out and touch the host filesystem or state, we use the [src/helpers/host_executor.rs](src/helpers/host_executor.rs).

hack/debug/local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VER=$(date +%s)
55
USERIMG=$(whoami)
66
REGISTRY="localhost"
77

8-
docker build . -f ./images/Dockerfile.preflight -t "${REGISTRY}/${USERIMG}-preflight-debug:${VER}"
8+
docker build . -f ./images/Containerfile.preflight -t "${REGISTRY}/${USERIMG}-preflight-debug:${VER}"
99

1010
docker run --privileged --pid="host" \
1111
-e RUST_LOG="debug" \
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ RUN mv ./target/$(./hack/build/target.sh)/release/preflight /usr/sbin
1010
FROM cgr.dev/chainguard/wolfi-base:latest
1111
ENTRYPOINT ["/usr/sbin/preflight"]
1212
COPY --from=build /usr/sbin/preflight /usr/sbin/preflight
13-
COPY --from=build /usr/src/app/scripts /scripts

scripts/README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)