Documentation
¶
Overview ¶
Package doctor is `muster doctor` (C-02.FR-14, FR-15): it checks the database, its schema version, its connections, the Keyring and the clock, prints one line per check as `OK|WARN|FAIL <check>: <detail>` and reports whether any check failed. It only reads: both connections it opens run every statement in a read-only transaction, and it takes no --actor. It checks every Mattermost Connection and Destination as their checks do, in the background client class (C-13.FR-10), every Telegram Connection with the steps of its check — the dry probe, getMe, getWebhookInfo — and every Telegram Destination with its Destination check — getChat and getChatMember in the channel and its discussion group — printing the failing step with its message (C-14.FR-11, FR-14), and every Bridge and Slack Connection and Destination with theirs (C-22.FR-2, FR-3, C-24.FR-2, FR-3). `muster dev doctor` sends a Slack Connection's requests where `muster dev` sends them, so that the published tokens of the fake Slack server never reach slack.com.
Index ¶
Constants ¶
const ( CheckDatabase = "database" CheckPostgreSQLVersion = "postgresql_version" CheckSchema = "schema" CheckSessionConnection = "session_connection" CheckTLSMain = "tls_main" CheckTLSSession = "tls_session" CheckKeyCanary = "key_canary" CheckKeyring = "keyring" CheckClockSkew = "clock_skew" // CheckConnections fails when the Organizations, an Organization's outbound address policy, or its Connections and // Destinations cannot be read; the policy is read for every Organization, with Connections or without, and when it // fails that Organization is not checked. Each Connection and Destination checked prints its own line, // "connection <name>" or "destination <name>". CheckConnections = "connections" )
The checks, in the order they are printed.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn interface {
Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}
Conn is what the checks need of a connection; *pgx.Conn and *pgxpool.Conn implement it.
type Connections ¶
type Connections struct {
Main Conn
Session SessionConn
Close func()
}
Connections are the main and the session connection; Close closes both.
type Opener ¶
Opener opens the two connections of cfg. The error of an unreachable connection names which one it is.
type Options ¶
type Options struct {
// Environ is the environment in the form of os.Environ; only MUSTER_* variables are read.
Environ []string
// Out receives the lines.
Out io.Writer
// Development is `muster dev doctor`, which accepts the published development key like the server does in
// development mode.
Development bool
// contains filtered or unexported fields
}
Options are what the CLI gives the doctor.
type SessionConn ¶
type SessionConn interface {
Conn
WaitForNotification(ctx context.Context) (*pgconn.Notification, error)
}
SessionConn is the session connection, which also receives notifications.