Documentation
¶
Index ¶
- func CheckHTTP(ctx context.Context, name, targetURL string) sitevalidate.Result
- func ProjectEnv(ctx *config.Context) map[string]string
- func PublicURLFromEnv(ctx *config.Context, defaultScheme, defaultDomain string) string
- func PublicURLFromTraefik(ctx *config.Context, opts TraefikRouteOptions) (string, bool, error)
- type DockerChecker
- func (c *DockerChecker) CheckComposeServiceDependsOnHealthy(ctx context.Context, service, dependency string) sitevalidate.Result
- func (c *DockerChecker) CheckComposeServices(ctx context.Context, services ...string) ([]sitevalidate.Result, error)
- func (c *DockerChecker) CheckHTTPFromContainer(ctx context.Context, name, service, targetURL string) sitevalidate.Result
- func (c *DockerChecker) CheckHTTPFromContainerWithHostHeader(ctx context.Context, name, service, targetURL, hostHeader string) sitevalidate.Result
- func (c *DockerChecker) CheckHTTPRoute(ctx context.Context, name, service, publicURL string) sitevalidate.Result
- func (c *DockerChecker) CheckMariaDB(ctx context.Context, service string) sitevalidate.Result
- func (c *DockerChecker) CheckMySQL(ctx context.Context, service string) sitevalidate.Result
- func (c *DockerChecker) CheckOptionalHTTPServices(ctx context.Context, checks ...OptionalHTTPServiceCheck) ([]sitevalidate.Result, error)
- func (c *DockerChecker) CheckSolrCore(ctx context.Context, service, core string) sitevalidate.Result
- func (c *DockerChecker) Close() error
- func (c *DockerChecker) ServiceEnv(ctx context.Context, service, key string) (string, bool, error)
- func (c *DockerChecker) ServiceEnvironment(ctx context.Context, service string) (map[string]string, error)
- func (c *DockerChecker) ServiceExists(ctx context.Context, service string) (bool, error)
- type OptionalHTTPServiceCheck
- type TraefikRouteOptions
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 ProjectEnv ¶
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 ¶
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
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
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 ¶
ServiceExists reports whether the current compose project has at least one container for service.
type OptionalHTTPServiceCheck ¶ added in v0.23.2
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.