wer worker

Manage the background reconciliation worker process.

Usage

wer worker [subcommand]

Description

The worker command manages the background process responsible for reconciling workstation state. The worker continuously monitors your workstations and ensures their actual infrastructure state matches the desired state defined in werkr. It handles provisioning, teardown, and state transitions automatically.

Running wer worker without a subcommand starts the worker in the foreground. Use the subcommands to manage the worker as a background process.

How Reconciliation Works

The worker operates like a Kubernetes controller. It runs a set of reconciliation loops that continuously compare the desired state of each resource (as defined in your manifests) against its actual state in the underlying infrastructure. When the two diverge, the worker takes action to bring the actual state in line with the desired state.

For example, when you run wer apply -f workstation.yaml, werkr stores the desired state and the worker picks it up. It then provisions the VM, applies matching configurations (installing tools, copying files, setting environment variables), forwards SSH keys, sets up port forwarding, and monitors the workstation's health - all automatically. If a workstation is stopped and you update its configuration, the worker applies the changes the next time it starts.

The worker reconciles all three resource types - Workstations, WorkstationConfigs, and SSHKeys - and handles the full lifecycle: creation, updates, teardown, and error recovery. This means you interact with werkr declaratively (define what you want) and the worker handles the imperative work (making it happen).

On macOS, the worker starts automatically when werkr is installed. On Linux and Windows, start it manually with wer worker start.

Subcommands

Subcommand Description
start Start the background worker process. No-op if already running
stop Stop the background worker process via graceful HTTP shutdown
restart Stop (if running) then start the background worker process
status Show the current status, PID, port, and uptime of the worker process

Flags (foreground mode)

Flag Description
--bind HTTP server bind address (default: 127.0.0.1)
--log-file Write logs to a file in the werkr data directory
--log-path Custom log file path (overrides --log-file)

Examples

# Start the worker in the background
wer worker start

# Check the worker status
wer worker status

# Restart the worker after a configuration change
wer worker restart

# Stop the worker
wer worker stop

# Run the worker in the foreground (for debugging)
wer worker