cli

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRemoteSetupFailures = 10

MaxRemoteSetupFailures is the number of wrong-code attempts that wipe the active token and force the user to generate a fresh one. The token's 8-character alphabet has ~55^8 ≈ 8 × 10^13 possible values, so 10 attempts is effectively zero brute-force progress — this lock is defense in depth, not a tight bound.

Variables

View Source
var SupportedPHPVersions = []string{"8.1", "8.2", "8.3", "8.4", "8.5"}

SupportedPHPVersions lists the PHP versions lerd can build FPM images for.

Functions

func ApplyAutostart added in v1.9.0

func ApplyAutostart(disabled bool) error

ApplyAutostart writes the new flag to config.yaml, rewrites every lerd-*.container quadlet on disk so its [Install] section is present (when enabled) or absent (when disabled), runs `systemctl --user daemon-reload`, then enables/disables (and starts/stops) every lerd-* systemd user service. Safe to call when the flag is already in the requested state — every step is idempotent.

Exposed (capitalised) so the UI server can call it directly without duplicating the orchestration; the tray and CLI go through the same path.

func ClearRemoteSetupToken added in v1.8.0

func ClearRemoteSetupToken() error

ClearRemoteSetupToken removes the on-disk token file.

func CollectRunningWorkerNames added in v1.5.0

func CollectRunningWorkerNames(site *config.Site) []string

CollectRunningWorkerNames returns the names of active workers for the site, including stripe. Used to sync .lerd.yaml.

func DisableLANExposure added in v1.8.0

func DisableLANExposure(progress LANProgressFunc) error

DisableLANExposure flips lerd back to the safe loopback default. Inverts EnableLANExposure: rewrites every container PublishPort to bind 127.0.0.1, stops the dns-forwarder, reverts dnsmasq to answer with 127.0.0.1, and revokes any outstanding remote-setup token (a code is only useful while the LAN forwarder is running). progress receives one event per step; pass nil for the silent path. Idempotent.

func EnableLANExposure added in v1.8.0

func EnableLANExposure(progress LANProgressFunc) (lanIP string, err error)

EnableLANExposure flips lerd from the safe-on-coffee-shop-wifi default (everything bound to 127.0.0.1) to LAN-exposed mode. Concretely:

  • persists cfg.LAN.Exposed=true so reinstalls and reboots restore the state
  • regenerates every installed lerd-* container quadlet via WriteQuadlet, which centrally rewrites PublishPort= lines to drop the loopback prefix
  • daemon-reloads systemd and restarts each rewritten container
  • rewrites the dnsmasq config to answer *.test queries with the host's LAN IP and restarts lerd-dns
  • installs and starts the userspace lerd-dns-forwarder.service that bridges LAN-IP:5300 → 127.0.0.1:5300 (rootless pasta cannot accept LAN-side traffic on its own, so a host-side forwarder is required)

progress, if non-nil, is invoked after each step so the caller can stream feedback to a user (e.g. NDJSON over HTTP for the dashboard). Idempotent: safe to call repeatedly.

func GenerateRemoteSetupToken added in v1.8.0

func GenerateRemoteSetupToken(ttl time.Duration) (string, error)

GenerateRemoteSetupToken creates a fresh one-time setup code, persists it with the given TTL, and returns the code. Used by both the `lerd remote-setup` cobra command and the dashboard UI's loopback-only generate endpoint, so they share the exact same token format and storage path.

func HorizonStartForSite added in v1.0.0

func HorizonStartForSite(siteName, sitePath, phpVersion string) error

HorizonStartForSite starts Horizon for the named site. Conflicting workers (defined via ConflictsWith in the framework definition) are stopped first.

func HorizonStopForSite added in v1.0.0

func HorizonStopForSite(siteName string) error

HorizonStopForSite stops and removes the Horizon unit for the named site.

func InstallPresetByName added in v1.9.0

func InstallPresetByName(name, version string) (*config.CustomService, error)

InstallPresetByName is a thin wrapper around serviceops.InstallPresetByName kept for the existing call sites in cli (init wizard, link, web UI handler).

func IsMCPGloballyRegistered added in v1.1.0

func IsMCPGloballyRegistered() bool

IsMCPGloballyRegistered reports whether lerd is already registered at user scope in Claude Code. Used by the install command to skip the prompt if already set up.

func ListVendorBins added in v1.7.0

func ListVendorBins(cwd string) []string

ListVendorBins returns the names of executable files in <cwd>/vendor/bin, sorted alphabetically. Returns an empty slice if the directory doesn't exist.

func MissingPresetDependencies added in v1.9.0

func MissingPresetDependencies(svc *config.CustomService) []string

MissingPresetDependencies is a thin wrapper around the serviceops helper.

func NewAboutCmd added in v1.0.0

func NewAboutCmd() *cobra.Command

NewAboutCmd returns the about command.

func NewAutostartCmd added in v0.3.0

func NewAutostartCmd() *cobra.Command

NewAutostartCmd returns the autostart command with enable/disable subcommands.

"Autostart" governs whether lerd comes up at login as a single switch: every lerd-* container quadlet, the lerd UI, the watcher, and every per-site worker/queue/schedule/horizon/reverb/stripe unit are enabled or disabled together. The state lives in cfg.Autostart.Disabled (zero value = enabled, so existing installs are unchanged) and is the canonical source of truth — `IsAutostartEnabled` reads it directly.

The toggle only affects what happens at the next login. Toggling to off does NOT stop currently-running services, and toggling to on does NOT start anything — the user is in the middle of working and a session-level switch should not yank infrastructure out from under them. Disabling does two things:

  1. Strips the [Install] section from every lerd-*.container quadlet on disk so the podman-system-generator stops emitting the `default.target.wants/<name>.service` symlink on the next daemon-reload. This is the only way to actually stop a quadlet from auto-starting; `systemctl --user disable` is a no-op for generator units.
  2. Runs `systemctl --user disable` on every lerd-*.service file (lerd-ui, lerd-watcher, every per-site worker/queue/schedule/ horizon/reverb/stripe), removing the `default.target.wants` symlink without touching the running unit.

Enabling reverses both steps. To actually stop or start a running environment use `lerd stop` / `lerd start` — those are the live-state commands.

func NewCheckCmd added in v1.5.0

func NewCheckCmd() *cobra.Command

NewCheckCmd returns the check command.

func NewConsoleCmd added in v1.2.0

func NewConsoleCmd() *cobra.Command

NewConsoleCmd returns the console command — runs framework console in the project's container.

func NewDNSForwarderCmd added in v1.8.0

func NewDNSForwarderCmd() *cobra.Command

NewDNSForwarderCmd returns the hidden `lerd dns-forwarder` command that runs the userspace UDP+TCP relay used by `lerd lan:expose` to bridge LAN traffic to the rootless lerd-dns container. lan:expose internally needs this to make .test resolution work for remote machines.

Why this exists: rootless podman + pasta cannot accept inbound packets on the host's LAN interface — pasta only intercepts loopback traffic via the host's /proc/net tables, and binding to a LAN-facing socket requires CAP_NET_RAW which rootless containers don't have. Without a userspace helper, `lan:expose` would only work for clients on the server itself.

The forwarder runs as a systemd user service alongside lerd-watcher and lerd-ui, listening on <lan-ip>:5300 (UDP+TCP) and relaying every packet to 127.0.0.1:5300 where pasta does intercept correctly. The lerd binary owns this subcommand so users don't need socat or any other system tool.

func NewDashboardCmd added in v0.8.0

func NewDashboardCmd() *cobra.Command

NewDashboardCmd returns the dashboard command.

func NewDbCmd added in v0.4.0

func NewDbCmd() *cobra.Command

NewDbCmd returns the db parent command with import/export/create/shell subcommands.

func NewDbCreateCmd added in v0.5.1

func NewDbCreateCmd() *cobra.Command

NewDbCreateCmd returns the standalone db:create command.

func NewDbExportCmd added in v0.4.0

func NewDbExportCmd() *cobra.Command

NewDbExportCmd returns the standalone db:export command.

func NewDbImportCmd added in v0.4.0

func NewDbImportCmd() *cobra.Command

NewDbImportCmd returns the standalone db:import command.

func NewDbShellCmd added in v0.5.1

func NewDbShellCmd() *cobra.Command

NewDbShellCmd returns the standalone db:shell command.

func NewDoctorCmd added in v0.9.0

func NewDoctorCmd() *cobra.Command

NewDoctorCmd returns the doctor command.

func NewDomainCmd added in v1.5.0

func NewDomainCmd() *cobra.Command

NewDomainCmd returns the domain command with add/remove/list subcommands.

func NewEnvCheckCmd added in v1.5.0

func NewEnvCheckCmd() *cobra.Command

NewEnvCheckCmd returns the env:check command.

func NewEnvCmd added in v0.3.0

func NewEnvCmd() *cobra.Command

NewEnvCmd returns the env command.

func NewFetchCmd added in v0.4.0

func NewFetchCmd() *cobra.Command

NewFetchCmd returns the fetch command.

func NewFrameworkCmd added in v1.0.0

func NewFrameworkCmd() *cobra.Command

NewFrameworkCmd returns the framework parent command with subcommands.

func NewHorizonCmd added in v1.0.0

func NewHorizonCmd() *cobra.Command

NewHorizonCmd returns the horizon parent command with start/stop subcommands.

func NewHorizonStartCmd added in v1.0.0

func NewHorizonStartCmd() *cobra.Command

NewHorizonStartCmd returns the standalone horizon:start command.

func NewHorizonStopCmd added in v1.0.0

func NewHorizonStopCmd() *cobra.Command

NewHorizonStopCmd returns the standalone horizon:stop command.

func NewInitCmd added in v1.2.0

func NewInitCmd() *cobra.Command

NewInitCmd returns the init command.

func NewInstallCmd

func NewInstallCmd() *cobra.Command

NewInstallCmd returns the install command.

func NewIsolateCmd

func NewIsolateCmd() *cobra.Command

NewIsolateCmd returns the isolate command.

func NewIsolateNodeCmd

func NewIsolateNodeCmd() *cobra.Command

NewIsolateNodeCmd returns the isolate:node command.

func NewLANCmd added in v1.8.0

func NewLANCmd() *cobra.Command

NewLANCmd returns the `lerd lan` parent command. Subcommands flip lerd between the safe-on-coffee-shop-wifi default (everything bound to 127.0.0.1) and the LAN-exposed state (containers bound to 0.0.0.0, dnsmasq answering with the LAN IP, lerd-ui on 0.0.0.0:7073). The previous standalone `lerd dns:expose` flag was folded in here because there is no meaningful state where the DNS resolver answers the LAN but the actual services don't.

func NewLANExposeCmd added in v1.8.0

func NewLANExposeCmd() *cobra.Command

NewLANExposeCmd returns the `lerd lan:expose` colon-style alias.

func NewLANStatusCmd added in v1.8.0

func NewLANStatusCmd() *cobra.Command

NewLANStatusCmd returns the `lerd lan:status` colon-style alias.

func NewLANUnexposeCmd added in v1.8.0

func NewLANUnexposeCmd() *cobra.Command

NewLANUnexposeCmd returns the `lerd lan:unexpose` colon-style alias.

func NewLinkCmd

func NewLinkCmd() *cobra.Command

NewLinkCmd returns the link command.

func NewLogsCmd added in v0.1.17

func NewLogsCmd() *cobra.Command

NewLogsCmd returns the logs command.

func NewMCPCmd added in v0.3.0

