ghalet

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 36 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ghalet

Test Status Coverage Status MIT License PkgGoDev Ask DeepWiki

日本語

A lightweight, simple supervisor for GitHub Actions self-hosted runners

  • Runs as a single Go daemon with a configuration file
    • No dependencies on components such as Kubernetes or databases
    • A small footprint and minimal stored state make setup and rebuilding easy
  • Scales runners on demand
    • Runners run as lightweight native processes on the host
    • A configurable execution user provides basic privilege separation
  • Manages multiple repositories and organizations together
    • Share one host across multiple projects
    • Fine-grained concurrency control through global and per-target scaling settings

One ghalet daemon starts native runners on demand within host-wide and per-target limits

By design, ghalet does not provide strict isolation between runners. It is intended for standalone, dedicated hosts, such as:

  • High-performance dedicated build machines
  • Single-purpose VMs
  • Home servers, such as a Mac mini or a spare laptop

ghalet manages GitHub Actions Runner Scale Sets on Linux and macOS. Each runner handles one job, then exits; ghalet cleans up its runner directory and workspace. It scales runner processes on one host, not the hosts themselves. It does not orchestrate multiple machines or provision per-job VMs or containers. Ephemeral registration is not job isolation: jobs share the execution user's HOME, tools, caches and privileges. Use only trusted workflows, not untrusted fork PRs or hostile code. Docker actions, job containers and service containers are unsupported.

Installation

Linux .deb/.rpm packages with a systemd unit and a GHCR container image are also built for releases. See packages and containers for installation, configuration, and updates.

Install with Homebrew:

brew install Songmu/tap/ghalet

Or install with Go:

go install github.com/Songmu/ghalet/cmd/ghalet@latest

See getting started for host prerequisites and execution user requirements.

Quick start

Follow getting started for authentication, configuration, a complete workflow, and your first job. It also covers macOS service setup with Homebrew. For ongoing operation, use systemd on Linux or launchd on macOS.

Commands

All commands accept --config PATH. A target is one configured repository or organization registration, identified locally by its id.

Command Purpose
ghalet run Run the daemon in the foreground for all configured targets.
ghalet apply Drain targets, reload configuration, and reconcile registrations, attempting to delete unused scale sets.
ghalet config validate Validate configuration and local paths without contacting GitHub.
ghalet app setup --scope OWNER/REPO --scale-set ghalet-runner Create and install a private GitHub App, save managed authentication, and print any required static target configuration. See App setup for organization scopes, SSH and resumption.
ghalet systemd app setup --scope OWNER/REPO --scale-set ghalet-runner Set up an App with encrypted service credentials and the target's runtime key reference (Linux/root). See App setup.
ghalet credential set NAME --prompt Save an owner-only credential file and update managed defaults without rewriting static config. See ordinary credentials for App keys and replacement.
ghalet systemd credential set NAME --prompt Register an encrypted service PAT and update managed defaults (Linux/root). See credentials for App keys, automation and rotation.
ghalet list List accessible daemons, management UIDs, sockets and running snapshots; filter with --config PATH.
ghalet status Read state and capacity; a successful response does not imply health.
ghalet doctor Diagnose the daemon; exit nonzero for any problem.
ghalet gc [--dry-run] Clean verified stopped executions and expired logs; preview with --dry-run.

ghalet --version prints the installed version. Management responses are JSON, except for the App/credential setup instructions. systemd app setup and systemd credential set defaults to /etc/ghalet/config.yaml. Without --config, status, doctor, apply, and gc automatically select the single accessible daemon; multiple daemons require an explicit config. With none found, the per-user default ~/.config/ghalet/config.yaml is used, as it is for run and config validate. See configuration apply and diagnosis and cleanup for exit codes, offline maintenance and deletion safeguards.

Runtime behavior

Host capacity defaults to two, with per-target limits and optional idle warm pools. Assigned jobs take priority. Atomic state files and kernel process identities support crash recovery; unverifiable executions retain capacity.

Runner archives are automatically downloaded for the pinned version and verified against official SHA-256 digests. Daemon stdout is JSONL; runner logs are archived before cleanup by default. See operations for retries, recovery and log policy.

Documentation

Start with the documentation index, readable directly in the repository or on the documentation site. All guides are available in English and Japanese.

Development

See the contributor guide for development, testing, packaging, and documentation site maintenance.

Author

Songmu

Documentation

Index

Constants

View Source
const Version = "0.2.3"

Version is the application version.

Variables

View Source
var Revision = "HEAD"

Revision is the source revision, set at build time.

Functions

func RunDaemon

func RunDaemon(ctx context.Context, config *settings.Config) error

RunDaemon runs the daemon until ctx is canceled and its runners are drained.

func RunRunnerGuard added in v0.2.3

func RunRunnerGuard(runner string) error

RunRunnerGuard supervises a runner using the inherited controller-liveness and exit-report descriptors and the process's standard streams.

func RunRunnerUser added in v0.2.3

func RunRunnerUser(runner string) error

RunRunnerUser executes a delegated runner operation using the process's standard streams. A non-empty runner selects the launch protocol.

Types

type ApplyResult added in v0.0.2

type ApplyResult struct {
	Status  *Status
	Results []OperationResult
}

ApplyResult includes the applied snapshot and individual reconciliation results.

