Skip to content

Sprint2 - #2

Merged
saiful-semantic merged 34 commits into
semanticlib:mainfrom
saiful-semantic:sprint2
Mar 28, 2026
Merged

saiful-semantic merged 34 commits into
semanticlib:mainfrom
saiful-semantic:sprint2

Conversation

@saiful-semantic

Copy link
Copy Markdown
Contributor

Changes in the CHANGELOG.md

Add helpful documentation link explaining how to use LocalForward
to access services running on the VM from the host machine.
Add full CRUD API endpoints and UI for managing LXD profiles. Profiles allow users to save and reuse predefined resource configurations (CPU, RAM, disk) and cloud-init templates when creating containers or VMs. Includes:

- REST API: list all profiles, get single profile, create, update, delete
- Dashboard integration: profile picker dropdown in instance creation forms
- Settings UI: dedicated tab for viewing, editing, creating, and deleting profiles
- Size parsing: helper to convert LXD size strings (GiB, MiB, etc.) to integer GiB
- Cloud-init support: optional cloud-init template per profile
Add informational links with question mark icons to the instance type dropdowns in the admin dashboard to help users understand the difference between LXD containers and virtual machines.
… Classroom model

Consolidates VMDefaultSettings, ContainerDefaultSettings, and ConnectionTemplate models
into a single Classroom model that combines default settings, image selection, and SSH
config templates. Updates all routes to use the new model and adds Classroom CRUD API
endpoints. Updates frontend to manage classrooms instead of separate VM/Container settings.
Added populateProfileDropdowns calls in three locations:
- After LXD profiles are loaded in loadLXDProfilesForClassroom
- When selecting a classroom for editing in selectClassroom
- When showing the new classroom form in showNewClassroomForm

This ensures the profile dropdowns are always populated with available
profiles whenever the forms are displayed, improving the user experience.
Moved classroom management and LXD profile management from Settings tab to a new standalone Classrooms page. This includes:
- New routes/classrooms.py module with full CRUD APIs for classrooms and LXD profiles
- New templates/admin/classrooms.html with management UI
- New static/js/classrooms.js for frontend logic
- Updated base_admin.html with Classrooms navigation link
- Simplified settings.py by removing classroom/profile endpoints

The LXD profile management was bundled with classroom management in settings, so both features were extracted together to their own dedicated page.
Replaces LXD profile selector with classroom selector in the instance creation forms. When a classroom is selected, its settings (image_type, username, image_fingerprint, lxd_profile) are used for instance creation. Added lxd_profile parameter throughout the instance creation pipeline to enable profile application after instance creation.
Update the default instance type across models, API routes, and UI to use "container"
instead of "virtual-machine". Add type display elements in the dashboard forms to
show the current instance type with appropriate icons (📦 Container, 🖥️ VM),
and update the JavaScript to properly sync the type field from classroom selection.
Update form labels from "Type" and "Image Type" to "Instance Type" with contextual help links to clarify the distinction between containers and virtual machines. Add dark mode styling for form-control-plaintext elements in admin interface.
Refactor cloud-init service to support distinct templates for VMs and containers.
Remove vm_swap parameter as swap configuration is now hardcoded in VM template.
Update API endpoint to accept template_type parameter for loading appropriate templates.
Update UI to provide separate buttons for loading VM and container default templates.
… settings API

- Relocated /settings/cloud-init/template to /classrooms/cloud-init/template
- Relocated /settings/connection-templates to /classrooms/connection-templates
- Updated frontend fetch calls to use new classroom endpoints
- Incremented static JS version to v=3
…tation

Added helpful text explaining that `{username}` and `{public_key}` placeholders are rendered at instance creation time, and swapped the button order to show container option first for consistency
Renames "LXD Profiles" to "Instance Profiles" and "LXD images" to "images" throughout the admin classrooms interface to use more generic, platform-agnostic terminology. Also adjusts column layout classes for improved responsiveness.
…light checks

Add instance type selection ("container" or "virtual-machine") and allow_overcommit
parameter to bulk preflight checks. Containers now use a 4x density factor in resource
calculations, allowing higher instance density on the same hardware. The preflight
check also accounts for this density when calculating effective CPU/RAM requirements
and provides more lenient overcommitment thresholds when explicitly enabled.
Add validation to ensure username is provided when creating or updating classrooms,
removing the previous default value. Updates both frontend form validation and backend
API to require the username field with appropriate error messages.
Now retrieves cloud-init from LXD profiles instead of hardcoding to None, and uses separate default templates for containers vs VMs. Generates cloud-init template when SSH keys are present, falling back to default template when not explicitly provided.
Added title tooltip, reduced opacity, and changed cursor to not-allowed when
attempting to delete the default LXD profile to provide better visual feedback
Adds a check before deleting an LXD profile to verify it's not in use by any classrooms. Returns an error message listing which classrooms are currently using the profile if it cannot be deleted.
- Add comprehensive systemd service configuration for production deployment
- Update installation instructions to use /opt directory with proper ownership
- Add Python venv module requirement
- Remove deprecated X-XSS-Protection header from Caddyfile
- Update DNS prerequisite to include CNAME option
Add comprehensive changelog entries for unreleased Sprint 2 work including
classroom management, LXD profile CRUD UI, container support with
density-aware resource checks, and profile deletion protection.

Update README features list to highlight classroom management capability.
…lity

Add version constraints to all core dependencies to ensure consistent
installations across environments while allowing minor and patch updates
for security fixes and bug patches.

Organize requirements with descriptive comments grouping related packages.
…ore module

Extract duplicated template setup from main.py and all route modules into
a single core/templates.py module. This eliminates redundant Jinja2Templates
instantiation and global filter configuration across auth, classrooms,
dashboard, and settings routes, ensuring consistent template rendering
configuration from one location.
centralize template rendering by sourcing templates from
core.templates

update dependencies to pin Starlette for
template rendering compatibility
cloud-init is now handled by LXD when applying the profile, making
direct access to lxd_profile.cloud_init unnecessary. this simplifies
the instance creation path and avoids potential None references
…ate selection

- allow using cloud-init from LXD profile if present, otherwise fall back to default template based on instance_type
- pass instance_type to get_cloud_init_template to select VM vs container template
- replace {username} and {public_key} in the resulting template
- handle profile access errors gracefully to avoid failing instance creation
@saiful-semantic
saiful-semantic merged commit 6208814 into semanticlib:main Mar 28, 2026
1 check passed
@saiful-semantic
saiful-semantic deleted the sprint2 branch March 28, 2026 08:57
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