Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 95 commits into
base: develop
Choose a base branch
from

Conversation

mdaneri
Copy link
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.

src/Private/Service.ps1 Fixed Show fixed Hide 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
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.

1 participant