func NewMCPCmd() *cobra.Command

NewMCPCmd returns the mcp command — starts the MCP server over stdio.

func NewMCPEnableGlobalCmd added in v1.1.0

func NewMCPEnableGlobalCmd() *cobra.Command

NewMCPEnableGlobalCmd returns the mcp:enable-global command.

func NewMCPInjectCmd added in v0.3.0

func NewMCPInjectCmd() *cobra.Command

NewMCPInjectCmd returns the mcp:inject command.

func NewManCmd added in v1.0.0

func NewManCmd() *cobra.Command

NewManCmd returns the man command.

func NewMinioMigrateCmd added in v1.0.2

func NewMinioMigrateCmd() *cobra.Command

NewMinioMigrateCmd returns the minio:migrate command.

func NewNewCmd added in v1.1.0

func NewNewCmd() *cobra.Command

NewNewCmd returns the new command — scaffold a new PHP project.

func NewNodeCmd added in v0.1.16

func NewNodeCmd() *cobra.Command

NewNodeCmd returns the node command.

func NewNodeInstallCmd added in v0.5.9

func NewNodeInstallCmd() *cobra.Command

NewNodeInstallCmd returns the node:install command.

func NewNodeUninstallCmd added in v0.5.9

func NewNodeUninstallCmd() *cobra.Command

NewNodeUninstallCmd returns the node:uninstall command.

func NewNodeUseCmd added in v0.6.0

func NewNodeUseCmd() *cobra.Command

NewNodeUseCmd returns the node:use command.

func NewNpmCmd added in v0.1.16

func NewNpmCmd() *cobra.Command

NewNpmCmd returns the npm command.

func NewNpxCmd added in v0.1.16

func NewNpxCmd() *cobra.Command

NewNpxCmd returns the npx command.

func NewOpenCmd added in v0.3.0

func NewOpenCmd() *cobra.Command

NewOpenCmd returns the open command.

func NewParkCmd

func NewParkCmd() *cobra.Command

NewParkCmd returns the park command.

func NewPauseCmd added in v1.0.0

func NewPauseCmd() *cobra.Command

NewPauseCmd returns the pause command.

func NewPhpCmd added in v0.1.16

func NewPhpCmd() *cobra.Command

NewPhpCmd returns the php command — runs PHP in the appropriate FPM container.

func NewPhpExtCmd added in v0.5.5

func NewPhpExtCmd() *cobra.Command

NewPhpExtCmd returns the php:ext parent command.

func NewPhpIniCmd added in v0.5.5

func NewPhpIniCmd() *cobra.Command

NewPhpIniCmd returns the php:ini command.

func NewPhpListCmd

func NewPhpListCmd() *cobra.Command

NewPhpListCmd returns the php:list command.

func NewPhpRebuildCmd added in v0.1.17

func NewPhpRebuildCmd() *cobra.Command

NewPhpRebuildCmd returns the php:rebuild command.

func NewPhpShellCmd added in v1.0.1

func NewPhpShellCmd() *cobra.Command

NewPhpShellCmd returns the shell command — opens an interactive sh session in the PHP-FPM container.

func NewQueueCmd added in v0.3.0

func NewQueueCmd() *cobra.Command

NewQueueCmd returns the queue parent command with start/stop subcommands.

func NewQueueStartCmd added in v0.3.0

func NewQueueStartCmd() *cobra.Command

NewQueueStartCmd returns the standalone queue:start command.

func NewQueueStopCmd added in v0.3.0

func NewQueueStopCmd() *cobra.Command

NewQueueStopCmd returns the standalone queue:stop command.

func NewQuitCmd added in v0.7.0

func NewQuitCmd() *cobra.Command

NewQuitCmd returns the quit command.

func NewRemoteControlCmd added in v1.8.0

func NewRemoteControlCmd() *cobra.Command

NewRemoteControlCmd returns the `lerd remote-control` parent command with on / off / status subcommands. Controls whether the lerd dashboard at http://<server>:7073 accepts requests from non-loopback (LAN) sources.

State machine (single field, presence of cfg.UI.PasswordHash):

  • empty: loopback only — LAN sources get 403 Forbidden
  • present: loopback bypasses, LAN sources must present HTTP Basic auth

The `/api/remote-setup` bootstrap endpoint is not affected by this gate (it has its own token + IP + brute-force gate). Loopback always bypasses both states so the local user can never lock themselves out of their own machine.

func NewRemoteControlOffCmd added in v1.8.0

func NewRemoteControlOffCmd() *cobra.Command

NewRemoteControlOffCmd returns the `lerd remote-control:off` colon alias.

func NewRemoteControlOnCmd added in v1.8.0

func NewRemoteControlOnCmd() *cobra.Command

NewRemoteControlOnCmd returns the `lerd remote-control:on` colon alias.

func NewRemoteControlStatusCmd added in v1.8.0

func NewRemoteControlStatusCmd() *cobra.Command

NewRemoteControlStatusCmd returns the `lerd remote-control:status` colon alias.

func NewRemoteSetupCmd added in v1.8.0

func NewRemoteSetupCmd() *cobra.Command

NewRemoteSetupCmd returns the `lerd remote-setup` command — generates a one-time code that authorizes a single laptop to call /api/remote-setup and provision itself against this lerd instance.

func NewReverbCmd added in v0.8.0

func NewReverbCmd() *cobra.Command

NewReverbCmd returns the reverb parent command with start/stop subcommands.

func NewReverbStartCmd added in v0.8.0

func NewReverbStartCmd() *cobra.Command

NewReverbStartCmd returns the standalone reverb:start command.

func NewReverbStopCmd added in v0.8.0

func NewReverbStopCmd() *cobra.Command

NewReverbStopCmd returns the standalone reverb:stop command.

func NewScheduleCmd added in v0.8.0

func NewScheduleCmd() *cobra.Command

NewScheduleCmd returns the schedule parent command with start/stop subcommands.

func NewScheduleStartCmd added in v0.8.0

func NewScheduleStartCmd() *cobra.Command

NewScheduleStartCmd returns the standalone schedule:start command.

func NewScheduleStopCmd added in v0.8.0

func NewScheduleStopCmd() *cobra.Command

NewScheduleStopCmd returns the standalone schedule:stop command.

func NewSecureCmd

func NewSecureCmd() *cobra.Command

NewSecureCmd returns the secure command.

func NewServiceCmd

func NewServiceCmd() *cobra.Command

NewServiceCmd returns the service command with subcommands.

func NewSetupCmd added in v0.4.0

func NewSetupCmd() *cobra.Command

NewSetupCmd returns the setup command.

func NewShareCmd added in v0.4.0

func NewShareCmd() *cobra.Command

NewShareCmd returns the share command.

func NewSitesCmd

func NewSitesCmd() *cobra.Command

NewSitesCmd returns the sites command.

func NewStartCmd added in v0.1.11

func NewStartCmd() *cobra.Command

NewStartCmd returns the start command.

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd returns the status command.

func NewStopCmd added in v0.1.11

func NewStopCmd() *cobra.Command

NewStopCmd returns the stop command.

func NewStripeCmds added in v0.6.0

func NewStripeCmds() []*cobra.Command

NewStripeCmds returns Stripe-related subcommands.

func NewTestCmd added in v1.7.0

func NewTestCmd() *cobra.Command

NewTestCmd returns the `lerd test` command — shortcut for `lerd artisan test`.

func NewTrayCmd added in v0.5.0

func NewTrayCmd() *cobra.Command

NewTrayCmd returns the tray command.

func NewUninstallCmd

func NewUninstallCmd() *cobra.Command

NewUninstallCmd returns the uninstall command.

func NewUnlinkCmd

func NewUnlinkCmd() *cobra.Command

NewUnlinkCmd returns the unlink command.

func NewUnparkCmd added in v0.1.9

func NewUnparkCmd() *cobra.Command

NewUnparkCmd returns the unpark command.

func NewUnpauseCmd added in v1.0.0

func NewUnpauseCmd() *cobra.Command

NewUnpauseCmd returns the unpause command.

func NewUnsecureCmd added in v0.3.0

func NewUnsecureCmd() *cobra.Command

NewUnsecureCmd returns the unsecure command.

func NewUpdateCmd

func NewUpdateCmd(currentVersion string) *cobra.Command

NewUpdateCmd returns the update command.

func NewUseCmd

func NewUseCmd() *cobra.Command

NewUseCmd returns the use command.

func NewVendorBinCmd added in v1.7.0

func NewVendorBinCmd() *cobra.Command

NewVendorBinCmd returns the hidden `lerd vendor-bin <name> [args...]` command used by the top-level fallback in main.go to dispatch composer-installed binaries discovered in the project's vendor/bin directory.

func NewWhatsnewCmd added in v1.3.0

func NewWhatsnewCmd() *cobra.Command

NewWhatsnewCmd returns the whatsnew command.

func NewWhichCmd added in v1.5.0

func NewWhichCmd() *cobra.Command

NewWhichCmd returns the which command.

func NewWorkerCmd added in v1.0.0

func NewWorkerCmd() *cobra.Command

NewWorkerCmd returns the worker parent command with start/stop/list subcommands.

func NewXdebugCmd added in v0.4.0

func NewXdebugCmd() *cobra.Command

NewXdebugCmd returns the xdebug parent command with on/off/status subcommands.

func PauseSite added in v1.0.0

func PauseSite(name string) error

PauseSite stops all running workers for the site, replaces its nginx vhost with a landing page, and marks it paused in the registry.

func QueueRestartForSite added in v0.8.0

func QueueRestartForSite(siteName, sitePath, phpVersion string) error

QueueRestartForSite signals the Laravel queue worker to gracefully restart by running php artisan queue:restart inside the PHP-FPM container. It is a no-op when no queue unit exists for the site. systemd restarts the worker after the graceful exit because the unit uses Restart=always.

func QueueStartForSite added in v0.3.0

func QueueStartForSite(siteName, sitePath, phpVersion string) error

QueueStartForSite starts a queue worker for the given site using the command from the framework definition.

func QueueStopForSite added in v0.3.0

func QueueStopForSite(siteName string) error

QueueStopForSite stops and removes the queue worker for the named site.

func RecordRemoteSetupFailure added in v1.8.0

func RecordRemoteSetupFailure() (closed bool, err error)

RecordRemoteSetupFailure increments the failure counter on the active token. When the count reaches MaxRemoteSetupFailures the token is wiped from disk and `closed` is true — subsequent calls to the endpoint return 404 until the user generates a new token. Idempotent against concurrent callers in the worst case (one extra increment).

func RegenerateFamilyConsumersForService added in v1.9.0

func RegenerateFamilyConsumersForService(name string)

RegenerateFamilyConsumersForService is the public entry the Web UI uses after a start/stop. Forwards to serviceops.

func RegisterProject added in v0.3.0

func RegisterProject(projectDir string, cfg *config.GlobalConfig) (bool, error)

RegisterProject registers a single project directory as a lerd site if it looks like a PHP project. It detects the framework first; if none matches it falls back to auto-detecting the public directory. Returns true if newly registered.

func ReverbStartForSite added in v0.8.0

func ReverbStartForSite(siteName, sitePath, phpVersion string) error

ReverbStartForSite starts the Reverb WebSocket server for the named site. This is an alias that looks up the "reverb" worker from the framework definition and delegates to the generic WorkerStartForSite, which handles proxy port assignment and nginx regeneration automatically.

func ReverbStopForSite added in v0.8.0

func ReverbStopForSite(siteName string) error

ReverbStopForSite stops and removes the Reverb unit for the named site.

func RunMCPEnableGlobal added in v1.1.0

func RunMCPEnableGlobal() error

RunMCPEnableGlobal registers lerd MCP at user scope for all supported AI tools. It is exported so the install command can call it directly.

func RunPHP added in v1.7.0

func RunPHP(cwd string, args []string) error

RunPHP execs `php <args...>` inside the project's PHP-FPM container, with stdio wired to the current terminal. Used by `lerd php`, the vendor/bin fallback, and other passthrough commands that need a PHP runtime.

func RunParallel added in v0.5.6

func RunParallel(jobs []BuildJob) error

RunParallel executes all jobs concurrently with a compact spinner UI. In a non-TTY environment it falls back to plain sequential output. Returns the first non-nil error, or nil if all jobs succeed.

func RunQuit added in v0.7.0

func RunQuit() error

RunQuit stops all lerd processes and containers (exported for use by the UI server).

func RunStart added in v0.7.0

func RunStart() error

RunStart starts all lerd services (exported for use by the UI server).

func RunStop added in v0.7.0

func RunStop() error

RunStop stops lerd containers (exported for use by the UI server).

func SaveRemoteSetupToken added in v1.8.0

func SaveRemoteSetupToken(t *RemoteSetupToken) error

SaveRemoteSetupToken writes the token to disk with mode 0600.

func ScheduleStartForSite added in v0.8.0

func ScheduleStartForSite(siteName, sitePath, phpVersion string) error

ScheduleStartForSite starts the task scheduler for the named site using the "schedule" worker from the framework definition. The version-aware loader (GetFrameworkForDir) is used so per-version overrides — like Laravel 10's `schedule: minutely` cron entry — actually take effect instead of falling back to the version-less built-in defaults.

func ScheduleStopForSite added in v0.8.0

func ScheduleStopForSite(siteName string) error

ScheduleStopForSite stops and removes the scheduler unit for the named site.

func SiteHasHorizon added in v1.0.0

func SiteHasHorizon(sitePath string) bool

SiteHasHorizon returns true if composer.json lists laravel/horizon as a dependency.

func SiteHasProxyWorker added in v1.10.0

func SiteHasProxyWorker(sitePath, workerName string) bool

SiteHasProxyWorker returns true if the site's framework defines a worker with a proxy configuration and that worker's check rule passes.

func SiteHasReverb added in v0.8.0

func SiteHasReverb(sitePath string) bool

SiteHasReverb returns true if the site's framework defines a "reverb" worker and the worker's check rule passes (e.g. laravel/reverb is in composer.json).

func SiteUsesReverb added in v0.8.0

func SiteUsesReverb(sitePath string) bool

SiteUsesReverb returns true if the site has a reverb worker configured and optionally checks for BROADCAST_CONNECTION=reverb in the env file.

func StartServiceDependencies added in v1.9.0

func StartServiceDependencies(svc *config.CustomService) error

StartServiceDependencies and StopServiceAndDependents are thin wrappers so the Web UI can share the same semantics as the CLI.

func StopServiceAndDependents added in v1.9.0

func StopServiceAndDependents(name string)

func StripeSecretSet added in v0.6.0

func StripeSecretSet(sitePath string) bool

StripeSecretSet returns true if STRIPE_SECRET is present in the site's .env.

func StripeStartForSite added in v0.6.0

func StripeStartForSite(siteName, sitePath, siteBaseURL string) error

StripeStartForSite starts a Stripe listener for the given site, reading the key from its .env.

func StripeStopForSite added in v0.6.0

func StripeStopForSite(siteName string) error

StripeStopForSite stops and removes the Stripe listener for the named site.

func UnlinkSite added in v0.3.0

func UnlinkSite(name string) error

UnlinkSite removes the nginx vhost for the named site. For sites under a parked directory, the registry entry is kept but marked Ignored so the watcher does not re-register it. For manually-linked sites the entry is removed entirely.

func UnpauseSite added in v1.0.0

func UnpauseSite(name string) error

UnpauseSite restores the site's nginx vhost, restarts any workers that were running when the site was paused, and clears the paused state.

func VendorBinExists added in v1.7.0

func VendorBinExists(cwd, name string) bool

VendorBinExists reports whether the project rooted at cwd has an executable vendor/bin/<name> on disk. Used by the top-level command-not-found fallback to decide whether to dispatch unknown subcommands to a composer binary.

func WorkerStartForSite added in v1.0.0

func WorkerStartForSite(siteName, sitePath, phpVersion, workerName string, w config.FrameworkWorker) error

WorkerStartForSite writes a systemd unit for the given framework worker and starts it. The unit name is lerd-{workerName}-{siteName}. If the worker has a Proxy config, the proxy port is auto-assigned and the nginx vhost is regenerated to include the WebSocket/HTTP proxy block.

func WorkerStopForSite added in v1.0.0

func WorkerStopForSite(siteName, workerName string) error

WorkerStopForSite stops and removes the named worker unit for the given site.

Types

type BuildJob added in v0.5.6

type BuildJob struct {
	Label string
	Run   func(w io.Writer) error
}

BuildJob is a labeled build task that writes its output to the provided writer.

type LANProgressFunc added in v1.8.0

type LANProgressFunc func(step string)

LANProgressFunc is invoked by EnableLANExposure / DisableLANExposure after every meaningful step completes. The argument is a short human-readable label suitable for streaming to a frontend ("Rewriting container quadlets", "Restarting lerd-dns", "Done — LAN IP 192.168.x.y"). May be nil; the no-progress path is the common case (CLI without streaming, internal idempotent re-application from `lerd remote-setup`).

type RemoteSetupToken added in v1.8.0

type RemoteSetupToken struct {
	Token    string    `json:"token"`
	Expires  time.Time `json:"expires"`
	Failures int       `json:"failures,omitempty"`
}

RemoteSetupToken is the on-disk representation of a one-time code that authorizes a remote device to call the /api/remote-setup endpoint.

Stored in <DataDir>/remote-setup-token.json with mode 0600. The token is short (8 characters), high-entropy enough for the LAN-only threat model, gated by a TTL so a forgotten token doesn't grant indefinite access, and counted against a per-token failure limit so brute-force attempts close the endpoint instead of running indefinitely.

func LoadRemoteSetupToken added in v1.8.0

func LoadRemoteSetupToken() (*RemoteSetupToken, error)

LoadRemoteSetupToken reads the current token from disk. Returns nil (no error) when the file doesn't exist — i.e. no token is active.

type StepRunner added in v0.5.6

type StepRunner struct {
	// contains filtered or unexported fields
}

StepRunner runs labeled steps sequentially with a compact in-place TUI. Each step's output is hidden by default; press Ctrl+O to toggle it. Falls back to plain " --> label ... OK" output when stdout is not a TTY.

func NewStepRunner added in v0.5.6

func NewStepRunner() *StepRunner

NewStepRunner creates and starts a StepRunner. Call Close() when all steps are done to restore the terminal.

func (*StepRunner) Close added in v0.5.6

func (r *StepRunner) Close()

Close stops the render loop, restores the terminal, and prints a final newline.

func (*StepRunner) Run added in v0.5.6

func (r *StepRunner) Run(label string, fn func(w io.Writer) error) error

Run executes fn as a labeled step. In TUI mode the step shows a spinner while running and ✓/✗ when done. Returns fn's error.

func (*StepRunner) RunInteractive added in v0.5.6

func (r *StepRunner) RunInteractive(label string, fn func() error) error

RunInteractive temporarily restores the terminal to cooked mode so that steps which need interactive sudo (password prompts, etc.) work correctly. The spinner pauses, the step runs with full terminal access, then raw mode resumes.

Jump to

Keyboard shortcuts

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