siteops

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupRelink(path, newName string) bool

CleanupRelink handles the re-link scenario: when a site is being linked at a path that already has registrations, it carries over the secured state and removes stale entries (e.g. name changed). Returns the carried-over secured flag.

func FinishCustomLink(site config.Site, containerCfg *config.ContainerConfig) error

FinishCustomLink performs the post-registration steps for a custom container site: build the image, write a dedicated quadlet, generate a proxy vhost, update container hosts, and reload nginx.

func FinishFrankenPHPLink(site config.Site) error

FinishFrankenPHPLink performs the post-registration steps for a site whose runtime is "frankenphp": ensure the image is pulled, write a per-site quadlet that runs the framework's entrypoint, generate an nginx proxy vhost, update container hosts, and reload nginx.

func FinishLink(site config.Site, phpVersion string) error

FinishLink performs the post-registration steps shared by link, park, and MCP: vhost generation, FPM quadlet setup, container hosts update, and nginx reload.

func IsParkedSite

func IsParkedSite(sitePath string, parkedDirs []string) bool

IsParkedSite checks whether a site's path is inside one of the parked directories.

func RegenerateSiteVhost

func RegenerateSiteVhost(site *config.Site, oldPrimary string) error

RegenerateSiteVhost regenerates the nginx vhost for a site after domain changes. If the primary domain changed, the old vhost file is removed. For secured sites the SSL vhost is generated and renamed to the main .conf path.

func SetSecured added in v1.20.2

func SetSecured(site *config.Site, secured bool) error

SetSecured toggles the site's TLS state and runs every step the toggle depends on. It is the single source of truth for "what happens when a site is secured/unsecured"; CLI, UI, and MCP all call this with no per-caller variation so a new step added here applies everywhere.

Steps:

  1. Issue or remove the certificate (also regenerates the nginx vhost on disk).
  2. Persist site.Secured to the registry.
  3. Sync APP_URL and VITE_REVERB_HOST/SCHEME/PORT in the project's .env.
  4. Update the per-project .lerd.yaml secured flag.
  5. Reload nginx so the new vhost takes effect.
  6. Notify the daemon to refresh dependent listeners (Stripe webhook URL, LAN share proxy backend port). The daemon owns the in-process state for these, so even callers running inside the daemon hit the same HTTP endpoints; a tiny loopback roundtrip is the cost of having one identical post-toggle path.

func SiteNameAndDomain

func SiteNameAndDomain(dirName, tld string) (string, string)

SiteNameAndDomain derives a clean site name and domain from a directory name. It strips one trailing TLD (either a gTLD from the curated list or any 2-letter ccTLD), then replaces remaining dots with dashes so the result is a valid DNS label. Examples:

"myapp"              -> "myapp",          "myapp.test"
"myapp.com"          -> "myapp",          "myapp.test"
"astrolov.ro"        -> "astrolov",       "astrolov.test"
"admin.astrolov.com" -> "admin-astrolov", "admin-astrolov.test"

func UnlinkSiteCore

func UnlinkSiteCore(site *config.Site, parkedDirs []string) error

UnlinkSiteCore performs the shared unlink steps: remove vhost, remove certs, update registry (ignore if parked, remove otherwise), update container hosts, and reload nginx. It does NOT stop workers or clean up unused services/FPMs — callers that need those should do them before calling this function.

Types

type VersionResult

type VersionResult struct {
	PHP            string // best installed PHP version (clamped to framework range)
	Node           string // detected Node version
	PHPMin         string // framework minimum PHP version (empty if no framework)
	PHPMax         string // framework maximum PHP version (empty if no framework)
	SuggestedPHP   string // better PHP version to install (empty if current is optimal)
	FrameworkLabel string // human-readable framework name for messages
}

VersionResult holds the detected and suggested versions for a site.

func DetectSiteVersions

func DetectSiteVersions(dir, framework, defaultPHP, defaultNode string) VersionResult

DetectSiteVersions resolves the framework, PHP version (clamped to framework range), and Node version for a project directory. When the best installed PHP version is below the framework's max, SuggestedPHP is set to the max version.

Jump to

Keyboard shortcuts

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