Commit Graph
66 Commits
Author SHA1 Message Date
Juan Denis 83ba62bb08 feat(21-2): Add workflow deploy API endpoint 2026-01-19 12:38:12 -05:00
Juan Denis bead238379 feat(21-1): Create workflow deployment service 2026-01-19 12:37:48 -05:00
Juan Denis 9c4c5dd886 feat(20-3): Register workflow blueprint 2026-01-19 12:26:26 -05:00
Juan DenisandClaude Opus 4.5 5f48bb1a37 feat(20-2): Create workflow API endpoints
- GET /workflows - List all workflows for user
- GET /workflows/<id> - Get single workflow
- POST /workflows - Create new workflow
- PUT /workflows/<id> - Update workflow
- DELETE /workflows/<id> - Delete workflow
- JWT authentication and access control

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:25:21 -05:00
Juan DenisandClaude Opus 4.5 ee9826ff1f feat(20-1): Create Workflow model
- SQLAlchemy model with name, description, nodes, edges, viewport
- JSON string storage for React Flow state
- to_dict() method with node/edge counts
- User relationship and timestamps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:24:51 -05:00
Juan Denis 65d1fbef77 feat(12): Update app list response to include environment info and filtering 2026-01-19 10:32:23 -05:00
Juan Denis 748577149c feat(12): Add database credential propagation for linked apps 2026-01-19 10:31:16 -05:00
Juan Denis 3e4ba7007e feat(12): Add app linking API endpoints (link, unlink, get linked, update environment) 2026-01-19 10:30:15 -05:00
Juan Denis 34bee0e87b feat(12): Add environment linking fields to Application model 2026-01-19 10:29:35 -05:00
Juan DenisandClaude Opus 4.5 b5269e88b8 feat(11): Add test-db-connection API endpoint
POST /templates/test-db-connection - validates MySQL connection
- Required: host, user, password, database
- Optional: port (default 3306)
- Returns success/error with detailed message
- Includes warning if pymysql not available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:21:38 -05:00
Juan DenisandClaude Opus 4.5 b3187c35e5 feat(11): Add MySQL connection validation for external DB templates
- Add validate_mysql_connection() method to TemplateService
- Check port connectivity first, then full MySQL connection if pymysql available
- Falls back to port-only check if pymysql not installed
- Integrate validation into install_template() for wordpress-external-db
- Return clear error messages if database is unreachable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:20:53 -05:00
Juan DenisandClaude Opus 4.5 ad20feff86 feat(11): Register WordPress External DB template in index
Add wordpress-external-db to templates registry with:
- Categories: cms, blog, website, development
- Description highlighting dev/prod support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:19:46 -05:00
Juan DenisandClaude Opus 4.5 733705d205 feat(11): Create WordPress External Database template
New template for WordPress with external database support:
- No bundled MySQL container
- Configurable DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
- TABLE_PREFIX for multiple WordPress instances on same database
- Ideal for dev/prod environment sharing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:19:19 -05:00
Juan DenisandClaude Opus 4.5 4f5da492cc feat(14): Add version update check via GitHub releases API
Backend:
- Add /system/check-update endpoint
- Fetch latest release from GitHub API
- Compare versions and return update_available flag
- Cache results for 1 hour to respect rate limits

Frontend:
- Add checkUpdate() API method
- Add "Check for Updates" button in About section
- Show update available notification with release link
- Show "You're up to date" when current

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:09:59 -05:00
Juan DenisandClaude Opus 4.5 4c7f551936 feat(9): Add backend directory analysis and disk mount endpoints
- Add get_all_disk_mounts() using psutil for multi-mount support
- Add analyze_directory_sizes() for directory size analysis
- Add get_file_type_breakdown() for file categorization by type
- Add recursive helpers with depth limits for performance
- New endpoints: /files/disk-mounts, /files/analyze, /files/type-breakdown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 09:42:24 -05:00
Juan DenisandClaude Opus 4.5 189dead603 Add metrics API endpoints and auto-start collection
- Create metrics API blueprint with history, stats, and collection
  control endpoints
