Skip to content

Using Pode as a Service in Windows, MacOSX and Linux (Systemd)#1421

Open
mdaneri wants to merge 126 commits into
Badgerati:developfrom
mdaneri:service
Open

Using Pode as a Service in Windows, MacOSX and Linux (Systemd)#1421
mdaneri wants to merge 126 commits into
Badgerati:developfrom
mdaneri:service

Conversation

@mdaneri
Copy link
Copy Markdown
Contributor

@mdaneri mdaneri commented Oct 16, 2024

Description

This pull request introduces a new feature to the Pode framework: built-in cross-platform service management. With this update, users can now easily register, start, stop, suspend, resume, query, restart, and unregister Pode-based services on Windows, Linux, and macOS.

Key Features

  • New Service Functions:

    • Register-PodeService: Register a Pode-based service with customizable options such as username, startup type, logging, and more.
    • Start-PodeService: Start a registered service.
    • Stop-PodeService: Stop a running service.
    • Suspend-PodeService: Suspend a service (Windows only).
    • Resume-PodeService: Resume a suspended service (Windows only).
    • Restart-PodeService: Restart a service.
    • Get-PodeService: Query the status of a service, including Running, Stopped, or Paused.
    • Unregister-PodeService: Unregister a service with optional forceful stopping.
  • Cross-Platform Compatibility:

    • Windows: Uses Windows Service Manager and supports additional options like SecurityDescriptorSddl.
    • Linux: Manages services via systemd, with support for custom user creation.
    • macOS: Leverages launchctl for service management.

Examples

Register and Start a Service

Register-PodeService -Name "HelloService" -Description "Example Pode Service" -ParameterString "-Verbose" -Start

Stop a Service

Stop-PodeService -Name "HelloService"

Query a Service

Get-PodeService -Name "HelloService"

Documentation

The pull request includes comprehensive documentation covering:

  • Usage of all service-related functions with examples.

Bug Fixes

  • Addressed potential issues with missing service configuration files during unregistration.
  • Improved error handling and verbose logging across all service functions.

Notes

  • Users should ensure they have administrative/root privileges when using these functions.

Comment thread src/Private/Service.ps1 Fixed
@mdaneri mdaneri changed the title Pode as windows and linux service (work in progress) Pode as windows and linux service (ready) Oct 22, 2024
@mdaneri mdaneri changed the title Pode as windows and linux service (ready) Pode as windows and linux service (ready for testing) Oct 22, 2024
@mdaneri mdaneri marked this pull request as draft October 22, 2024 01:48
@mdaneri mdaneri changed the title Pode as windows and linux service (ready for testing) Pode as windows, Mac and linux service (ready for testing) Oct 22, 2024
@Badgerati Badgerati added priority: high Target for next release or soon after. A priority but not critical story-points: 8 High complexity. Large features, deep refactors, or security work. Requires extensive review/testing labels Feb 22, 2025
@A-wels
Copy link
Copy Markdown

A-wels commented Jun 1, 2026

@mdaneri @Badgerati What is missing on this pull request in order to merge it? Is there anything blocking it?

@Badgerati
Copy link
Copy Markdown
Owner

@A-wels There's a lot of conflicts from various other works and refactors that need resolving, it was also never reviewed/tested.

Is there something specific you're after here, which can't be achieved using exists Run as a Service docs?

@A-wels
Copy link
Copy Markdown

A-wels commented Jun 1, 2026

@Badgerati nssm has not been changed in 9 years and I really don't feel comfortable recommending it to my company. I would much prefer a native way to handle the Pode lifecycle on Windows.

@Badgerati
Copy link
Copy Markdown
Owner

@A-wels Thanks. Once I've finished with other tasks for Pode, I'll come back to this and review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: high Target for next release or soon after. A priority but not critical story-points: 8 High complexity. Large features, deep refactors, or security work. Requires extensive review/testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants