self_check

package
v1.9.10-0...-1ccd1c0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTaskNotFound                     = e.New(40400, "Task not found")
	ErrTaskNotFixable                   = e.New(40401, "Task is not fixable")
	ErrFailedToReadNginxConf            = e.New(40402, "Failed to read nginx.conf")
	ErrParseNginxConf                   = e.New(50001, "Failed to parse nginx.conf")
	ErrNginxConfNoHttpBlock             = e.New(40403, "Nginx conf no http block")
	ErrNginxConfNotIncludeSitesEnabled  = e.New(40404, "Nginx conf not include sites-enabled")
	ErrNginxConfNoStreamBlock           = e.New(40405, "Nginx conf no stream block")
	ErrNginxConfNotIncludeStreamEnabled = e.New(40406, "Nginx conf not include stream-enabled")
	ErrFailedToCreateBackup             = e.New(50002, "Failed to create backup")
	ErrSitesAvailableNotExist           = e.New(40407, "Sites-available directory not exist")
	ErrSitesEnabledNotExist             = e.New(40408, "Sites-enabled directory not exist")
	ErrStreamAvailableNotExist          = e.New(40409, "Streams-available directory not exist")
	ErrStreamEnabledNotExist            = e.New(40410, "Streams-enabled directory not exist")
	ErrNginxConfNotIncludeConfD         = e.New(40411, "Nginx conf not include conf.d directory")
	ErrDockerSocketNotExist             = e.New(40412, "Docker socket not exist")
	ErrConfigDirNotExist                = e.New(40413, "Config directory not exist")
	ErrConfigEntryFileNotExist          = e.New(40414, "Config entry file not exist")
	ErrPIDPathNotExist                  = e.New(40415, "PID path not exist")
	ErrSbinPathNotExist                 = e.New(40416, "Sbin path not exist")
	ErrAccessLogPathNotExist            = e.New(40417, "Access log path not exist")
	ErrErrorLogPathNotExist             = e.New(40418, "Error log path not exist")
	ErrConfdNotExists                   = e.New(40419, "Conf.d directory not exists")
	ErrGeoLiteDBNotFound                = e.New(40420, "GeoLite2 database not found at {0}. Log indexing requires GeoLite2 database for geographic IP analysis")
	ErrFailedToReadBundledNginxUIConf   = e.New(50007, "Failed to read bundled nginx-ui.conf: {0}")
	ErrBundledNginxUIConfOutdated       = e.New(40421, "Bundled nginx-ui.conf is missing the WebSocket reverse-proxy fix")
	ErrFixedConfigInvalid               = e.New(50008, "Patched nginx-ui.conf is invalid: {0}")
	ErrReloadFailed                     = e.New(50009, "Nginx reload after fix failed: {0}")
	ErrCriticalRecoveryFailed           = e.New(50010, "Failed to restore nginx-ui.conf from backup: {0}")
	ErrExternalConfigNotShared          = e.New(40422, "Nginx configuration directory is not shared with external container at {0}")
	ErrExternalConfigCheckFailed        = e.New(50011, "Failed to verify external Nginx configuration directory {0}: {1}")
)

Functions

func AttemptFix

func AttemptFix(taskName string) (err error)

func CheckAccessLogPath

func CheckAccessLogPath() error

CheckAccessLogPath checks if the access log path exists

func CheckBundledNginxUIConf

func CheckBundledNginxUIConf() error

CheckBundledNginxUIConf returns nil if the bundled conf has all expected fix markers, or ErrBundledNginxUIConfOutdated if any marker is missing. Outside of managed bundled Nginx Docker mode, returns nil unconditionally.

func CheckConfDirectory

func CheckConfDirectory() error

CheckConfDirectory checks if conf.d directory exists

func CheckConfigDir

func CheckConfigDir() error

CheckConfigDir checks if the config directory exists

func CheckConfigEntryFile

func CheckConfigEntryFile() error

CheckConfigEntryFile checks if the config entry file exists

func CheckDockerSocket

func CheckDockerSocket() error

func CheckErrorLogPath

func CheckErrorLogPath() error

CheckErrorLogPath checks if the error log path exists

func CheckExternalContainerConfigShared

func CheckExternalContainerConfigShared() error

CheckExternalContainerConfigShared verifies that local configuration writes are visible at the same path inside the configured external Nginx container.

func CheckGeoLiteDB

func CheckGeoLiteDB() error

func CheckNginxConfIncludeConfD

func CheckNginxConfIncludeConfD() error

CheckNginxConfIncludeConfD checks if nginx.conf includes conf.d directory

func CheckNginxConfIncludeSites

func CheckNginxConfIncludeSites() error

CheckNginxConfIncludeSites checks if nginx.conf include sites-enabled

func CheckNginxConfIncludeStreams

func CheckNginxConfIncludeStreams() error

CheckNginxConfIncludeStreams checks if nginx.conf include streams-enabled

func CheckPIDPath

func CheckPIDPath() error

CheckPIDPath checks if the PID path exists

func CheckSbinPath

func CheckSbinPath() error

CheckSbinPath checks if the sbin path exists

func CheckSitesDirectory

func CheckSitesDirectory() error

CheckSitesDirectory checks if sites-available/sites-enabled directory exists

func CheckStreamDirectory

func CheckStreamDirectory() error

CheckStreamDirectory checks if stream-available/stream-enabled directory exists

func FixBundledNginxUIConf

func FixBundledNginxUIConf() error

FixBundledNginxUIConf is the FixFunc for the bundled nginx-ui.conf upgrade self_check task (registered in tasks.go). Flow: read -> backup -> patch -> atomic write -> nginx -t -> reload. On any failure after the backup is created, the file is rolled back; the error always includes the backup path.

func FixConfDirectory

func FixConfDirectory() error

FixConfDirectory creates conf.d directory

func FixGeoLiteDB

func FixGeoLiteDB() error

func FixNginxConfIncludeConfD

func FixNginxConfIncludeConfD() error

FixNginxConfIncludeConfD attempts to fix nginx.conf to include conf.d directory

func FixNginxConfIncludeSites

func FixNginxConfIncludeSites() error

FixNginxConfIncludeSites attempts to fix nginx.conf include sites-enabled

func FixNginxConfIncludeStreams

func FixNginxConfIncludeStreams() error

FixNginxConfIncludeStreams attempts to fix nginx.conf include streams-enabled

func FixSitesDirectory

func FixSitesDirectory() error

FixSitesDirectory creates sites-available/sites-enabled directory

func FixStreamDirectory

func FixStreamDirectory() error

FixStreamDirectory creates stream-available/stream-enabled directory

func Init

func Init()

Types

type Report

type Report struct {
	Key         string                 `json:"key"`
	Name        *translation.Container `json:"name"`
	Description *translation.Container `json:"description,omitempty"`
	Fixable     bool                   `json:"fixable"`
	Err         *cosy.Error            `json:"err,omitempty"`
	Status      ReportStatus           `json:"status"`
}

type ReportStatus

type ReportStatus string
const (
	ReportStatusSuccess ReportStatus = "success"
	ReportStatusWarning ReportStatus = "warning"
	ReportStatusError   ReportStatus = "error"
)

type Reports

type Reports []*Report

func Run

func Run() (reports Reports)

type Task

type Task struct {
	Key         string
	Name        *translation.Container
	Description *translation.Container
	CheckFunc   func() error
	FixFunc     func() error
}

Jump to

Keyboard shortcuts

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