Commit Graph

5 Commits

Author SHA1 Message Date
d592b58b75 feat(logging): add comprehensive logging to all API routes (Phase 4)
Applied withLogging() wrapper to all 24 API routes for consistent logging:

Process Control Routes:
- Start/stop/restart individual processes
- Start-all/stop-all/restart-all batch operations

Signal Routes:
- Signal individual processes
- Signal all processes
- Signal process groups

Group Management Routes:
- Start/stop/restart process groups
- Signal operations for groups

Configuration Routes:
- Get all configs (GET)
- Reload configuration (POST)
- Add/remove process groups (POST/DELETE)

Log Routes:
- Read main supervisord log
- Read process stdout/stderr logs
- Clear process logs (individual and all)

System Routes:
- Get system info
- Get all processes info
- Get individual process info
- Send stdin to process

All routes now include:
- Request/response logging with timing
- Automatic error handling and correlation IDs
- X-Request-ID header propagation
- Consistent metadata in responses

Also fixed Next.js 16 deprecation:
- Moved experimental.serverComponentsExternalPackages to serverExternalPackages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:53:23 +01:00
b252a0b3bf feat: implement comprehensive logging infrastructure (Phases 1-3)
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m50s
Added production-ready logging using Pino with structured JSON output,
pretty printing in development, and automatic sensitive data redaction.

## Phase 1: Core Logger Setup
- Installed pino, pino-http, and pino-pretty dependencies
- Created logger utility (lib/utils/logger.ts):
  - Environment-based log levels (debug in dev, info in prod)
  - Pretty printing with colors in development
  - JSON structured logs in production
  - Sensitive data redaction (passwords, tokens, auth headers)
  - Custom serializers for errors and requests
  - Helper functions for child loggers and timing
- Added LOG_LEVEL environment variable to .env.example
- Configured Next.js for Turbopack with external pino packages

## Phase 2: API Request Logging
- Created API logger wrapper (lib/utils/api-logger.ts):
  - withLogging() HOF for wrapping API route handlers
  - Automatic request/response logging with timing
  - Correlation ID generation (X-Request-ID header)
  - Error catching and structured error responses
  - logPerformance() helper for timing operations
  - createApiLogger() for manual logging in routes

## Phase 3: Supervisor Client Logging
- Updated lib/supervisor/client.ts:
  - Added logger instance to SupervisorClient class
  - Comprehensive XML-RPC call logging (method, params, duration)
  - Error logging with full context and stack traces
  - Success logging with result size tracking
  - DEBUG level logs for all XML-RPC operations
  - Constructor logging for client initialization

## Configuration Changes
- Updated next.config.ts for Turbopack compatibility
- Added serverComponentsExternalPackages for pino
- Removed null-loader workaround (not needed)

## Features Implemented
 Request correlation IDs for tracing
 Performance timing for all operations
 Sensitive data redaction (passwords, auth)
 Environment-based log formatting
 Structured JSON logs for production
 Pretty colored logs for development
 Error serialization with stack traces
 Ready for log aggregation (stdout/JSON)

## Next Steps (Phases 4-7)
- Update ~30 API routes with logging
- Add React Query/hooks error logging
- Implement client-side error boundary
- Add documentation and testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:44:46 +01:00
f2d89d8333 fix: enable standalone output and remove public directory copy
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m38s
- Re-enable output: 'standalone' in next.config.ts for Docker builds
- Remove public directory copy from Dockerfile (not needed for this project)
- Standalone mode works with force-dynamic routing to prevent SSR issues

Fixes Gitea Actions build failure where .next/standalone was not found
2025-11-23 19:00:34 +01:00
5bda617339 feat: add log viewer components and fix build issues
Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 53s
- Add LogViewer component with syntax highlighting and auto-scroll
- Add LogControls for play/pause, auto-scroll, refresh, download, clear
- Add LogSearch component with search highlighting
- Add Input UI component
- Fix TypeScript type issues in ProcessCard and types.ts
- Fix XML-RPC client type issues
- Add force-dynamic to layout to prevent SSR issues with client components
- Add mounted state to Navbar for theme toggle hydration
- Add custom 404 page

Components added:
- components/logs/LogViewer.tsx - Main log viewer with real-time display
- components/logs/LogControls.tsx - Control panel for log viewing
- components/logs/LogSearch.tsx - Search input for filtering logs
- components/ui/input.tsx - Reusable input component

Fixes:
- ProcessStateCode type casting in ProcessCard
- XML-RPC client options type (use any to avoid library type issues)
- canStartProcess/canStopProcess type assertions
- Dynamic rendering to prevent SSR hydration issues

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 18:43:55 +01:00
e0cfd371c0 feat: initial commit - Supervisor UI with Next.js 16 and Tailwind CSS 4
Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 1m22s
- Modern web interface for Supervisor process management
- Built with Next.js 16 (App Router) and Tailwind CSS 4
- Full XML-RPC client implementation for Supervisor API
- Real-time process monitoring with auto-refresh
- Process control: start, stop, restart operations
- Modern dashboard with system status and statistics
- Dark/light theme with OKLCH color system
- Docker multi-stage build with runtime env var configuration
- Gitea CI/CD workflow for automated builds
- Comprehensive documentation (README, IMPLEMENTATION, DEPLOYMENT)

Features:
- Backend proxy pattern for secure API communication
- React Query for state management and caching
- TypeScript strict mode with Zod validation
- Responsive design with mobile support
- Health check endpoint for monitoring
- Non-root user security in Docker

Environment Variables:
- SUPERVISOR_HOST, SUPERVISOR_PORT
- SUPERVISOR_USERNAME, SUPERVISOR_PASSWORD (optional)
- Configurable at build-time and runtime

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 18:23:51 +01:00