Serabut v2: Complete rewrite with custom ISO9660 reader#106
Merged
Conversation
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>
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.
Summary
Complete rewrite of the PXE boot manager with a cleaner architecture and custom ISO9660 reader.
Key Changes
GET /content/iso/{release}/{*path}- Stream file from ISOGET /content/combine/{name}- Stream concatenated filesGET /content/raw/{release}/{filename}- Stream full ISO (if downloadable)GET /views/{*path}?hostname=X- Render Jinja2 templatesGET /action/boot/{mac}- Return boot scriptGET /action/done/{mac}- Mark installation completealiases.cfg- Release to ISO filename mappingcombine.cfg- Concatenated file definitions (e.g., initrd + firmware)action.cfg- Hostname to installation mappinghardware/*.cfg- Per-machine configsTesting
cargo build --release)cargo test)Breaking Changes
This is a complete rewrite - configuration files and endpoints have changed from v1.
🤖 Generated with Claude Code