func Apply added in v0.0.2

func Apply(ctx context.Context, path string) (ApplyResult, error)

Apply asks the running daemon to reload its configuration and waits for completion.

type DaemonInfo added in v0.0.2

type DaemonInfo struct {
	UID    int    `json:"uid"`
	Socket string `json:"socket"`
	Status Status `json:"status"`
}

DaemonInfo identifies an accessible daemon and its running snapshot.

func ListDaemons added in v0.0.2

func ListDaemons(ctx context.Context, config string) ([]DaemonInfo, error)

ListDaemons finds responsive daemons accessible to the management user. A nonempty config path limits discovery to that configuration.

type OperationError

type OperationError string

OperationError reports a management failure returned with the daemon's results.

func (OperationError) Error

func (e OperationError) Error() string

type OperationResult

type OperationResult struct {
	TargetID string `json:"targetId,omitempty"`
	RunID    string `json:"runId,omitempty"`
	Path     string `json:"path,omitempty"`
	Action   string `json:"action,omitempty"`
	Error    string `json:"error,omitempty"`
}

func GC

func GC(ctx context.Context, path string, dryRun bool) ([]OperationResult, error)

GC cleans stopped executions and expired logs, returning partial results on error.

type Problem

type Problem struct {
	Path     string `json:"path,omitempty"`
	TargetID string `json:"targetId,omitempty"`
	RunID    string `json:"runId,omitempty"`
	Reason   string `json:"reason"`
}

type RunState

type RunState struct {
	Schema   int    `json:"schema"`
	RunID    string `json:"runId"`
	TargetID string `json:"targetId"`
	// Retained for existing state files, not used to identify registrations.
	ScopeRef     string                      `json:"scopeRef,omitempty"`
	ScopeURL     string                      `json:"scopeUrl"`
	GroupName    string                      `json:"groupName"`
	GroupID      int                         `json:"groupId"`
	ScaleSetName string                      `json:"scaleSetName"`
	ScaleSetID   int                         `json:"scaleSetId"`
	RunnerName   string                      `json:"runnerName"`
	RunnerID     int                         `json:"runnerId,omitempty"`
	User         string                      `json:"user"`
	UID          int                         `json:"uid"`
	Home         string                      `json:"home"`
	RunnerDir    string                      `json:"runnerDir"`
	Workspace    string                      `json:"workspace"`
	Phase        string                      `json:"phase"`
	Process      procgroup.ProcessIdentity   `json:"process"`
	Members      []procgroup.ProcessIdentity `json:"members,omitempty"`
	UpdatedAt    time.Time                   `json:"updatedAt"`
	StartedAt    time.Time                   `json:"startedAt,omitempty"`
	Ready        bool                        `json:"ready"`
	Busy         bool                        `json:"busy"`
	ProcessDone  bool                        `json:"processDone"`
	Error        string                      `json:"error,omitempty"`
}

type Status

type Status struct {
	Config   string         `json:"config"`
	Capacity int            `json:"capacity"`
	Occupied int            `json:"occupied"`
	Targets  []TargetStatus `json:"targets"`
	Runs     []*RunState    `json:"runs"`
	Problems []Problem      `json:"problems"`
}

func Doctor

func Doctor(ctx context.Context, path string) (*Status, error)

Doctor returns diagnostics, including a snapshot when problems are found.

func GetStatus

func GetStatus(ctx context.Context, path string) (*Status, error)

GetStatus returns the running daemon's snapshot without reloading its config.

type TargetStatus

type TargetStatus struct {
	ID          string `json:"id"`
	Scope       string `json:"scope"`
	RunnerGroup string `json:"runnerGroup"`
	ScaleSet    string `json:"scaleSet"`
	Assigned    int    `json:"assignedJobs"`
	Pending     int    `json:"pendingAcquisitions"`
	Active      int    `json:"activeRunners"`
	Draining    bool   `json:"draining"`
	Forced      bool   `json:"forced"`
	Fault       string `json:"fault,omitempty"`
	ScaleSetID  int    `json:"scaleSetId,omitempty"`
}

Directories

Path Synopsis
Package appsetup creates a private GitHub App from a Manifest and configures one GitHub.com target without starting or reconfiguring the daemon.
Package appsetup creates a private GitHub App from a Manifest and configures one GitHub.com target without starting or reconfiguring the daemon.
cmd
ghalet command
Package config loads and validates ghalet settings and storage policy.
Package config loads and validates ghalet settings and storage policy.
Package credentialstore manages encrypted systemd credentials for ghalet.
Package credentialstore manages encrypted systemd credentials for ghalet.
Package fshelper provides directory validation and atomic file writes for ghalet's managed files.
Package fshelper provides directory validation and atomic file writes for ghalet's managed files.
Package logreduct masks registered secrets in log text and slog attributes.
Package logreduct masks registered secrets in log text and slog attributes.
Package procgroup verifies and terminates process groups using kernel identities.
Package procgroup verifies and terminates process groups using kernel identities.
Package runnerdist downloads, verifies, caches, and extracts GitHub Actions runner distributions.
Package runnerdist downloads, verifies, caches, and extracts GitHub Actions runner distributions.
Package runnerlog collects, redacts, archives, and expires runner logs.
Package runnerlog collects, redacts, archives, and expires runner logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL