Commit Graph

9 Commits

Author SHA1 Message Date
813f6d4c75 fix: make ReloadConfigResult fields optional with default empty arrays
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m33s
The Supervisor API doesn't always return 'changed' and 'removed' arrays
when reloading configuration, causing Zod validation errors.

Made all three fields (added, changed, removed) optional with default
empty arrays to handle cases where the API omits them.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 05:32:58 +01:00
f83ecf864a fix: make autorestart field optional in ConfigInfo schema
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m10s
The autorestart field is not always present in the Supervisor API
response for getAllConfigInfo(), causing Zod validation errors.

Changed autorestart from required to optional field using .optional().

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 23:04:04 +01:00
bdec163fb0 refactor: simplify readLog to use standard Supervisor XML-RPC API
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m11s
Removed SUPERVISOR_LOGFILE environment variable and simplified readLog()
to use the standard 2-parameter XML-RPC API that relies on supervisord's
configured logfile path.

Changes:
- Removed SUPERVISOR_LOGFILE from .env.example
- Simplified SupervisorClient.readLog() to accept only offset and length
- Removed logfile path parameter and all environment variable logic
- Fixed mobile nav container padding (removed px-4 py-6)

The readLog() method now uses the standard supervisor.readLog(offset, length)
XML-RPC call, which automatically reads from the logfile path configured
in supervisord.conf.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 22:58:03 +01:00
c50274452c feat: make Supervisor logfile path configurable via environment variable
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m12s
Added SUPERVISOR_LOGFILE environment variable to configure the path to
the Supervisor main logfile for reading via XML-RPC.

Changes:
- Added SUPERVISOR_LOGFILE to .env.example with default path
- Removed getLogfilePath() method and cachedLogfilePath field from SupervisorClient
- Updated readLog() to use environment variable with fallback chain:
  1. Explicitly provided logfilePath parameter
  2. SUPERVISOR_LOGFILE environment variable
  3. Default: /var/log/supervisor/supervisord.log
- Added debug logging to readLog() for troubleshooting

This allows users to configure the correct logfile path for their
Supervisor installation when using the custom 3-parameter XML-RPC
readLog implementation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 22:46:53 +01:00
145d37193c fix: update ConfigInfo schema to match Supervisor API response
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m11s
Updated the ConfigInfoSchema to accurately reflect the data structure
returned by Supervisor's getAllConfigInfo() XML-RPC method, fixing Zod
validation errors on the /config page.

Schema changes:
- Removed fields not in API: environment, priority, process_name, numprocs, numprocs_start, username
- Added missing fields: autorestart, killasgroup, process_prio, group_prio, stdout_syslog, stderr_syslog, serverurl
- Fixed type mismatches:
  - stopsignal: string → number (API returns signal numbers like 15)
  - uid: number|null → string (API returns username strings)
  - directory: string|null → string

Updated ConfigTable.tsx to use process_prio instead of priority and
removed the non-existent numprocs column.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 22:39:33 +01:00
20877abbc7 fix: update supervisor.readLog to accept 3 parameters with logfile path
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m10s
Update the readLog method to match custom Supervisor API requirements:
- Add third parameter (logfile_path) to supervisor.readLog call
- Retrieve logfile path from supervisor.getAPIVersion() metadata
- Cache logfile path after first retrieval to avoid repeated API calls
- Support optional explicit logfile_path parameter
- Fallback to default path if metadata extraction fails

Implementation details:
- Added cachedLogfilePath private field to SupervisorClient
- Added private getLogfilePath() method to extract path from API version
- Updated readLog signature: (offset, length, logfilePath?)
- Automatic path retrieval when logfilePath not provided
- Supports multiple metadata formats (logfile, logfile_path properties)
- Logs warnings if path extraction fails, uses sensible default

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 22:27:53 +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
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