Documentation
¶
Index ¶
- func Start(currentVersion string) error
- type AnalyzedCaller
- type ConflictingDomain
- type DNSStatus
- type NPlusOneFinding
- type NginxConfigReadResponse
- type NginxConfigResetResponse
- type NginxConfigRestoreRequest
- type NginxConfigRestoreResponse
- type NginxConfigWriteRequest
- type NginxConfigWriteResponse
- type PHPStatus
- type PhpIniReadResponse
- type PhpIniResetResponse
- type PhpIniRestoreRequest
- type PhpIniRestoreResponse
- type PhpIniWriteRequest
- type PhpIniWriteResponse
- type PortConflict
- type PresetResponse
- type QueryAnalysis
- type RequestAnalysis
- type ServiceActionResponse
- type ServiceCheck
- type ServiceResponse
- type ServiceTuningReadResponse
- type ServiceTuningResetResponse
- type ServiceTuningRestoreRequest
- type ServiceTuningRestoreResponse
- type ServiceTuningWriteRequest
- type ServiceTuningWriteResponse
- type SettingsResponse
- type SiteActionResponse
- type SiteEnvBackup
- type SiteEnvRestoreRequest
- type SiteEnvRestoreResponse
- type SiteEnvWriteRequest
- type SiteEnvWriteResponse
- type SiteNginxBackup
- type SiteNginxReadResponse
- type SiteNginxResetResponse
- type SiteNginxRestoreRequest
- type SiteNginxRestoreResponse
- type SiteNginxWriteRequest
- type SiteNginxWriteResponse
- type SiteReorderRequest
- type SiteResponse
- type SlowFinding
- type StatusResponse
- type VersionResponse
- type WorkerStatus
- type WorktreeResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnalyzedCaller ¶ added in v1.23.0
AnalyzedCaller is the application frame a query originated from — the line a fixer opens to add eager loading, an index, or a cache.
type ConflictingDomain ¶ added in v1.8.0
ConflictingDomain describes a domain declared in .lerd.yaml that wasn't registered for the site because another site on this machine already owns it. Surfaced to the UI so the domain modal can render a warning icon next to the entry with the owning site name.
type NPlusOneFinding ¶ added in v1.23.0
type NPlusOneFinding struct {
Fingerprint string `json:"fingerprint"`
Count int `json:"count"`
TotalTimeMS float64 `json:"total_time_ms"`
SampleSQL string `json:"sample_sql"`
Caller AnalyzedCaller `json:"caller"`
}
NPlusOneFinding is one query shape that repeated past the threshold inside a single request — the classic N+1. Fingerprint is the literal-collapsed SQL shared by every repeat; SampleSQL is one concrete instance.
type NginxConfigReadResponse ¶ added in v1.23.0
type NginxConfigReadResponse struct {
Path string `json:"path"`
Content string `json:"content"`
Exists bool `json:"exists"`
}
NginxConfigReadResponse mirrors SiteNginxReadResponse for the global http-level override. Exists distinguishes a real saved override from the seeded template the handler hands back when the file is missing.
type NginxConfigResetResponse ¶ added in v1.23.0
NginxConfigResetResponse mirrors SiteNginxResetResponse for the reset flow.
type NginxConfigRestoreRequest ¶ added in v1.23.0
type NginxConfigRestoreRequest struct {
Name string `json:"name"`
}
NginxConfigRestoreRequest names the backup to roll back to.
type NginxConfigRestoreResponse ¶ added in v1.23.0
type NginxConfigRestoreResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Restored string `json:"restored,omitempty"`
Content string `json:"content,omitempty"`
}
NginxConfigRestoreResponse mirrors SiteNginxRestoreResponse.
type NginxConfigWriteRequest ¶ added in v1.23.0
NginxConfigWriteRequest is the JSON body for POST /api/nginx/config.
type NginxConfigWriteResponse ¶ added in v1.23.0
type NginxConfigWriteResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
BackupName string `json:"backup_name,omitempty"`
ValidationOutput string `json:"validation_output,omitempty"`
Content string `json:"content,omitempty"`
Exists bool `json:"exists,omitempty"`
}
NginxConfigWriteResponse mirrors SiteNginxWriteResponse so the editor can reuse the same dirty/backup/validation rendering.
type PhpIniReadResponse ¶ added in v1.23.0
type PhpIniReadResponse struct {
Path string `json:"path"`
Content string `json:"content"`
Exists bool `json:"exists"`
}
PhpIniReadResponse mirrors SiteNginxReadResponse. Exists distinguishes a real saved override from the seeded template the handler hands back when the file is missing.
type PhpIniResetResponse ¶ added in v1.23.0
type PhpIniRestoreRequest ¶ added in v1.23.0
type PhpIniRestoreRequest struct {
Name string `json:"name"`
}
type PhpIniRestoreResponse ¶ added in v1.23.0
type PhpIniWriteRequest ¶ added in v1.23.0
PhpIniWriteRequest is the JSON body for POST /api/php-versions/{v}/config.
type PhpIniWriteResponse ¶ added in v1.23.0
type PhpIniWriteResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
BackupName string `json:"backup_name,omitempty"`
Content string `json:"content,omitempty"`
Exists bool `json:"exists,omitempty"`
}
PhpIniWriteResponse mirrors SiteNginxWriteResponse (minus ValidationOutput, which has no clean php pre-flight equivalent).
type PortConflict ¶ added in v1.19.1
PortConflict reports a host port lerd wants to bind that is already taken by another process. Surfaced for inactive services so the user sees the blocker before clicking Start.
type PresetResponse ¶ added in v1.9.0
type PresetResponse struct {
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image,omitempty"`
Dashboard string `json:"dashboard,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
MissingDeps []string `json:"missing_deps,omitempty"`
Installed bool `json:"installed"`
Versions []config.PresetVersion `json:"versions,omitempty"`
DefaultVersion string `json:"default_version,omitempty"`
InstalledTags []string `json:"installed_tags,omitempty"`
}
PresetResponse describes a bundled service preset for the web UI.
type QueryAnalysis ¶ added in v1.23.0
type QueryAnalysis struct {
Requests []RequestAnalysis `json:"requests"`
Summary struct {
RequestsAnalyzed int `json:"requests_analyzed"`
NPlusOneFindings int `json:"n_plus_one_findings"`
SlowFindings int `json:"slow_findings"`
} `json:"summary"`
}
QueryAnalysis is the full report: only requests with at least one finding are listed, so an agent gets an actionable work-list rather than a dump.
type RequestAnalysis ¶ added in v1.23.0
type RequestAnalysis struct {
Site string `json:"site,omitempty"`
Request string `json:"request,omitempty"`
Worker string `json:"worker,omitempty"`
RID string `json:"rid,omitempty"`
QueryCount int `json:"query_count"`
TotalTimeMS float64 `json:"total_time_ms"`
NPlusOne []NPlusOneFinding `json:"n_plus_one,omitempty"`
Slow []SlowFinding `json:"slow,omitempty"`
}
RequestAnalysis groups findings for one request (or worker invocation).
type ServiceActionResponse ¶ added in v0.1.23
type ServiceActionResponse struct {
ServiceResponse
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Logs string `json:"logs,omitempty"`
}
ServiceActionResponse wraps the service state plus any error details.
type ServiceCheck ¶
type ServiceCheck struct {
Running bool `json:"running"`
}
type ServiceResponse ¶
type ServiceResponse struct {
Name string `json:"name"`
Status string `json:"status"`
Version string `json:"version,omitempty"`
EnvVars map[string]string `json:"env_vars"`
Dashboard string `json:"dashboard,omitempty"`
DashboardExternal bool `json:"dashboard_external,omitempty"`
ConnectionURL string `json:"connection_url,omitempty"`
Custom bool `json:"custom,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
// Tunable is true when the service exposes a user-editable runtime config
// override (see config.ServiceTuningMount), so the UI can show a Tuning tab.
Tunable bool `json:"tunable,omitempty"`
SiteCount int `json:"site_count"`
SiteDomains []string `json:"site_domains,omitempty"`
Pinned bool `json:"pinned"`
Paused bool `json:"paused,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
QueueSite string `json:"queue_site,omitempty"`
StripeListenerSite string `json:"stripe_listener_site,omitempty"`
ScheduleWorkerSite string `json:"schedule_worker_site,omitempty"`
ReverbSite string `json:"reverb_site,omitempty"`
HorizonSite string `json:"horizon_site,omitempty"`
WorkerSite string `json:"worker_site,omitempty"`
WorkerName string `json:"worker_name,omitempty"`
WorkerLabel string `json:"worker_label,omitempty"`
// Set when this worker entry is for a per-worktree unit
// (lerd-<wname>-<site>-<wt>); empty for parent-site workers.
WorkerWorktree string `json:"worker_worktree,omitempty"`
WorkerWorktreeDomain string `json:"worker_worktree_domain,omitempty"`
UpdateStrategy string `json:"update_strategy,omitempty"`
UpdateAvailable bool `json:"update_available,omitempty"`
LatestVersion string `json:"latest_version,omitempty"`
UpgradeVersion string `json:"upgrade_version,omitempty"`
PreviousVersion string `json:"previous_version,omitempty"`
// MigrationSupported and CanRollback intentionally drop omitempty so the
// false case still appears in the JSON. The UI uses === to distinguish
// "field missing" (no avail check ran) from "explicitly false".
MigrationSupported bool `json:"migration_supported"`
CanRollback bool `json:"can_rollback"`
PortConflicts []PortConflict `json:"port_conflicts,omitempty"`
}
ServiceResponse is the response for GET /api/services.
type ServiceTuningReadResponse ¶ added in v1.23.0
type ServiceTuningReadResponse struct {
Supported bool `json:"supported"`
Target string `json:"target"`
Content string `json:"content"`
Exists bool `json:"exists"`
}
ServiceTuningReadResponse is the JSON returned by GET /api/services/{name}/config. Exists distinguishes a real saved override from the seeded template the handler hands back when the file is missing — the frontend uses this to hide the "back up the current file first" checkbox on first save since there's nothing on disk yet to protect.
type ServiceTuningResetResponse ¶ added in v1.23.0
type ServiceTuningResetResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
RolledBack bool `json:"rolled_back,omitempty"`
AutoBackupName string `json:"auto_backup_name,omitempty"`
Content string `json:"content,omitempty"`
Exists bool `json:"exists,omitempty"`
}
ServiceTuningResetResponse is the JSON returned by POST /api/services/{name}/config/reset. AutoBackupName surfaces the implicit recovery snapshot Reset always stages of the pre-reset content (separate from the user-opted-in backup flag on Save); the modal can show "your previous config is kept as <name>, restore it any time" so users don't fear the action.
type ServiceTuningRestoreRequest ¶ added in v1.23.0
type ServiceTuningRestoreRequest struct {
Name string `json:"name"`
}
ServiceTuningRestoreRequest carries the exact backup name the frontend previewed in the diff modal. Empty means "newest" for tooling that has no preview UI.
type ServiceTuningRestoreResponse ¶ added in v1.23.0
type ServiceTuningRestoreResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Restored string `json:"restored,omitempty"`
Content string `json:"content,omitempty"`
RolledBack bool `json:"rolled_back,omitempty"`
}
ServiceTuningRestoreResponse is the JSON response for POST /api/services/{name}/config/restore. RolledBack is true when the restored bytes themselves crashed the service and the handler auto-reverted to the pre-restore content; the modal uses this to distinguish "restore succeeded" from "restore reverted, service is back on its prior config".
type ServiceTuningWriteRequest ¶ added in v1.23.0
type ServiceTuningWriteRequest struct {
Content string `json:"content"`
Backup bool `json:"backup"`
}
ServiceTuningWriteRequest is the JSON body for POST /api/services/{name}/config.
type ServiceTuningWriteResponse ¶ added in v1.23.0
type ServiceTuningWriteResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
BackupName string `json:"backup_name,omitempty"`
Content string `json:"content,omitempty"`
Exists bool `json:"exists,omitempty"`
// RolledBack is true when the restart failed and the handler
// successfully restored the previous bytes; the editor uses this
// to refresh `original` back to the rolled-back state instead of
// staying perpetually-dirty against bytes that never landed.
RolledBack bool `json:"rolled_back,omitempty"`
}
ServiceTuningWriteResponse mirrors SiteNginxWriteResponse so the frontend can share refresh logic between the two editors. Content + Exists round-trip the canonical post-write state (whether or not the restart succeeded) so the client can refresh its baseline even on the auto-rollback path.
type SettingsResponse ¶ added in v0.3.0
type SettingsResponse struct {
AutostartOnLogin bool `json:"autostart_on_login"`
WorkerExecMode string `json:"worker_exec_mode"`
WorkerModeApplies bool `json:"worker_mode_applies"` // true on macOS only
}
SettingsResponse is the response for GET /api/settings.
type SiteActionResponse ¶ added in v0.1.29
SiteActionResponse is returned by POST /api/sites/{domain}/secure|unsecure.
type SiteEnvBackup ¶ added in v1.23.0
SiteEnvBackup is one row in the GET /api/sites/{domain}/env/backups list. It aliases cfgedit.Backup so the env editor shares the edit service's shape.
type SiteEnvRestoreRequest ¶ added in v1.23.0
type SiteEnvRestoreRequest struct {
Name string `json:"name"`
}
SiteEnvRestoreRequest carries the previewed backup name so the restore applies the exact bytes the user saw, not whatever is newest at accept time.
type SiteEnvRestoreResponse ¶ added in v1.23.0
type SiteEnvRestoreResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Restored string `json:"restored,omitempty"`
Content string `json:"content,omitempty"`
}
SiteEnvRestoreResponse is the JSON body returned by POST /env/restore.
type SiteEnvWriteRequest ¶ added in v1.23.0
SiteEnvWriteRequest is the JSON body for PUT /api/sites/{domain}/env.
type SiteEnvWriteResponse ¶ added in v1.23.0
type SiteEnvWriteResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
BackupPath string `json:"backup_path,omitempty"`
}
SiteEnvWriteResponse is the JSON response for PUT /api/sites/{domain}/env.
type SiteNginxBackup ¶ added in v1.23.0
SiteNginxBackup is the backup metadata the frontend's restore dropdown consumes. It aliases cfgedit.Backup so the site, global-nginx, and php.ini editors all surface the same shape from the shared edit service.
type SiteNginxReadResponse ¶ added in v1.23.0
type SiteNginxReadResponse struct {
Path string `json:"path"`
Content string `json:"content"`
Exists bool `json:"exists"`
}
SiteNginxReadResponse is the JSON returned by GET /api/sites/{domain}/nginx. Exists distinguishes a real saved override from the seeded template the handler hands back when the file is missing; the frontend uses this to hide the "back up the current file first" checkbox on first save since there's nothing on disk yet to protect.
type SiteNginxResetResponse ¶ added in v1.23.0
SiteNginxResetResponse is the JSON returned by POST /api/sites/{d}/nginx/reset.
type SiteNginxRestoreRequest ¶ added in v1.23.0
type SiteNginxRestoreRequest struct {
Name string `json:"name"`
}
SiteNginxRestoreRequest is the JSON body for POST /api/sites/{d}/nginx/restore. The frontend always loads a specific backup and previews its diff before the user accepts, so we require the caller to name the backup it rendered; otherwise a concurrent save creating a NEWER backup between modal-open and accept would silently swap the live file with bytes the user never saw and consume the wrong file. Empty name means "newest" for tooling that doesn't have a preview UI.
type SiteNginxRestoreResponse ¶ added in v1.23.0
type SiteNginxRestoreResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Restored string `json:"restored,omitempty"`
Content string `json:"content,omitempty"`
}
SiteNginxRestoreResponse is the JSON response for POST /api/sites/{domain}/nginx/restore.
type SiteNginxWriteRequest ¶ added in v1.23.0
SiteNginxWriteRequest is the JSON body for POST /api/sites/{domain}/nginx.
type SiteNginxWriteResponse ¶ added in v1.23.0
type SiteNginxWriteResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
BackupName string `json:"backup_name,omitempty"`
ValidationOutput string `json:"validation_output,omitempty"`
Content string `json:"content,omitempty"`
Exists bool `json:"exists,omitempty"`
}
SiteNginxWriteResponse is the JSON response for POST /api/sites/{domain}/nginx. ValidationOutput carries the captured `nginx -t` stdout+stderr when the pre-flight validation step ran (whether it passed or failed) so the modal can show the user exactly which directive / line nginx complained about. Content/Exists round-trip the canonical post-write state so the client can refresh its `original` baseline even on the reload-failure path (file already landed on disk, just the runtime reload step failed).
type SiteReorderRequest ¶ added in v1.24.0
type SiteReorderRequest struct {
Order []string `json:"order"` // site names in the desired display order
}
handleSiteLink links a directory as a site via POST /api/sites/link. It streams command output as SSE events and sends a final "done" event. SiteReorderRequest is the JSON body for POST /api/sites/reorder.
type SiteResponse ¶
type SiteResponse struct {
Name string `json:"name"`
Domain string `json:"domain"`
Domains []string `json:"domains"`
ConflictingDomains []ConflictingDomain `json:"conflicting_domains,omitempty"`
Path string `json:"path"`
PHPVersion string `json:"php_version"`
UsesPHP bool `json:"uses_php"`
NodeVersion string `json:"node_version"`
TLS bool `json:"tls"`
Framework string `json:"framework"`
FPMRunning bool `json:"fpm_running"`
IsLaravel bool `json:"is_laravel"`
FrameworkLabel string `json:"framework_label"`
QueueRunning bool `json:"queue_running"`
QueueFailing bool `json:"queue_failing,omitempty"`
StripeRunning bool `json:"stripe_running"`
StripeSecretSet bool `json:"stripe_secret_set"`
StripeWebhookPath string `json:"stripe_webhook_path,omitempty"`
ScheduleRunning bool `json:"schedule_running"`
ScheduleFailing bool `json:"schedule_failing,omitempty"`
ReverbRunning bool `json:"reverb_running"`
ReverbFailing bool `json:"reverb_failing,omitempty"`
HasReverb bool `json:"has_reverb"`
HasHorizon bool `json:"has_horizon"`
HorizonRunning bool `json:"horizon_running"`
HorizonFailing bool `json:"horizon_failing,omitempty"`
HorizonReload bool `json:"horizon_reload,omitempty"` // horizon runs via horizon:listen (auto-reload)
HorizonReloadReady bool `json:"horizon_reload_ready,omitempty"` // chokidar present, so auto-reload can be enabled without installing it
HasQueueWorker bool `json:"has_queue_worker"`
HasScheduleWorker bool `json:"has_schedule_worker"`
FrameworkWorkers []WorkerStatus `json:"framework_workers,omitempty"`
HasAppLogs bool `json:"has_app_logs"`
LatestLogTime string `json:"latest_log_time,omitempty"`
HasFavicon bool `json:"has_favicon"`
HasEnv bool `json:"has_env"`
Paused bool `json:"paused"`
Branch string `json:"branch"`
Worktrees []WorktreeResponse `json:"worktrees"`
// Services lists the service names this site uses, sourced from the
// project's .lerd.yaml. Used by the dashboard to render service badges
// on the site detail panel.
Services []string `json:"services,omitempty"`
LANPort int `json:"lan_port,omitempty"`
CustomContainer bool `json:"custom_container,omitempty"`
ContainerPort int `json:"container_port,omitempty"`
ContainerImage string `json:"container_image,omitempty"`
Runtime string `json:"runtime,omitempty"`
RuntimeWorker bool `json:"runtime_worker,omitempty"`
HostProxy bool `json:"host_proxy,omitempty"`
HostPort int `json:"host_port,omitempty"`
HostHasDevServer bool `json:"host_has_dev_server,omitempty"`
// Grouping — Group is the group key (main site's name); GroupSubdomain is the
// label a secondary occupies; GroupMainDomain is the group main's base domain.
// MultiTenant flags a main whose project declares env_overrides (wildcard
// tenant subdomains) so the UI can warn that a secondary carves out a label.
Group string `json:"group,omitempty"`
GroupSubdomain string `json:"group_subdomain,omitempty"`
GroupMainDomain string `json:"group_main_domain,omitempty"`
MultiTenant bool `json:"multi_tenant,omitempty"`
}
SiteResponse is the response for GET /api/sites.
type SlowFinding ¶ added in v1.23.0
type SlowFinding struct {
SQL string `json:"sql"`
TimeMS float64 `json:"time_ms"`
Caller AnalyzedCaller `json:"caller"`
}
SlowFinding is a single query at or over the slow threshold.
type StatusResponse ¶
type StatusResponse struct {
DNS DNSStatus `json:"dns"`
Nginx ServiceCheck `json:"nginx"`
PHPFPMs []PHPStatus `json:"php_fpms"`
PHPDefault string `json:"php_default"`
NodeDefault string `json:"node_default"`
NodeManagedByLerd bool `json:"node_managed_by_lerd"`
WatcherRunning bool `json:"watcher_running"`
}
StatusResponse is the response for GET /api/status.
type VersionResponse ¶
type VersionResponse struct {
Current string `json:"current"`
Latest string `json:"latest"`
HasUpdate bool `json:"has_update"`
Changelog string `json:"changelog,omitempty"`
}
VersionResponse is the response for GET /api/version.
type WorkerStatus ¶ added in v1.0.0
type WorkerStatus struct {
Name string `json:"name"`
Label string `json:"label"`
Running bool `json:"running"`
Failing bool `json:"failing,omitempty"`
}
WorkerStatus represents a single framework worker and its running state.
type WorktreeResponse ¶ added in v0.6.0
type WorktreeResponse struct {
Branch string `json:"branch"`
Domain string `json:"domain"`
Path string `json:"path"`
PHPVersion string `json:"php_version,omitempty"`
NodeVersion string `json:"node_version,omitempty"`
PHPVersionOverride bool `json:"php_version_override,omitempty"`
NodeVersionOverride bool `json:"node_version_override,omitempty"`
FrameworkVersion string `json:"framework_version,omitempty"`
FrameworkLabel string `json:"framework_label,omitempty"`
DBIsolated bool `json:"db_isolated,omitempty"`
DBDatabase string `json:"db_database,omitempty"`
LANPort int `json:"lan_port,omitempty"`
FrameworkWorkers []WorkerStatus `json:"framework_workers,omitempty"`
}
WorktreeResponse is embedded in SiteResponse for each git worktree. PHP/NodeVersion are the effective values; *Override flags signal whether the worktree's .lerd.yaml set them explicitly or it's inherited.
Source Files
¶
- coalescer.go
- commands.go
- devtools.go
- dns_status_watcher.go
- dumps.go
- editor.go
- log_stream_registry.go
- logs_linux.go
- mailpit_webhook.go
- nginx_global.go
- notifier.go
- notify_diff.go
- notify_dumps.go
- notify_nplusone.go
- notify_serviceop.go
- notify_update.go
- php_ini.go
- profiler.go
- push.go
- queries_analyze.go
- remote_control.go
- remote_setup.go
- server.go
- server_linux.go
- snapshot.go
- stats.go
- svelte.go
- worker_failure_batcher.go
- worker_health_watcher.go
- worker_units.go
- ws.go
- ws_broker.go
- wsframe.go