healthcheck

package
v0.35.8 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHTTP

func CheckHTTP(ctx context.Context, name, targetURL string) sitevalidate.Result

CheckHTTP verifies that url returns a 2xx or 3xx response from the host running sitectl.

func CheckHTTPViaOrigin added in v0.35.2

func CheckHTTPViaOrigin(ctx context.Context, name, targetURL, originHost string) sitevalidate.Result

CheckHTTPViaOrigin verifies targetURL while dialing originHost instead of resolving the URL hostname through public DNS. The URL hostname is preserved for Host headers and TLS SNI.

func CheckHTTPViaOriginInsecureTLS added in v0.35.2

func CheckHTTPViaOriginInsecureTLS(ctx context.Context, name, targetURL, originHost string) sitevalidate.Result

CheckHTTPViaOriginInsecureTLS verifies targetURL through originHost while allowing non-public origin certificates such as mkcert or Cloudflare Origin CA.

func ProjectEnv

func ProjectEnv(ctx *config.Context) map[string]string

ProjectEnv reads the project's .env file. Missing or unparsable files return an empty map so health checks can continue with stack defaults.

func PublicURLFromEnv

func PublicURLFromEnv(ctx *config.Context, defaultScheme, defaultDomain string) string

PublicURLFromEnv builds a public app URL from .env values and the context's Compose port bindings. SITE_URL wins when explicitly configured. Otherwise target port 443 implies https and target port 80 implies http.

func PublicURLFromTraefik added in v0.28.0

func PublicURLFromTraefik(ctx *config.Context, opts TraefikRouteOptions) (string, bool, error)

PublicURLFromTraefik resolves a public application URL from Traefik router configuration. It reads the Traefik service's file provider mount, dynamic routers, entrypoints, and Compose-published ports from the supplied context.

Types

type DockerChecker

type DockerChecker struct {
	Context *config.Context
	Client  *sitectldocker.DockerClient
}

DockerChecker runs health checks against the Docker Compose project attached to a sitectl context.

func NewDockerChecker

func NewDockerChecker(ctx *config.Context) (*DockerChecker, error)

NewDockerChecker creates a Docker-backed checker for the given context.

func (*DockerChecker) CheckComposeServiceDependsOnHealthy added in v0.23.2

func (c *DockerChecker) CheckComposeServiceDependsOnHealthy(ctx context.Context, service, dependency string) sitevalidate.Result

CheckComposeServiceDependsOnHealthy verifies that a Compose service depends on another service with condition: service_healthy.

func (*DockerChecker) CheckComposeServices

func (c *DockerChecker) CheckComposeServices(ctx context.Context, services ...string) ([]sitevalidate.Result, error)

CheckComposeServices verifies compose service containers are present, running, and either healthy or without a Docker healthcheck.

func (*DockerChecker) CheckHTTPFromContainer

func (c *DockerChecker) CheckHTTPFromContainer(ctx context.Context, name, service, targetURL string) sitevalidate.Result

CheckHTTPFromContainer verifies that url is reachable from inside service.

func (*DockerChecker) CheckHTTPFromContainerWithHostHeader added in v0.23.2

func (c *DockerChecker) CheckHTTPFromContainerWithHostHeader(ctx context.Context, name, service, targetURL, hostHeader string) sitevalidate.Result

CheckHTTPFromContainerWithHostHeader verifies that url is reachable from inside service while sending a specific HTTP Host header.

func (*DockerChecker) CheckHTTPRoute added in v0.23.2

func (c *DockerChecker) CheckHTTPRoute(ctx context.Context, name, service, publicURL string) sitevalidate.Result

CheckHTTPRoute verifies an application route at its resolved public URL.

func (*DockerChecker) CheckMariaDB

func (c *DockerChecker) CheckMariaDB(ctx context.Context, service string) sitevalidate.Result

CheckMariaDB verifies that a MariaDB/MySQL service is accepting local connections from inside its own container.

func (*DockerChecker) CheckMySQL added in v0.19.7

func (c *DockerChecker) CheckMySQL(ctx context.Context, service string) sitevalidate.Result

CheckMySQL verifies that a MySQL/MariaDB service is accepting local connections from inside its own container.

func (*DockerChecker) CheckOptionalHTTPServices added in v0.23.2

func (c *DockerChecker) CheckOptionalHTTPServices(ctx context.Context, checks ...OptionalHTTPServiceCheck) ([]sitevalidate.Result, error)

CheckOptionalHTTPServices runs container-side HTTP checks for optional services only when the service exists and its compose container is healthy.

func (*DockerChecker) CheckSolrCore

func (c *DockerChecker) CheckSolrCore(ctx context.Context, service, core string) sitevalidate.Result

CheckSolrCore verifies that a Solr core is loaded from inside the Solr container.

func (*DockerChecker) Close

func (c *DockerChecker) Close() error

Close releases resources owned by the checker.

func (*DockerChecker) ServiceEnv added in v0.25.0

func (c *DockerChecker) ServiceEnv(ctx context.Context, service, key string) (string, bool, error)

ServiceEnv returns one configured environment variable for a Compose service.

func (*DockerChecker) ServiceEnvironment added in v0.25.0

func (c *DockerChecker) ServiceEnvironment(ctx context.Context, service string) (map[string]string, error)

ServiceEnvironment returns the configured environment for a Compose service container. If a service has multiple containers, the first one returned by Docker is used, matching service exec behavior.

func (*DockerChecker) ServiceExists

func (c *DockerChecker) ServiceExists(ctx context.Context, service string) (bool, error)

ServiceExists reports whether the current compose project has at least one container for service.

type OptionalHTTPServiceCheck added in v0.23.2

type OptionalHTTPServiceCheck struct {
	Service string
	Name    string
	URL     string
}

type TraefikRouteOptions added in v0.28.0

type TraefikRouteOptions struct {
	AppService     string
	Router         string
	TraefikService string
	DefaultScheme  string
	DefaultDomain  string
}

TraefikRouteOptions describes the application route to resolve from Traefik dynamic configuration and the Compose Traefik service that owns it.

Jump to

Keyboard shortcuts

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