Documentation
¶
Overview ¶
Package doctor provides comprehensive health check sections for nself doctor.
Index ¶
- type CheckResult
- func BackupChecks(_ context.Context, projectDir string) []CheckResult
- func CheckJWTSecretPresent(projectDir string) CheckResult
- func DeepChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
- func DockerDeepChecks(ctx context.Context, verbose bool) []CheckResult
- func FilterBySection(results []CheckResult, section string) []CheckResult
- func FixItEngine(ctx context.Context, results []CheckResult) []CheckResult
- func HasuraChecks(ctx context.Context, verbose bool) []CheckResult
- func HostChecks(ctx context.Context, verbose bool) []CheckResult
- func LicenseChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
- func MonitoringChecks(ctx context.Context) []CheckResult
- func NginxChecks(ctx context.Context, verbose bool) []CheckResult
- func PingChecks(ctx context.Context, verbose bool) []CheckResult
- func PluginHealthChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
- func PostgresChecks(ctx context.Context, verbose bool) []CheckResult
- func SSLChecks(ctx context.Context, verbose bool) []CheckResult
- func SecurityChecks(ctx context.Context, projectDir string) []CheckResult
- func SystemChecks(ctx context.Context, verbose bool) []CheckResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
Section string `json:"section"`
Name string `json:"name"`
Status string `json:"status"` // pass, warn, fail
Message string `json:"message"`
FixCmd string `json:"fix_cmd,omitempty"` // suggested fix command
}
CheckResult holds the outcome of a single diagnostic check.
func BackupChecks ¶
func BackupChecks(_ context.Context, projectDir string) []CheckResult
BackupChecks verifies backup health.
func CheckJWTSecretPresent ¶ added in v1.0.7
func CheckJWTSecretPresent(projectDir string) CheckResult
CheckJWTSecretPresent reports whether HASURA_GRAPHQL_JWT_SECRET is defined in any of the project's env files. Semantics:
- fail when the key is absent from both .env and .env.secrets and no other env file has it either; this is what the spec calls "Hasura enabled but JWT secret absent from both sources".
- warn when the key is in .env.secrets but missing from .env. This is the nSelf-preferred arrangement (secrets live in .env.secrets which is gitignored and chmod 0600), so it is informational only.
- pass when the key is present in .env (with or without .env.secrets).
projectDir is the working directory passed through from `nself doctor`.
func DeepChecks ¶
func DeepChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
DeepChecks runs all 12 subsystem categories for --deep mode.
func DockerDeepChecks ¶
func DockerDeepChecks(ctx context.Context, verbose bool) []CheckResult
DockerDeepChecks verifies daemon, storage driver, dangling images, container health.
func FilterBySection ¶
func FilterBySection(results []CheckResult, section string) []CheckResult
FilterBySection returns only checks matching the given section name.
func FixItEngine ¶
func FixItEngine(ctx context.Context, results []CheckResult) []CheckResult
FixItEngine runs safe auto-fixes for check results that have FixCmd set.
func HasuraChecks ¶
func HasuraChecks(ctx context.Context, verbose bool) []CheckResult
HasuraChecks verifies /healthz 200 and metadata consistency.
func HostChecks ¶
func HostChecks(ctx context.Context, verbose bool) []CheckResult
HostChecks verifies disk, memory, CPU, time sync, kernel.
func LicenseChecks ¶
func LicenseChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
LicenseChecks verifies license is current and tier matches expected.
func MonitoringChecks ¶
func MonitoringChecks(ctx context.Context) []CheckResult
MonitoringChecks verifies monitoring stack health.
func NginxChecks ¶
func NginxChecks(ctx context.Context, verbose bool) []CheckResult
NginxChecks verifies config test and SSL cert expiry.
func PingChecks ¶
func PingChecks(ctx context.Context, verbose bool) []CheckResult
PingChecks verifies ping.nself.org reachable and license cache fresh.
func PluginHealthChecks ¶
func PluginHealthChecks(ctx context.Context, projectDir string, verbose bool) []CheckResult
PluginHealthChecks verifies every installed plugin's health endpoint.
func PostgresChecks ¶
func PostgresChecks(ctx context.Context, verbose bool) []CheckResult
PostgresChecks verifies pg_isready, replication lag, longest query, dead tuples, vacuum.
func SSLChecks ¶
func SSLChecks(ctx context.Context, verbose bool) []CheckResult
SSLChecks verifies LE renewal cron, last renewal, OCSP stapling.
func SecurityChecks ¶
func SecurityChecks(ctx context.Context, projectDir string) []CheckResult
SecurityChecks runs security diagnostics.
func SystemChecks ¶
func SystemChecks(ctx context.Context, verbose bool) []CheckResult
SystemChecks runs system-level diagnostics: disk, memory, swap, load, clock sync, Docker, kernel.