The compose_ps function now handles:
- NDJSON: One JSON object per line (newer docker versions)
- JSON Array: Single line with array of objects
- Warning messages: Skip lines starting with 'time=' or 'WARN'
- Both dict and list parsed results
This fixes 'str' object has no attribute 'get' error when
docker compose outputs warnings before JSON.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 3 plan for testing PHP app template:
- Verify template exists and is valid
- Install PHP app via API
- Validate Bug 1 fix (container detection)
- Test PHP execution and Nginx routing
- Document results
Includes validation of Phase 2 NDJSON parsing fix.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SUMMARY.md: Document test results, bugs found and fixed
- STATE.md: Mark Phase 2 complete, update current phase to 3
- ROADMAP.md: Update Phase 2 status to completed
WordPress deployment verified working. Critical NDJSON parsing
bug fixed that affected container detection across the codebase.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CLI commands failed with "unable to open database file" because
environment variables weren't loaded from .env before create_app().
Now checks multiple .env locations:
- Same directory as cli.py
- Parent directory
- /opt/serverkit/.env (production)
- /opt/serverkit/backend/.env
Add --debug flag to show which env file was loaded.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
docker compose ps --format json outputs NDJSON (one JSON object per
line), not a JSON array. Parse each line separately to correctly
detect running containers.
This fixes container detection in app status and diagnostics.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 2 plan for testing WordPress template end-to-end:
- Verify template exists and is valid
- Install WordPress via API
- Verify container and database status
- Test Nginx routing and domain access
- Access WordPress installation wizard
- Document results and issues
Uses Phase 1 diagnostic tools for troubleshooting.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SUMMARY.md: Document all changes, commits, and testing checklist
- STATE.md: Mark Phase 1 complete, update current phase to 2
- ROADMAP.md: Update Phase 1 status to completed
Phase 1 delivered diagnostic tools for identifying routing issues
between domains, Nginx, and Docker containers.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shell script to test the full Docker app routing chain:
- Port accessibility check
- Nginx config existence and enablement
- Nginx syntax validation
- Service status check
- Direct backend HTTP request
- Domain routing via Host header
- Docker container status and port bindings
Provides colored output and actionable hints for failures.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show port accessibility status in overview
- Add RoutingDiagnosticsCard component for Docker apps
- Run full diagnostics with health checks
- Display Nginx config status, Docker status, issues and recommendations
- Show Nginx config content for debugging
- Add corresponding LESS styles
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GET /api/v1/apps/{id}/status now returns:
- port: The configured port number
- port_accessible: Boolean indicating if the port is reachable
Helps frontend display real-time routing health status.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Wait for containers to start after docker compose up
- Check if configured port is accessible
- Include port status in installation response
- Log warning if port not accessible (may need more startup time)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Require Docker apps to have a port configured before adding domains
- Check port accessibility and include warning if port not reachable
- Provides actionable error messages with hints for resolution
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New endpoints for debugging domain/container routing:
- GET /api/v1/domains/debug/diagnose/{app_id}: Full diagnostic report
with app config, domains, nginx status, docker containers, health
assessment and actionable recommendations
- POST /api/v1/domains/debug/test-routing/{app_id}: Active routing
tests to verify traffic flow
Both endpoints require admin access.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add diagnostic methods to NginxService:
- get_site_config(): Get config content, enabled status, parsed info
- diagnose_site(): Full diagnostic with health check and recommendations
- check_site_routing(): Test the complete routing chain
Includes automatic health assessment and actionable recommendations.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add diagnostic methods to DockerService:
- check_port_accessible(): Test if a port has something listening
- get_container_port_bindings(): Get port mappings for a container
- get_container_network_info(): Get full network settings including IPs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Detailed 8-task plan to fix port mapping and domain routing
- Adds diagnostic methods to DockerService and NginxService
- New debug endpoint for full routing diagnosis
- Frontend diagnostic UI for ApplicationDetail page
- Test script for manual verification
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- PROJECT.md: Define enhancement goals and success criteria
- ROADMAP.md: 10-phase plan covering Docker debugging, template
testing, private URLs, and UI polish
- STATE.md: Track progress across all phases
- Replace strategic roadmap with actionable implementation plan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added '/var/serverkit' to ALLOWED_ROOTS for file browsing. Enhanced error handling for owner/group resolution to support missing pwd/grp modules and additional exception types. Improved get_disk_usage to check for path existence, handle permission errors, and avoid division by zero.
Updated log fetching logic in LogsTab to handle both array and string formats for Docker and regular app logs, ensuring logs are displayed correctly regardless of backend response structure.
Replaces a generic API call with api.getApps() and corrects the property access for apps data, ensuring only Docker apps are filtered and set. This resolves issues with loading and displaying Docker apps in the DockerDatabasesTab component.
Introduces UI and API integration for managing and querying databases running inside Docker containers, including a new 'Docker Apps' tab in the Databases page. Enhances the QueryRunner to support Docker databases and updates the ApplicationDetail logs tab to handle Docker app logs with auto-refresh. Adds corresponding API methods for Docker database and log operations.
Introduces a new /system/version API endpoint in the backend to provide the current ServerKit version, reading from possible VERSION files. Updates the frontend About section to fetch and display the version dynamically instead of hardcoding it.
App deletion now performs Docker cleanup, removes app folders, and cleans up Nginx configs, returning detailed cleanup results. TemplateService port variable generation now avoids ports in use by Docker containers and system processes, improving reliability for dynamic port assignment.
Implements endpoints for managing and querying MySQL/PostgreSQL databases running in Docker containers, including listing containers, databases, tables, and executing queries. Adds endpoints for retrieving app logs and real-time status for Docker apps. Updates template variable processing to flag auto-generated and hidden variables. Extends DatabaseService with Docker MySQL/PostgreSQL discovery and query utilities.
Automatically create, update, and delete nginx configs for Docker applications when domains are added or removed. Adds an endpoint to manually regenerate nginx configs for Docker apps. Updates TemplateService to detect port from multiple possible variable names (PORT, HTTP_PORT, WEB_PORT) when creating Docker app records.
- Add docker network prune and docker system prune before builds
- Use --no-cache for docker compose build to ensure fresh builds
- Add --force / -f flag to skip version check during update
- Helps prevent Docker networking issues
Usage: sudo serverkit update --force
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Same bug as before - the validate_installation function was using
.items() on variables expecting a dict, but templates now use
list format.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>