infra

package
v0.4.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogStreamAll    = "all"
	LogStreamStdout = "stdout"
	LogStreamStderr = "stderr"
)

A container writes two separate outputs and nginx uses both: the access log goes to stdout and the error log to stderr, so the two are readable apart without configuring a file.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfraStats

type InfraStats struct {
	TotalServices int `json:"total_services"`
	Running       int `json:"running"`
	Stopped       int `json:"stopped"`
	External      int `json:"external"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg *config.Config) *Manager

func (*Manager) CheckSecurityHealth

func (m *Manager) CheckSecurityHealth() *SecurityHealthCheck

CheckSecurityHealth verifies the security setup is correctly configured

func (*Manager) ContainerName

func (m *Manager) ContainerName(name string) string

ContainerName is the container behind an infrastructure service, or "" if there is none.

func (*Manager) EnsureBaseNginxConfig

func (m *Manager) EnsureBaseNginxConfig() error

EnsureBaseNginxConfig refreshes an already-managed base nginx.conf from the current template so an upgraded agent picks up template changes (such as the server_names_hash settings) without a security toggle. It preserves the on-disk variant (lua or plain) and is a no-op when no managed config exists or the content already matches.

func (*Manager) GetAgentPort

func (m *Manager) GetAgentPort() int

GetAgentPort returns the port the agent API is listening on

func (*Manager) GetDockerHostIP

func (m *Manager) GetDockerHostIP() string

GetDockerHostIP returns the IP address that containers can use to reach the host. It tries multiple methods and falls back to the default Docker bridge gateway.

func (*Manager) GetService

func (m *Manager) GetService(name string) (*models.InfraService, error)

func (*Manager) GetServiceLogs

func (m *Manager) GetServiceLogs(name string, tail int) (string, error)

func (*Manager) GetStats

func (m *Manager) GetStats() (*InfraStats, error)

func (*Manager) IsNginxRunning

func (m *Manager) IsNginxRunning() bool

IsNginxRunning checks if the nginx container is running

func (*Manager) ListServices

func (m *Manager) ListServices() ([]models.InfraService, error)

func (*Manager) RefreshSecurityScripts

func (m *Manager) RefreshSecurityScripts() (*RefreshSecurityScriptsResult, error)

RefreshSecurityScripts regenerates all security configs: nginx.conf, Lua scripts, and vhosts

func (*Manager) RestartService

func (m *Manager) RestartService(name string) error

func (*Manager) ServiceLogs

func (m *Manager) ServiceLogs(name string, tail int, stream string) (string, error)

func (*Manager) SetNginxRealtimeCapture

func (m *Manager) SetNginxRealtimeCapture(enabled bool) error

func (*Manager) SetNginxRealtimeCaptureWithStatus

func (m *Manager) SetNginxRealtimeCaptureWithStatus(enabled bool) (map[string]interface{}, error)

SetNginxRealtimeCaptureWithStatus enables/disables realtime capture and returns detailed status

func (*Manager) StartService

func (m *Manager) StartService(name string) error

func (*Manager) StopService

func (m *Manager) StopService(name string) error

func (*Manager) StreamServiceLogs

func (m *Manager) StreamServiceLogs(ctx context.Context, name string, tail int, stream string, sink func(string)) error

StreamServiceLogs follows an infrastructure container's output until ctx is done, handing each line to sink as it is written.

func (*Manager) UpdateConfig

func (m *Manager) UpdateConfig(cfg *config.Config)

type RefreshSecurityScriptsResult

type RefreshSecurityScriptsResult struct {
	Success            bool     `json:"success"`
	AgentIP            string   `json:"agent_ip"`
	AgentPort          int      `json:"agent_port"`
	NginxConfWritten   bool     `json:"nginx_conf_written"`
	LuaWritten         bool     `json:"lua_written"`
	VolumesModified    bool     `json:"volumes_modified"`
	ContainerRecreated bool     `json:"container_recreated"`
	NginxReloaded      bool     `json:"nginx_reloaded"`
	VhostsUpdated      []string `json:"vhosts_updated,omitempty"`
	Errors             []string `json:"errors,omitempty"`
}

RefreshSecurityScriptsResult contains the result of refreshing security scripts

type SecurityHealthCheck

type SecurityHealthCheck struct {
	Status          string                 `json:"status"`
	Checks          map[string]bool        `json:"checks"`
	Issues          []string               `json:"issues"`
	Recommendations []string               `json:"recommendations"`
	Details         map[string]interface{} `json:"details,omitempty"`
}

SecurityHealthCheck represents the result of a security setup health check

Jump to

Keyboard shortcuts

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