Commit Graph

8 Commits

Author SHA1 Message Date
XPS\Micro
691c93292b feat: implement .env-based template building for install.sh
- Read USER_TEMPLATE_IMAGES from .env to determine which templates to build
- Parse semicolon-separated template list and extract image names with tags
- Only build templates defined in .env, not all user-template-* directories
- Validate that template directories and Dockerfiles exist
- Warn when template is defined but directory/Dockerfile missing
- Warn about unused template directories not in USER_TEMPLATE_IMAGES
- Fallback to old logic (build all) when USER_TEMPLATE_IMAGES undefined
- Maintains backward compatibility with existing installations
- Improves .env.example with better documentation and examples
2026-02-02 16:40:45 +01:00
XPS\Micro
95960ab7a9 add debug admin API for logs and database management 2026-02-01 13:41:28 +01:00
XPS\Micro
b41fd980ce fix: add SMTP and missing environment variables to docker-compose.yml
- Fix USER_TEMPLATE_IMAGES quoting in .env.example (prevent bash metacharacter issues)
- Add all SMTP configuration variables to docker-compose environment
- Add EMAIL service variables (FRONTEND_URL, MAGIC_LINK_EXPIRY, RATE_LIMIT)
- Add JWT and resource limit variables
- Improve environment variable organization with comments

SMTP variables were defined in .env but not passed to container, causing
email service configuration issues.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-01 10:24:51 +01:00
XPS\Micro
10b28179fc feat: implement dynamic template system with auto-detection
**Backend (config.py):**
- Add dynamic template loading from USER_TEMPLATE_IMAGES (.env)
- Add template metadata loading from templates.json
- Implement automatic type extraction from image names
- Remove hardcoded template definitions (dev/prod)
- Maintain legacy USER_TEMPLATE_IMAGE for backward compatibility

**Configuration:**
- Add templates.json with metadata for template-01, template-02, template-next
- Update .env.example with new USER_TEMPLATE_IMAGES variable (semicolon-separated)
- Document automatic template type extraction

**Installation (install.sh):**
- Implement auto-detection for all user-template-* directories
- Replace hardcoded template builds with dynamic loop
- Calculate TOTAL_BUILDS dynamically
- Add special handling for Next.js templates

**Documentation:**
- Move MVP_DEPLOYMENT_GUIDE.md to docs/install/DEPLOYMENT_GUIDE.md
- Add "Dynamic Template System" section to CLAUDE.md
- Update docs/install/README.md with Quick Links and dynamic system info
- Add references to deployment guide in CLAUDE.md

**Templates:**
- Reorganize user-template/ → user-template-01/ (Nginx Basic)
- Add user-template-02/ (Nginx Advanced)
- Keep user-template-next/ unchanged

**Benefits:**
- Unlimited number of templates (no longer hardcoded to 2)
- Metadata-driven display in dashboard
- Automatic image discovery and building
- Extensible without code changes

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-01 09:04:59 +01:00
XPS\Micro
79cf304ccf feat: implement multi-container MVP with dev and prod templates
Add full support for 2 container types (development and production):

Backend Changes:
- New UserContainer model with unique constraint on (user_id, container_type)
- Removed single-container fields from User model (container_id, container_port)
- Added CONTAINER_TEMPLATES config with dev and prod templates
- Implemented spawn_multi_container() method in ContainerManager
- Added 2 new API endpoints:
  * GET /api/user/containers - list all containers with status
  * POST /api/container/launch/<type> - on-demand container creation
- Multi-container container names and Traefik routing with type suffix

Frontend Changes:
- New Container, ContainersResponse, LaunchResponse types
- Implemented getUserContainers() and launchContainer() API functions
- Completely redesigned dashboard with 2 container cards
- Status display with icons for each container type
- "Create & Open" and "Open Service" buttons based on container status
- Responsive grid layout

Templates:
- user-template-next already configured with Tailwind CSS and Shadcn/UI

Documentation:
- Added IMPLEMENTATION_SUMMARY.md with complete feature list
- Added TEST_VERIFICATION.md with detailed testing guide
- Updated .env.example with USER_TEMPLATE_IMAGE_DEV/PROD variables

This MVP allows each user to manage 2 distinct containers with:
- On-demand lazy creation
- Status tracking per container
- Unique URLs: /{slug}-dev and /{slug}-prod
- Proper Traefik routing with StripPrefix middleware

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-31 20:33:07 +01:00
XPS\Micro
20a0f3d6af feat: Implement passwordless authentication with Magic Links
Major changes:
- Remove username and password_hash from User model
- Add MagicLinkToken table for one-time-use email authentication
- Implement Magic Link email sending with 15-minute expiration
- Update all auth endpoints (/login, /signup) to use email only
- Create verify-signup and verify-login pages for token verification
- Container URLs now use slug instead of username (e.g., /u-a3f9c2d1)
- Add rate limiting: max 3 Magic Links per email per hour
- Remove password reset functionality (no passwords to reset)

Backend changes:
- api.py: Complete rewrite of auth routes (magic link based)
- models.py: Remove username/password, add slug and MagicLinkToken
- email_service.py: Add Magic Link generation and email sending
- admin_api.py: Remove password reset, update to use email identifiers
- container_manager.py: Use slug instead of username for routing
- config.py: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT

Frontend changes:
- src/lib/api.ts: Update auth functions and User interface
- src/hooks/use-auth.tsx: Implement verifySignup/verifyLogin
- src/app/login/page.tsx: Email-only login form
- src/app/signup/page.tsx: Email-only signup form
- src/app/verify-signup/page.tsx: NEW - Signup token verification
- src/app/verify-login/page.tsx: NEW - Login token verification
- src/app/dashboard/page.tsx: Display slug instead of username

Infrastructure:
- install.sh: Simplified, no migration needed (db.create_all handles it)
- .env.example: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT
- Add IMPLEMENTATION-GUIDE.md with detailed setup instructions

Security improvements:
- No password storage = no password breaches
- One-time-use tokens prevent replay attacks
- 15-minute token expiration limits attack window
- Rate limiting prevents email flooding

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-31 16:19:22 +01:00
XPS\Micro
d188115db4 Add admin features and email verification
Backend:
- First registered user becomes admin automatically
- Email verification required before login
- Admin API with user management endpoints:
  - Block/unblock users
  - Reset passwords (sends email)
  - Delete user containers
  - Delete users
  - Resend verification emails
  - Takeover sessions (Phase 2 dummy)
- New decorators: @admin_required, @verified_required
- SMTP configuration for email sending
- UserState enum (registered/verified/active)
- Activity tracking (last_used field)

Frontend:
- Admin dashboard with color-coded user list
  - Green: active, recently used
  - Yellow: warning (unverified/inactive)
  - Red: critical (long unverified/very long inactive)
- Email verification flow (verify-success/verify-error pages)
- Signup shows verification instructions
- Login handles unverified accounts with resend option
- Admin link in dashboard header for admins

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:01:51 +01:00
XPS\Micro
c363351483 Initial project structure with documentation 2026-01-30 18:00:41 +01:00