Files
mesh-catalog/modules/distribution/internal/holder/health.go
T
jschoubben 6cf7f67a1d
mesh/delivery closed: a newer head of the same pull request
mesh/check checking 6cf7f67a1dfd on 08fbc51af26f
distribution's program listens on 5100 and the registry container on 5001, so no mapping names the store's port
The composer finds a listen's machine port in a container mapping that names
it on either side (MachineSide). The program's listen 5000 matched the
registry container's inner 5000 in 127.0.0.1:5001:5000, so the store's address
became the container's loopback side and the program's own port was never
opened: the move to 83cd1a3d on 2026-11-08 23:25 UTC cut the artifact store off
(issue 1966 note 109). The program now binds 5100, where every machine fetches
(the artifact-store alias and the seats' reach agree), and the container serves
5001 inside and out. A row holds that no container names 5100.

Undo: revert this commit.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 01:40:49 +01:00

35 lines
1.4 KiB
Go

package holder
import "fmt"
// FindingReadSide is the finding of a store whose read side does not answer through the program.
const FindingReadSide = "read-side-down"
// ProbeName is the name the health check lists on each seat: any name answers, an empty list included.
const ProbeName = Self + "/program"
// Health is distribution's health check (design 51 *While the program is down*; ADR 0240), run by the runtime each
// minute outside the program's process: it asks `versions` of each seat it holds through the store's read side, the
// program's port (front), and answers what failed, naming the program. The finding is written while it fails and
// cleared once it answers.
func Health(front Catalog, finding func(kind, subject, words string, raised bool)) (map[string]any, error) {
answered := map[string]int{}
for _, seat := range Seats {
got, err := front.Versions(ProbeName)
if err != nil {
words := fmt.Sprintf("the store's read side does not answer %s's versions through distribution's program (port 5100): %v; is the program distribution running?", seat, err)
if finding != nil {
finding(FindingReadSide, seat, words, true)
}
return nil, fmt.Errorf("%s", words)
}
answered[seat] = len(got)
}
if finding != nil {
for _, seat := range Seats {
finding(FindingReadSide, seat, "", false)
}
}
return map[string]any{"healthy": true, "versions": answered}, nil
}