probe

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package probe implements HTTP readiness checking: the controller calls out to a container over HTTP, rather than the container self-reporting health via Docker's own HEALTHCHECK state machine. The app spec's health.readiness/liveness config is modeled on Kubernetes' prober pattern for exactly this reason, the same choice ADR 002's Consequences section already commits to over Coolify's confirmed weaker default (health checking disabled unless the user opts in, gated entirely on Docker's own HEALTHCHECK).

This package implements the readiness half only: waiting for a freshly started container to become ready before an application controller cuts traffic to it or removes the container it's replacing. Liveness (continuously monitoring an already-running container and triggering a restart after repeated failures) is a related but genuinely separate capability, deliberately not built here, see TASKS.md 1.3's notes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitReady

func WaitReady(ctx context.Context, client *http.Client, addr string, cfg Config) error

WaitReady polls http://addr+cfg.Path on cfg.Interval, each attempt bounded by cfg.Timeout, until a response in the 2xx range comes back or ctx is done. It returns nil on the first success, or ctx's error (wrapped with the last probe failure reason, if any) once ctx expires.

client is caller-supplied rather than using http.DefaultClient, so callers (and tests) control transport settings and can inject a client pointed at a test server.

Types

type Config

type Config struct {
	Path     string
	Interval time.Duration
	Timeout  time.Duration
}

Config is one HTTP probe's settings. Zero Interval or Timeout means "not specified" (matching internal/spec's optional YAML fields); WaitReady applies sensible defaults rather than busy-looping on a zero-length interval or never timing out a single attempt.

Jump to

Keyboard shortcuts

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