Skip to content

Conversation

@twdamhore
Copy link
Owner

Summary

Complete rewrite of the PXE boot manager with a cleaner architecture and custom ISO9660 reader.

Key Changes

  • Custom ISO9660 reader - Properly handles multi-sector directories (fixes bug where external libraries only read ~41 of 100 files in large directories)
  • New endpoint structure:
    • GET /content/iso/{release}/{*path} - Stream file from ISO
    • GET /content/combine/{name} - Stream concatenated files
    • GET /content/raw/{release}/{filename} - Stream full ISO (if downloadable)
    • GET /views/{*path}?hostname=X - Render Jinja2 templates
    • GET /action/boot/{mac} - Return boot script
    • GET /action/done/{mac} - Mark installation complete
  • Config file based architecture:
    • aliases.cfg - Release to ISO filename mapping
    • combine.cfg - Concatenated file definitions (e.g., initrd + firmware)
    • action.cfg - Hostname to installation mapping
    • hardware/*.cfg - Per-machine configs
  • MiniJinja templating with full context (host, port, hostname, mac, os, distro, release, etc.)
  • Jemalloc allocator for better memory performance
  • Simplified codebase with fewer external dependencies

Testing

  • Build passes (cargo build --release)
  • All unit tests pass (cargo test)
  • ISO reader tested with 100 files in nested directories - all found correctly

Breaking Changes

This is a complete rewrite - configuration files and endpoints have changed from v1.

🤖 Generated with Claude Code

twdamhore and others added 6 commits January 21, 2026 16:12
Complete rewrite of the PXE boot manager with:

- Custom ISO9660 reader that properly handles multi-sector directories
  (fixes bug where libraries like iso9660_simple only read ~41 of 100 files)
- New endpoint structure:
  - GET /content/iso/{release}/{*path} - stream file from ISO
  - GET /content/combine/{name} - stream concatenated files
  - GET /content/raw/{release}/{filename} - stream full ISO
  - GET /views/{*path}?hostname=X - render Jinja2 templates
  - GET /action/boot/{mac} - return boot script
  - GET /action/done/{mac} - mark installation complete
- Config file based architecture:
  - aliases.cfg: release -> ISO filename mapping
  - combine.cfg: concatenated file definitions
  - action.cfg: hostname -> installation mapping
  - hardware/*.cfg: per-machine configs
- MiniJinja templating with full context (host, port, hostname, mac, etc.)
- Jemalloc allocator for better memory performance
- Simplified codebase with fewer external dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add bounds checking in iso.rs to prevent panics
- Implement 1MB chunked streaming with smart allocation for files >2MB
- Use spawn_blocking for synchronous ISO reads in async context
- Add write validation in mark_done to verify file writes
- Change edition from invalid 2024 to 2021
- Add tower-http TraceLayer for request logging with response status
- Add Internal error variant to AppError

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Make stream_file async, wrap all sync I/O in spawn_blocking
- Make stream_combined async, wrap size calculation in spawn_blocking
- Fix potential panic in action.rs when parsing empty release values

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Restructure mark_done to not hold RwLock during file I/O
- Wrap template rendering in spawn_blocking for async safety
- Use blocks to ensure lock guards are released before await points
- Change template::render_template to take owned values for spawn_blocking
- Remove dead code in views.rs (all branches returned same value)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- routes/action.rs: template_path.exists()
- routes/views.rs: template_path.exists()
- routes/content.rs: iso_path.exists() (both get_iso_content and get_raw_content)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use parts.first() instead of parts[0] to handle empty values gracefully
- Skip malformed lines with empty filename (e.g., "debian-12=")

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@twdamhore twdamhore merged commit b557177 into main Jan 22, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant