Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyAutostart(disabled bool) error
- func ClearRemoteSetupToken() error
- func CollectRunningWorkerNames(site *config.Site) []string
- func DisableLANExposure(progress LANProgressFunc) error
- func EnableLANExposure(progress LANProgressFunc) (lanIP string, err error)
- func GenerateRemoteSetupToken(ttl time.Duration) (string, error)
- func HorizonStartForSite(siteName, sitePath, phpVersion string) error
- func HorizonStopForSite(siteName string) error
- func InstallPresetByName(name, version string) (*config.CustomService, error)
- func IsMCPGloballyRegistered() bool
- func ListVendorBins(cwd string) []string
- func MissingPresetDependencies(svc *config.CustomService) []string
- func NewAboutCmd() *cobra.Command
- func NewAutostartCmd() *cobra.Command
- func NewCheckCmd() *cobra.Command
- func NewConsoleCmd() *cobra.Command
- func NewDNSForwarderCmd() *cobra.Command
- func NewDashboardCmd() *cobra.Command
- func NewDbCmd() *cobra.Command
- func NewDbCreateCmd() *cobra.Command
- func NewDbExportCmd() *cobra.Command
- func NewDbImportCmd() *cobra.Command
- func NewDbShellCmd() *cobra.Command
- func NewDoctorCmd() *cobra.Command
- func NewDomainCmd() *cobra.Command
- func NewEnvCheckCmd() *cobra.Command
- func NewEnvCmd() *cobra.Command
- func NewFetchCmd() *cobra.Command
- func NewFrameworkCmd() *cobra.Command
- func NewHorizonCmd() *cobra.Command
- func NewHorizonStartCmd() *cobra.Command
- func NewHorizonStopCmd() *cobra.Command
- func NewInitCmd() *cobra.Command
- func NewInstallCmd() *cobra.Command
- func NewIsolateCmd() *cobra.Command
- func NewIsolateNodeCmd() *cobra.Command
- func NewLANCmd() *cobra.Command
- func NewLANExposeCmd() *cobra.Command
- func NewLANStatusCmd() *cobra.Command
- func NewLANUnexposeCmd() *cobra.Command
- func NewLinkCmd() *cobra.Command
- func NewLogsCmd() *cobra.Command
- func NewMCPCmd() *cobra.Command
- func NewMCPEnableGlobalCmd() *cobra.Command
- func NewMCPInjectCmd() *cobra.Command
- func NewManCmd() *cobra.Command
- func NewMinioMigrateCmd() *cobra.Command
- func NewNewCmd() *cobra.Command
- func NewNodeCmd() *cobra.Command
- func NewNodeInstallCmd() *cobra.Command
- func NewNodeUninstallCmd() *cobra.Command
- func NewNodeUseCmd() *cobra.Command
- func NewNpmCmd() *cobra.Command
- func NewNpxCmd() *cobra.Command
- func NewOpenCmd() *cobra.Command
- func NewParkCmd() *cobra.Command
- func NewPauseCmd() *cobra.Command
- func NewPhpCmd() *cobra.Command
- func NewPhpExtCmd() *cobra.Command
- func NewPhpIniCmd() *cobra.Command
- func NewPhpListCmd() *cobra.Command
- func NewPhpRebuildCmd() *cobra.Command
- func NewPhpShellCmd() *cobra.Command
- func NewQueueCmd() *cobra.Command
- func NewQueueStartCmd() *cobra.Command
- func NewQueueStopCmd() *cobra.Command
- func NewQuitCmd() *cobra.Command
- func NewRemoteControlCmd() *cobra.Command
- func NewRemoteControlOffCmd() *cobra.Command
- func NewRemoteControlOnCmd() *cobra.Command
- func NewRemoteControlStatusCmd() *cobra.Command
- func NewRemoteSetupCmd() *cobra.Command
- func NewReverbCmd() *cobra.Command
- func NewReverbStartCmd() *cobra.Command
- func NewReverbStopCmd() *cobra.Command
- func NewScheduleCmd() *cobra.Command
- func NewScheduleStartCmd() *cobra.Command
- func NewScheduleStopCmd() *cobra.Command
- func NewSecureCmd() *cobra.Command
- func NewServiceCmd() *cobra.Command
- func NewSetupCmd() *cobra.Command
- func NewShareCmd() *cobra.Command
- func NewSitesCmd() *cobra.Command
- func NewStartCmd() *cobra.Command
- func NewStatusCmd() *cobra.Command
- func NewStopCmd() *cobra.Command
- func NewStripeCmds() []*cobra.Command
- func NewTestCmd() *cobra.Command
- func NewTrayCmd() *cobra.Command
- func NewUninstallCmd() *cobra.Command
- func NewUnlinkCmd() *cobra.Command
- func NewUnparkCmd() *cobra.Command
- func NewUnpauseCmd() *cobra.Command
- func NewUnsecureCmd() *cobra.Command
- func NewUpdateCmd(currentVersion string) *cobra.Command
- func NewUseCmd() *cobra.Command
- func NewVendorBinCmd() *cobra.Command
- func NewWhatsnewCmd() *cobra.Command
- func NewWhichCmd() *cobra.Command
- func NewWorkerCmd() *cobra.Command
- func NewXdebugCmd() *cobra.Command
- func PauseSite(name string) error
- func QueueRestartForSite(siteName, sitePath, phpVersion string) error
- func QueueStartForSite(siteName, sitePath, phpVersion string) error
- func QueueStopForSite(siteName string) error
- func RecordRemoteSetupFailure() (closed bool, err error)
- func RegenerateFamilyConsumersForService(name string)
- func RegisterProject(projectDir string, cfg *config.GlobalConfig) (bool, error)
- func ReverbStartForSite(siteName, sitePath, phpVersion string) error
- func ReverbStopForSite(siteName string) error
- func RunMCPEnableGlobal() error
- func RunPHP(cwd string, args []string) error
- func RunParallel(jobs []BuildJob) error
- func RunQuit() error
- func RunStart() error
- func RunStop() error
- func SaveRemoteSetupToken(t *RemoteSetupToken) error
- func ScheduleStartForSite(siteName, sitePath, phpVersion string) error
- func ScheduleStopForSite(siteName string) error
- func SiteHasHorizon(sitePath string) bool
- func SiteHasProxyWorker(sitePath, workerName string) bool
- func SiteHasReverb(sitePath string) bool
- func SiteUsesReverb(sitePath string) bool
- func StartServiceDependencies(svc *config.CustomService) error
- func StopServiceAndDependents(name string)
- func StripeSecretSet(sitePath string) bool
- func StripeStartForSite(siteName, sitePath, siteBaseURL string) error
- func StripeStopForSite(siteName string) error
- func UnlinkSite(name string) error
- func UnpauseSite(name string) error
- func VendorBinExists(cwd, name string) bool
- func WorkerStartForSite(siteName, sitePath, phpVersion, workerName string, w config.FrameworkWorker) error
- func WorkerStopForSite(siteName, workerName string) error
- type BuildJob
- type LANProgressFunc
- type RemoteSetupToken
- type StepRunner
Constants ¶
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 ¶
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
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
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
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
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
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
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
NewAboutCmd returns the about command.
func NewAutostartCmd ¶ added in v0.3.0
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:
- 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.
- 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
NewCheckCmd returns the check command.
func NewConsoleCmd ¶ added in v1.2.0
NewConsoleCmd returns the console command — runs framework console in the project's container.
func NewDNSForwarderCmd ¶ added in v1.8.0
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
NewDashboardCmd returns the dashboard command.
func NewDbCmd ¶ added in v0.4.0
NewDbCmd returns the db parent command with import/export/create/shell subcommands.
func NewDbCreateCmd ¶ added in v0.5.1
NewDbCreateCmd returns the standalone db:create command.
func NewDbExportCmd ¶ added in v0.4.0
NewDbExportCmd returns the standalone db:export command.
func NewDbImportCmd ¶ added in v0.4.0
NewDbImportCmd returns the standalone db:import command.
func NewDbShellCmd ¶ added in v0.5.1
NewDbShellCmd returns the standalone db:shell command.
func NewDoctorCmd ¶ added in v0.9.0
NewDoctorCmd returns the doctor command.
func NewDomainCmd ¶ added in v1.5.0
NewDomainCmd returns the domain command with add/remove/list subcommands.
func NewEnvCheckCmd ¶ added in v1.5.0
NewEnvCheckCmd returns the env:check command.
func NewFetchCmd ¶ added in v0.4.0
NewFetchCmd returns the fetch command.
func NewFrameworkCmd ¶ added in v1.0.0
NewFrameworkCmd returns the framework parent command with subcommands.
func NewHorizonCmd ¶ added in v1.0.0
NewHorizonCmd returns the horizon parent command with start/stop subcommands.
func NewHorizonStartCmd ¶ added in v1.0.0
NewHorizonStartCmd returns the standalone horizon:start command.
func NewHorizonStopCmd ¶ added in v1.0.0
NewHorizonStopCmd returns the standalone horizon:stop command.
func NewInitCmd ¶ added in v1.2.0
NewInitCmd returns the init command.
func NewIsolateNodeCmd ¶
NewIsolateNodeCmd returns the isolate:node command.
func NewLANCmd ¶ added in v1.8.0
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
NewLANExposeCmd returns the `lerd lan:expose` colon-style alias.
func NewLANStatusCmd ¶ added in v1.8.0
NewLANStatusCmd returns the `lerd lan:status` colon-style alias.
func NewLANUnexposeCmd ¶ added in v1.8.0
NewLANUnexposeCmd returns the `lerd lan:unexpose` colon-style alias.
func NewLogsCmd ¶ added in v0.1.17
NewLogsCmd returns the logs command.
func NewMCPCmd ¶ added in v0.3.0
NewMCPCmd returns the mcp command — starts the MCP server over stdio.
func NewMCPEnableGlobalCmd ¶ added in v1.1.0
NewMCPEnableGlobalCmd returns the mcp:enable-global command.
func NewMCPInjectCmd ¶ added in v0.3.0
NewMCPInjectCmd returns the mcp:inject command.
func NewMinioMigrateCmd ¶ added in v1.0.2
NewMinioMigrateCmd returns the minio:migrate command.
func NewNodeCmd ¶ added in v0.1.16
NewNodeCmd returns the node command.
func NewNodeInstallCmd ¶ added in v0.5.9
NewNodeInstallCmd returns the node:install command.
func NewNodeUninstallCmd ¶ added in v0.5.9
NewNodeUninstallCmd returns the node:uninstall command.
func NewNodeUseCmd ¶ added in v0.6.0
NewNodeUseCmd returns the node:use command.
func NewOpenCmd ¶ added in v0.3.0
NewOpenCmd returns the open command.
func NewPauseCmd ¶ added in v1.0.0
NewPauseCmd returns the pause command.
func NewPhpCmd ¶ added in v0.1.16
NewPhpCmd returns the php command — runs PHP in the appropriate FPM container.
func NewPhpExtCmd ¶ added in v0.5.5
NewPhpExtCmd returns the php:ext parent command.
func NewPhpIniCmd ¶ added in v0.5.5
NewPhpIniCmd returns the php:ini command.
func NewPhpListCmd ¶
NewPhpListCmd returns the php:list command.
func NewPhpRebuildCmd ¶ added in v0.1.17
NewPhpRebuildCmd returns the php:rebuild command.
func NewPhpShellCmd ¶ added in v1.0.1
NewPhpShellCmd returns the shell command — opens an interactive sh session in the PHP-FPM container.
func NewQueueCmd ¶ added in v0.3.0
NewQueueCmd returns the queue parent command with start/stop subcommands.
func NewQueueStartCmd ¶ added in v0.3.0
NewQueueStartCmd returns the standalone queue:start command.
func NewQueueStopCmd ¶ added in v0.3.0
NewQueueStopCmd returns the standalone queue:stop command.
func NewQuitCmd ¶ added in v0.7.0
NewQuitCmd returns the quit command.
func NewRemoteControlCmd ¶ added in v1.8.0
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
NewRemoteControlOffCmd returns the `lerd remote-control:off` colon alias.
func NewRemoteControlOnCmd ¶ added in v1.8.0
NewRemoteControlOnCmd returns the `lerd remote-control:on` colon alias.
func NewRemoteControlStatusCmd ¶ added in v1.8.0
NewRemoteControlStatusCmd returns the `lerd remote-control:status` colon alias.
func NewRemoteSetupCmd ¶ added in v1.8.0
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
NewReverbCmd returns the reverb parent command with start/stop subcommands.
func NewReverbStartCmd ¶ added in v0.8.0
NewReverbStartCmd returns the standalone reverb:start command.
func NewReverbStopCmd ¶ added in v0.8.0
NewReverbStopCmd returns the standalone reverb:stop command.
func NewScheduleCmd ¶ added in v0.8.0
NewScheduleCmd returns the schedule parent command with start/stop subcommands.
func NewScheduleStartCmd ¶ added in v0.8.0
NewScheduleStartCmd returns the standalone schedule:start command.
func NewScheduleStopCmd ¶ added in v0.8.0
NewScheduleStopCmd returns the standalone schedule:stop command.
func NewServiceCmd ¶
NewServiceCmd returns the service command with subcommands.
func NewSetupCmd ¶ added in v0.4.0
NewSetupCmd returns the setup command.
func NewShareCmd ¶ added in v0.4.0
NewShareCmd returns the share command.
func NewStartCmd ¶ added in v0.1.11
NewStartCmd returns the start command.
func NewStopCmd ¶ added in v0.1.11
NewStopCmd returns the stop command.
func NewStripeCmds ¶ added in v0.6.0
NewStripeCmds returns Stripe-related subcommands.
func NewTestCmd ¶ added in v1.7.0
NewTestCmd returns the `lerd test` command — shortcut for `lerd artisan test`.
func NewTrayCmd ¶ added in v0.5.0
NewTrayCmd returns the tray command.
func NewUninstallCmd ¶
NewUninstallCmd returns the uninstall command.
func NewUnparkCmd ¶ added in v0.1.9
NewUnparkCmd returns the unpark command.
func NewUnpauseCmd ¶ added in v1.0.0
NewUnpauseCmd returns the unpause command.
func NewUnsecureCmd ¶ added in v0.3.0
NewUnsecureCmd returns the unsecure command.
func NewUpdateCmd ¶
NewUpdateCmd returns the update command.
func NewVendorBinCmd ¶ added in v1.7.0
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
NewWhatsnewCmd returns the whatsnew command.
func NewWhichCmd ¶ added in v1.5.0
NewWhichCmd returns the which command.
func NewWorkerCmd ¶ added in v1.0.0
NewWorkerCmd returns the worker parent command with start/stop/list subcommands.
func NewXdebugCmd ¶ added in v0.4.0
NewXdebugCmd returns the xdebug parent command with on/off/status subcommands.
func PauseSite ¶ added in v1.0.0
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
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
QueueStartForSite starts a queue worker for the given site using the command from the framework definition.
func QueueStopForSite ¶ added in v0.3.0
QueueStopForSite stops and removes the queue worker for the named site.
func RecordRemoteSetupFailure ¶ added in v1.8.0
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
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
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
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
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
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
ScheduleStopForSite stops and removes the scheduler unit for the named site.
func SiteHasHorizon ¶ added in v1.0.0
SiteHasHorizon returns true if composer.json lists laravel/horizon as a dependency.
func SiteHasProxyWorker ¶ added in v1.10.0
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
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
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
StripeSecretSet returns true if STRIPE_SECRET is present in the site's .env.
func StripeStartForSite ¶ added in v0.6.0
StripeStartForSite starts a Stripe listener for the given site, reading the key from its .env.
func StripeStopForSite ¶ added in v0.6.0
StripeStopForSite stops and removes the Stripe listener for the named site.
func UnlinkSite ¶ added in v0.3.0
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
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
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
WorkerStopForSite stops and removes the named worker unit for the given site.
Types ¶
type BuildJob ¶ added in v0.5.6
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
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.
Source Files
¶
- about.go
- autostart.go
- browser_linux.go
- build_ui.go
- check.go
- confirm_replace.go
- console.go
- dashboard.go
- db.go
- dns.go
- dns_forwarder.go
- doctor.go
- doctor_linux.go
- domain.go
- domain_conflict.go
- env.go
- env_check.go
- fetch.go
- framework.go
- horizon.go
- init.go
- install.go
- install_autostart_linux.go
- install_cleanup_linux.go
- install_dns_linux.go
- install_linux.go
- isolate.go
- isolate_node.go
- lan.go
- link.go
- loghint_linux.go
- logs.go
- man.go
- mcp.go
- minio_migrate.go
- new.go
- node_exec.go
- node_install.go
- node_uninstall.go
- node_use.go
- open.go
- park.go
- pause.go
- php_exec.go
- php_ext.go
- php_ini.go
- php_list.go
- php_rebuild.go
- php_shell.go
- queue.go
- remote_control.go
- remote_setup.go
- reverb.go
- schedule.go
- secure.go
- service_image_linux.go
- services.go
- setup.go
- share.go
- sites.go
- startstop.go
- startstop_linux.go
- status.go
- status_hints_linux.go
- stripe.go
- tray.go
- uninstall.go
- unlink.go
- unpark.go
- update.go
- use.go
- vendor_bin.go
- whatsnew.go
- which.go
- worker.go
- worker_linux.go
- xdebug.go