Servy Windows Service Manager

repository·main·Indexed 23 days ago

https://github.com/aelassas/servy

A comprehensive Windows service manager that allows developers to run any application (such as Node.js, Python, .NET, Go, and Java) as a native Windows service. Servy provides advanced control over process lifecycles, resource allocation (CPU affinity, priority), and real-time monitoring of CPU/RAM. It features a CLI (servy-cli), Desktop GUI, and PowerShell module, supporting automatic restarts, lifecycle hooks, and flexible security configurations for local system or domain accounts.

Tokens
3.6K
Snippets
11
Records
25
Agent score
83%

What's inside Servy

  1. Overview of Servy features

    main

    Servy is a full-featured Windows service manager designed to run any application (Node.js, Python, .NET, etc.) as a native service. Key capabilities include:

    • Lifecycle Management: Automatic restarts on crash/hang, pre-launch/post-launch hooks, and pre-stop/post-stop hooks.
    • Resource Control: Set process priority, CPU affinity, and working directories.
    • Monitoring: Real-time CPU/RAM monitoring, stdout/stderr streaming to console or log files (with rotation), and health checks.
    • Security: Supports running services as Local System, local/domain accounts, Active Directory accounts, or gMSAs. Executables are digitally signed.
    • Management Interfaces: Desktop GUI (Servy Manager), CLI (servy-cli), and a PowerShell module.
    • Compatibility: Windows 7 SP1 to 11 (x64/ARM64) and Windows Server editions.
  2. Overview of Servy features and use cases

    main

    Servy is a tool designed to run any application as a native Windows service. It serves as a full-featured alternative to sc.exe, NSSM, and WinSW.

    Key Capabilities:

    • Run any application: Supports Node.js, Python, Go, .NET, Java, Rust, PHP, Ruby, and more.
    • Custom Working Directory: Unlike sc.exe, Servy allows you to explicitly define the startup directory, which is critical for applications relying on relative paths.
    • Robust Monitoring: Includes built-in health checks, CPU/RAM monitoring, and automatic restarts if the app crashes, hangs, or stops.
    • Lifecycle Hooks: Supports pre-launch, post-launch, pre-stop, and post-stop hooks.
    • Logging & Streaming: Provides live stdout and stderr streaming and built-in logging.
    • Automation: Can be managed via a Desktop UI, a CLI, or a PowerShell module for CI/CD pipelines.
    • Service Management: Features service dependencies visualization and configurable restart policies.
  3. Install Servy via package managers

    main

    You can install Servy using WinGet, Chocolatey, or Scoop.

    WinGet

    winget install servy

    Chocolatey

    choco install -y servy

    Scoop

    scoop bucket add extras
    scoop install servy
    winget install servy
  4. Install Servy via Scoop

    main

    To install Servy using the Scoop package manager, you must first update Scoop, add the aelassas bucket and the extras bucket, and then search for or install the package.

    Follow these steps in order:

    scoop update
    scoop bucket add aelassas https://github.com/aelassas/scoop-bucket
    scoop bucket add extras
    scoop search servy
    scoop install servy
    scoop uninstall servy
  5. Generate new winget manifests for Servy

    main

    To generate a new installer manifest for Servy using the wingetcreate tool, use the update command. You must provide the package identifier (aelassas.Servy), the target version, and the direct URL to the release asset (e.g., the .exe installer).

    wingetcreate update aelassas.Servy --version 1.1 --url https://github.com/aelassas/servy/releases/download/v1.1/servy-1.1-net8.0-x64-installer.exe
  6. Submit a new winget manifest PR

    main

    To contribute a new version of Servy to the microsoft/winget-pkgs repository, follow these steps:

    1. Create a new branch: git checkout -b <version-branch-name>
    2. Add the generated manifest files: git add manifests/a/aelassas/Servy/<version>/*
    3. Commit the changes: git commit -m "New version: aelassas.Servy version <version>"
    4. Push the branch to your origin.
    5. Open a Pull Request at https://github.com/winget-pkgs.
    git checkout -b servy-1.1
    git add manifests/a/aelassas/Servy/1.1/*
    git commit -m "New version: aelassas.Servy version 1.1"
    git push origin servy-1.1
  7. Run an application as a Windows service using the CLI

    main

    Use the servy-cli install command to wrap an executable as a Windows service. You can specify the service name, the path to the executable, the working directory, and any parameters required by the application.

    Example: Running a Node.js application as a service named MyService located in C:\MyServer.

    servy-cli install `
      --name="MyService" `
      --path="C:\Program Files\nodejs\node.exe" `
      --startupDir="C:\MyServer" `
      --params="server.js"    
  8. Test Servy installation via winget

    main

    To ensure the package is correctly indexed and installable via the winget CLI, run the following test sequence:

    1. Update local sources: winget source update
    2. Inspect package details: winget show servy
    3. Search for the package: winget search servy
    4. Perform a standard install: winget install servy
    5. Perform a silent install: winget install servy --silent
    6. Verify uninstallation: winget uninstall servy
    winget source update
    winget show servy
    winget search servy
    winget install servy
    winget install servy --silent
    winget uninstall servy
  9. Test a Scoop manifest locally

    main

    To test a Scoop manifest locally before publishing, you can install the JSON manifest file directly using scoop install. After testing, you can uninstall the application using its name.

    Note: If you encounter encoding issues, ensure the file is saved with UTF-8 encoding using the provided PowerShell command.

    scoop install servy.json
    scoop uninstall servy
  10. Verify winget manifests

    main

    Before submitting a manifest, verify its validity and test the installation locally using the following commands. Replace the path with the directory containing your specific version manifest.

    winget validate .\manifests\a\aelassas\Servy\1.1\
    winget install --manifest .\manifests\a\aelassas\Servy\1.1\