- Register blueprint at /api/v1/metrics
- Auto-start background metrics collection on app startup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 02:51:58 -05:00
Juan Denis d6f0ee9b8f feat(phase6): add MetricsHistoryService for data collection
Service provides metrics recording, querying by period, automatic
aggregation (minute to hour/day), and retention-based cleanup.
2026-01-19 02:50:17 -05:00
Juan Denis 8a54630124 feat(phase6): add MetricsHistory model for historical metrics
SQLite model with aggregation levels (minute/hour/day) for storing
CPU, memory, disk metrics with composite indexes for efficient queries.
2026-01-19 02:49:15 -05:00
Juan Denis 48534dc5ea feat(phase5): register private URLs API blueprint
Register private_urls_bp for /api/v1/apps/* private URL endpoints.
2026-01-19 02:37:10 -05:00
Juan Denis 9a16753ed8 feat(phase5): add Nginx private URL configuration
Adds methods to generate and manage Nginx configs for private URL
routing via /p/{slug}/ paths with automatic config regeneration.
2026-01-19 02:36:40 -05:00
Juan Denis 85cb72c685 feat(phase5): add private URL API endpoints
Endpoints for enabling, updating, disabling, and regenerating
private URLs. Includes public resolver endpoint for slug lookup.
2026-01-19 02:35:55 -05:00
Juan Denis 5b0af3b27e feat(phase5): add PrivateURLService for slug generation
Provides cryptographically secure slug generation and validation
with support for custom slugs and uniqueness checking.
2026-01-19 02:35:18 -05:00
Juan Denis d40f82ed27 feat(phase5): add private URL fields to Application model
Add private_slug and private_url_enabled fields to support
shareable private URLs for applications.
2026-01-19 02:34:53 -05:00
Juan DenisandClaude Opus 4.5 4d9ad82400 fix(3): handle all docker compose ps output formats
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>
2026-01-19 02:22:50 -05:00
Juan DenisandClaude Opus 4.5 4ba0afee97 fix(2): load .env file in CLI before app initialization
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>
2026-01-19 01:57:39 -05:00
Juan DenisandClaude Opus 4.5 3f9884c055 fix(2): parse NDJSON output from docker compose ps
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>
2026-01-19 01:56:43 -05:00
Juan DenisandClaude Opus 4.5 47acb0914c feat(1-1): add port accessibility to app status endpoint
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>
2026-01-19 01:06:37 -05:00
Juan DenisandClaude Opus 4.5 5ac5a85e90 feat(1-1): verify port accessibility after template installation
- 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>
2026-01-19 01:06:11 -05:00
Juan DenisandClaude Opus 4.5 1a2c39065c fix(1-1): validate port configuration on domain creation
- 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>
2026-01-19 01:05:33 -05:00
Juan DenisandClaude Opus 4.5 cb809ee4dd feat(1-1): add routing diagnostic API endpoints
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>
2026-01-19 01:05:05 -05:00
Juan DenisandClaude Opus 4.5 f14af7107e feat(1-1): add Nginx config diagnostics and routing checks
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>
2026-01-19 01:04:29 -05:00
Juan DenisandClaude Opus 4.5 5182d2326c feat(1-1): add port accessibility and container network diagnostics
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>
2026-01-19 01:03:51 -05:00
Juan Denis 6ea84d1482 Improve file service error handling and add root dir
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.
2026-01-19 00:38:20 -05:00
Juan Denis 122f099167 Fix log display for array and string formats
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.
2026-01-19 00:34:39 -05:00
Juan Denis b619779059 Add dynamic ServerKit version endpoint and UI
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.
2026-01-19 00:11:49 -05:00
Juan Denis c7eaafab6a Enhance app deletion and improve port allocation logic
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.
2026-01-19 00:01:33 -05:00
Juan Denis bf237c698d Add Docker database and app management endpoints
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.
2026-01-18 23:55:12 -05:00
Juan Denis 8d9f7f383f Add Docker app nginx config automation and port detection
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.
2026-01-18 23:51:04 -05:00
Juan DenisandClaude Opus 4.5 2701a49140 fix: Correct db import in template_service
Import db from 'app' not 'app.models'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 23:27:45 -05:00
Juan DenisandClaude Opus 4.5 bac265d80a fix: Add error tracing to template install endpoint
Added try-except with traceback logging to help debug 500 errors
during template installation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 23:24:22 -05:00
Juan DenisandClaude Opus 4.5 e36017bed6 fix: validate-install endpoint handles list-format variables
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>
2026-01-18 23:19:20 -05:00
Juan DenisandClaude Opus 4.5 22d5074834 fix: Template validation now handles list-format variables
The validate_template function was failing because it expected
variables in dict format but templates now use list format.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 23:04:31 -05:00
Juan DenisandClaude Opus 4.5 65ee8ea4cd Fix more templates: ghost, gitea, nextcloud, nginx-proxy-manager
- Convert variables to list format
- Use ${APP_NAME} for container names
- Standardize service names and port variables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:55:21 -05:00
Juan DenisandClaude Opus 4.5 e673be785d Fix template installation and variable handling
- Add APP_NAME as automatic variable for all template installs
- Handle both list and dict formats for template variables
- Update uptime-kuma, portainer, node-app templates with proper format
- Use ${APP_NAME} for container names instead of hardcoded values
- Standardize port variable names to HTTP_PORT

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:53:36 -05:00
Juan DenisandClaude Opus 4.5 9ec1a25f33 Fix: Support Docker container logs for apps
- get_app_logs now checks for docker-compose.yml first
- Uses 'docker compose logs' for containerized apps
- Falls back to nginx logs for host-based apps
- Added /var/serverkit and /var/www to allowed log directories

Fixes 'Failed to load logs' error for Docker-deployed apps.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:39:03 -05:00
Juan DenisandClaude Opus 4.5 cab18a32b7 Consolidate templates into backend/templates marketplace
- Removed duplicate root templates/ folder
- Added PHP, Python, Node.js templates to marketplace (YAML format)
- Templates now installable via web UI Templates page
- CLI create-app now points users to web UI
- All 63 templates in one place: backend/templates/

New templates:
- php-app: Custom PHP 8.0-8.3 with Apache
- python-app: Custom Python 3.9-3.12 (Flask/FastAPI/Django)
- node-app: Custom Node.js 18-21 (Express/Next.js)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:23:50 -05:00
jhd3197andClaude Opus 4.5 63a04d3319 Fix SQLite database path for Docker volume mount
- Create /app/instance directory in Dockerfile with proper permissions
- Update DATABASE_URL default to use absolute path (/app/instance/serverkit.db)
- Ensures the non-root appuser can write to the database location
- Fixes "unable to open database file" error on fresh installs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 01:47:02 +00:00
Juan Denis 893df4753b Add admin panel with user, settings, and audit log management
Introduces backend endpoints and models for admin features including user management, system settings, and audit logging. Adds RBAC middleware, audit log and system settings models, and services for audit and settings. Updates authentication to support setup flow and registration control. On the frontend, adds settings tabs for users and audit logs, a setup page, and updates routing and context to support setup and registration state. Styles and API service are updated to support new features.
2026-01-18 05:01:49 -05:00
Juan Denis 2fa790ac85 Refactor to consistently use app.root_path and update deployment model
Replaced all uses of app.path with app.root_path in backend API and service layers for consistency and correctness. Renamed the 'metadata' field to 'extra_data' in the Deployment model to avoid SQLAlchemy reserved word conflicts and updated related methods. Also updated frontend to import Toast context from the correct location and added new border and font size variables in styles.
2026-01-18 04:20:30 -05:00
Juan Denis 87c3a7ee79 Add application templates for multiple popular services
Added YAML templates for a wide range of self-hosted applications, including Authelia, BookStack, Caddy, Code Server, CrowdSec, Directus, Drone CI, Duplicati, Excalidraw, File Browser, GitLab Runner, Grafana, Grav, Home Assistant, Immich, Jaeger, Jellyfin, Jenkins, Jitsi, Keycloak, Loki, Matrix Synapse, Mattermost, MinIO, Mongo Express, Mosquitto, n8n, Navidrome, Netdata, Node-RED, Outline, Payload, pgAdmin, PhotoPrism, phpMyAdmin, Plex, Prometheus, Redis Commander, Registry, Rocket.Chat, Seafile, SonarQube, Strapi, Syncthing, Traefik, Umami, Vault, Vaultwarden, Wiki.js, WordPress, and Zigbee2MQTT. Updated index.json to include all new templates and categories, providing a comprehensive catalog for deployment.
2026-01-18 03:57:44 -05:00