Skip to content

Add Windows support to database plugin - #1

Merged
Fonlogen merged 1 commit into
mainfrom
claude/elegant-cannon-5109rp
Oct 6, 2026
Merged

Fonlogen merged 1 commit into
mainfrom
claude/elegant-cannon-5109rp

Conversation

@Fonlogen

@Fonlogen Fonlogen commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds full Windows support to the Ervisio Database Plugin, enabling database management on Windows alongside the existing Linux support. The plugin now detects and manages native Windows services, discovers SQLite files in user profiles, and supports installation via winget.

Key Changes

Backend (db-bridge.py)

  • Platform detection: Added IS_WINDOWS flag and conditional logic throughout to handle Windows-specific operations
  • UTF-8 output: Explicitly configure stdout to UTF-8 on all platforms to prevent console code page issues
  • Windows service management:
    • New windows_database_services() function queries Windows service manager via PowerShell for MariaDB, MySQL, and PostgreSQL services
    • action_manage_instance() now supports net.exe commands (start/stop/restart) for Windows native services
  • SQLite discovery: New find_sqlite_windows() function recursively searches user profile and %ProgramData% for SQLite files (with depth and count limits to avoid noise)
  • Installation: New action_install_winget() function installs databases via winget on Windows; action_install_apt() delegates to it when on Windows
  • Privilege handling: New privileged() helper function adds sudo only on Linux when not root; Windows uses manifest-based elevation
  • File operations:
    • New tail_file() function replaces external tail command (unavailable on Windows)
    • action_create_sqlite() now expands ~ in paths
    • read_payload_file() searches Windows user directories instead of /home/*
  • MySQL socket handling: Unix socket detection skipped on Windows
  • Subprocess improvements: Added encoding="utf-8" and errors="replace" to all subprocess.run() calls; Windows subprocess creation uses CREATE_NO_WINDOW flag

Frontend (React/TypeScript)

  • Instance management: Updated InstancesView.tsx to use inst.service field for native Windows services
  • Installation dialog:
    • Detects platform and shows "Native (winget)" label on Windows vs "Native (APT)" on Linux
    • Windows-specific package options with winget IDs (e.g., MariaDB.Server, Oracle.MySQL)
    • Default SQLite path set to C:\ProgramData\Ervisio\data\database.sqlite on Windows
    • PostgreSQL password passed to winget on Windows only

Manifest & Configuration

  • Version: Bumped to 1.2.0
  • Platform declaration: Added platforms: ["linux", "windows"] to manifest
  • Minimum core: Set minCore: 0.6.2 (required for Windows support)
  • Windows command: Added separate db-bridge command entry using python.exe with Windows path
  • Permissions: Added docker-users group for Windows (allows non-admin Docker operations)

CI/CD

  • Ervisio version: Updated to v0.6.2 in both CI and release workflows
  • Windows testing: New bridge-windows job on windows-2022 runner that:
    • Compiles Python bridge
    • Smoke-tests detect, create-sqlite, and query actions
    • Validates JSON output format

Documentation

  • README: Added Windows section documenting requirements (Python 3.10+, docker.exe, winget), service detection/control, and required Python packages
  • CHANGELOG: Documented 1.2.0 release with Windows features and dependency removals

Notable Implementation Details

  • The bridge no longer depends on external sudo or tail commands, improving portability
  • Windows service names are validated with SERVICE_RE regex before use
  • SQLite discovery on Windows limits recursion depth (4 levels) and results per root (15 files) to avoid performance issues
  • PowerShell is used to query Windows services with JSON output for reliable parsing
  • The privileged() function checks os.geteuid() only when available (Unix systems)
  • All subprocess calls now explicitly handle encoding to prevent platform-specific character issues

https://claude.ai/code/session_016Xq7cCtgmRF34jJo3GAqfC

…idge)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Xq7cCtgmRF34jJo3GAqfC
@Fonlogen
Fonlogen merged commit aa593e8 into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants