# PXE Boot Server Directory Structure
#
# This document describes the directory layout for the HTTP/TFTP server
# that serves PXE boot assets.
#
# Base Directory: /var/lib/pxe-boot/

/var/lib/pxe-boot/
├── ipxe/                           # iPXE bootloaders and scripts
│   ├── undionly.kpxe              # iPXE bootloader for BIOS (legacy)
│   ├── ipxe.efi                   # iPXE bootloader for UEFI x86-64
│   ├── ipxe-i386.efi              # iPXE bootloader for UEFI x86 32-bit (rare)
│   ├── boot.ipxe                  # Main boot script (served via HTTP)
│   └── README.txt                 # Documentation
│
├── nixos/                          # NixOS netboot images
│   ├── bzImage                    # Linux kernel (compressed)
│   ├── initrd                     # Initial ramdisk
│   ├── squashfs                   # Root filesystem (if using squashfs)
│   ├── version.txt                # Build version info
│   └── profiles/                  # Profile-specific boot images (optional)
│       ├── control-plane/
│       │   ├── bzImage
│       │   └── initrd
│       ├── worker/
│       │   ├── bzImage
│       │   └── initrd
│       └── all-in-one/
│           ├── bzImage
│           └── initrd
│
└── README.txt                      # Top-level documentation

# TFTP Directory (if using separate TFTP server)
# Usually: /var/lib/tftpboot/ or /srv/tftp/
/var/lib/tftpboot/
├── undionly.kpxe                  # Symlink to /var/lib/pxe-boot/ipxe/undionly.kpxe
├── ipxe.efi                       # Symlink to /var/lib/pxe-boot/ipxe/ipxe.efi
└── ipxe-i386.efi                  # Symlink to /var/lib/pxe-boot/ipxe/ipxe-i386.efi

# URL Mapping
# The following URLs are served by nginx:
#
# http://10.0.100.10/boot/ipxe/boot.ipxe
#   -> /var/lib/pxe-boot/ipxe/boot.ipxe
#
# http://10.0.100.10/boot/ipxe/undionly.kpxe
#   -> /var/lib/pxe-boot/ipxe/undionly.kpxe
#
# http://10.0.100.10/boot/nixos/bzImage
#   -> /var/lib/pxe-boot/nixos/bzImage
#
# http://10.0.100.10/boot/nixos/initrd
#   -> /var/lib/pxe-boot/nixos/initrd

# File Sizes (Typical)
# - undionly.kpxe: ~100 KB
# - ipxe.efi: ~1 MB
# - boot.ipxe: ~10 KB (text script)
# - bzImage: ~10-50 MB (compressed kernel)
# - initrd: ~50-500 MB (depends on included tools/drivers)

# Permissions
# All files should be readable by the nginx user:
#   chown -R nginx:nginx /var/lib/pxe-boot
#   chmod -R 755 /var/lib/pxe-boot
#   chmod 644 /var/lib/pxe-boot/ipxe/*
#   chmod 644 /var/lib/pxe-boot/nixos/*

# Disk Space Requirements
# Minimum: 1 GB (for basic setup with one NixOS image)
# Recommended: 5-10 GB (for multiple profiles and versions)
# - Each NixOS profile: ~500 MB - 1 GB
# - Keep 2-3 versions for rollback: multiply by 2-3x
# - Add buffer for logs and temporary files

# Backup Recommendations
# - Boot scripts (ipxe/*.ipxe): Version control (git)
# - Bootloaders (ipxe/*.kpxe, *.efi): Can re-download, but keep backups
# - NixOS images: Can rebuild from S3 builder, but keep at least 2 versions
# - Configuration files: Version control (git)
