Documentation
¶
Index ¶
- Constants
- Variables
- func AgentDirName(agentType string) string
- func DefaultAgentDataDir() string
- func DefaultAgentDataDirFor(agentType string) string
- func DetectTimezone() string
- func EnvLogLevelSet() bool
- func LogLevel() slog.Level
- func ParseLogLevel(s string) (slog.Level, bool)
- func SystemAgentDataDirFor(agentType string) string
- func UpdateAgentToken(filePath, token string, expires time.Time) error
- type AgentConfig
- type AgentTokensConfig
- type AuditConfig
- type AuthConfig
- type DatabaseConfig
- type EmbeddedTemporalConfig
- type OIDCConfig
- type SecurityConfig
- type ServerConfig
- func (c *ServerConfig) EffectiveJWTSecretFile() string
- func (c *ServerConfig) EffectiveMasterKeyFile() string
- func (c *ServerConfig) ProxyURL() string
- func (c *ServerConfig) PublicURLIsHTTPS() bool
- func (c *ServerConfig) ScheduleLocation() *time.Location
- func (c *ServerConfig) Validate(dev bool) error
- type TemporalConfig
- type TemporalServerConfig
- type TemporalUIConfig
Constants ¶
const ( TemporalModeEmbedded = "embedded" TemporalModeExternal = "external" )
Temporal deployment modes
const ( AgentTypeFilesystem = "filesystem" AgentTypeDatabase = "database" AgentTypeKubernetes = "kubernetes" )
Agent types (agents.agent_type); each has its own binary and data directory
const DefaultMaxConcurrentActivities = 16
DefaultMaxConcurrentActivities is the agent's activity cap when none is configured
const SystemAgentDataDir = "/var/lib/fallbck/agent"
SystemAgentDataDir is where packaged installations (systemd/OpenRC services) keep the agent state; the service units point at it explicitly.
const SystemDBAgentDataDir = "/var/lib/fallbck/db-agent"
SystemDBAgentDataDir is the state directory of the retired standalone fallbck-db-agent; `fallbck-agent migrate-db-agent` reads it by default
Variables ¶
var AgentTypes = []string{AgentTypeFilesystem, AgentTypeDatabase, AgentTypeKubernetes}
AgentTypes lists the known agent types
Functions ¶
func AgentDirName ¶ added in v0.6.0
AgentDirName is the per-type directory name under /var/lib/fallbck and ~/.fallbck
func DefaultAgentDataDir ¶ added in v0.3.1
func DefaultAgentDataDir() string
DefaultAgentDataDir returns the agent data directory used when none is configured: FALLBCK_AGENT_DATA_DIR if set, the system directory when running as root (the packaged case), otherwise ~/.fallbck/agent for unprivileged use.
func DefaultAgentDataDirFor ¶ added in v0.6.0
DefaultAgentDataDirFor is DefaultAgentDataDir for a given agent type
func DetectTimezone ¶ added in v0.7.2
func DetectTimezone() string
DetectTimezone finds the host's IANA timezone name: the TZ environment variable, /etc/timezone (Debian), or the /etc/localtime symlink target; UTC when nothing is determinable (the common case in containers without TZ set).
func EnvLogLevelSet ¶ added in v0.6.2
func EnvLogLevelSet() bool
EnvLogLevelSet reports whether the environment picked a log level (DEBUG or FALLBCK_LOG_LEVEL); when it did, it outranks the config file's log_level.
func LogLevel ¶ added in v0.6.0
LogLevel returns the process log level: FALLBCK_LOG_LEVEL (debug|info|warn|error) or, for quick troubleshooting, DEBUG=true. Defaults to info.
func ParseLogLevel ¶ added in v0.6.2
ParseLogLevel maps a level name (debug, info, warn, error) to a slog level
func SystemAgentDataDirFor ¶ added in v0.6.0
SystemAgentDataDirFor returns the packaged data directory for an agent type: /var/lib/fallbck/<dir> on Unix, %ProgramData%\fallbck\<dir> on Windows
Types ¶
type AgentConfig ¶
type AgentConfig struct {
AgentID string `yaml:"agent_id" json:"agent_id"`
Hostname string `yaml:"hostname" json:"hostname"`
// ServerURL is the FallBCK server (reverse proxy) URL; HTTP API and Temporal gRPC
// are both reached through it
ServerURL string `yaml:"server_url" json:"server_url"`
DataDir string `yaml:"data_dir" json:"data_dir"`
TaskQueue string `yaml:"task_queue" json:"task_queue"`
Namespace string `yaml:"namespace" json:"namespace"`
// AuthToken is the agent bearer token issued at enrollment
AuthToken string `yaml:"auth_token" json:"-"`
TokenExpiresAt time.Time `yaml:"token_expires_at" json:"token_expires_at"`
// ServerCACertPath optionally trusts a private CA for ServerURL
ServerCACertPath string `yaml:"server_ca_cert_path" json:"server_ca_cert_path"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
// VSS (Windows only) backs up from a Volume Shadow Copy of each volume so open
// and locked files are read consistently; default true
VSS *bool `yaml:"vss,omitempty" json:"vss,omitempty"`
// EnrollmentKey triggers self-enrollment on first start
EnrollmentKey string `yaml:"enrollment_key" json:"-"`
// LogLevel sets the agent's base log level (debug, info, warn, error); the DEBUG /
// FALLBCK_LOG_LEVEL environment variables take precedence, and the server can
// raise the level to debug at runtime (per-agent toggle in the web UI)
LogLevel string `yaml:"log_level,omitempty" json:"log_level,omitempty"`
// DBBackup configures database jobs on fallbck-agent (spool, tools, credential profiles)
DBBackup dbbackup.Config `yaml:"db_backup,omitempty" json:"db_backup"`
// DockerBackup configures Docker host jobs on fallbck-agent (socket, volume
// access mode, helper image)
DockerBackup dockerbackup.Config `yaml:"docker_backup,omitempty" json:"docker_backup"`
// MaxConcurrentActivities caps how many server-scheduled activities (backup runs,
// volume uploads, log and inventory requests) the agent runs at once. Default 16:
// room for a kubernetes job's 8 parallel volumes plus a few runs, while a burst
// of work (or a misbehaving server) cannot start hundreds of dumps on one host.
MaxConcurrentActivities int `yaml:"max_concurrent_activities,omitempty" json:"max_concurrent_activities,omitempty"`
}
AgentConfig is the fallbck-agent configuration
func DefaultAgentConfig ¶
func DefaultAgentConfig() *AgentConfig
DefaultAgentConfig returns the defaults for fallbck-agent
func LoadAgentConfig ¶
func LoadAgentConfig(filePath string) (*AgentConfig, error)
LoadAgentConfig loads the YAML file (if any) and applies environment overrides
func ReadAgentConfigFile ¶ added in v0.6.0
func ReadAgentConfigFile(filePath string) (*AgentConfig, error)
ReadAgentConfigFile loads only the YAML file (no defaults, no environment); it reports os.ErrNotExist when the file is missing.
func (*AgentConfig) EffMaxConcurrentActivities ¶ added in v1.0.0
func (c *AgentConfig) EffMaxConcurrentActivities() int
EffMaxConcurrentActivities applies the default
func (*AgentConfig) Save ¶
func (c *AgentConfig) Save(path string) error
Save writes the agent configuration to path with owner-only permissions (it holds the token)
func (*AgentConfig) ServerTLSConfig ¶ added in v0.9.1
func (c *AgentConfig) ServerTLSConfig() (*tls.Config, error)
ServerTLSConfig builds the client TLS configuration for ServerURL: the operator's private CA (ServerCACertPath) and/or InsecureSkipVerify. Used by every connection the agent makes to the server (enrollment, HTTP API, Temporal and tunnel gRPC).
func (*AgentConfig) UseVSS ¶ added in v0.9.5
func (c *AgentConfig) UseVSS() bool
UseVSS reports whether Windows backups read from a Volume Shadow Copy (default true)
type AgentTokensConfig ¶
AgentTokensConfig configures agent bearer tokens
type AuditConfig ¶ added in v1.0.0
type AuditConfig struct {
// Retention is how long entries stay in the database; a daily prune deletes older
// ones. 0 keeps everything. Default 8760h (a year).
Retention time.Duration `yaml:"retention" json:"retention"`
// Export receives every entry right before it is pruned, as JSON lines: an
// absolute file path (appended), http(s)://... (POSTed as application/x-ndjson),
// udp://host:port or tcp://host:port (syslog), or syslog: (the local syslog).
// Empty: pruned entries are gone.
Export string `yaml:"export" json:"export"`
// ExportHeaders are added to HTTP exports, e.g. Authorization for a log collector
ExportHeaders map[string]string `yaml:"export_headers" json:"-"`
}
SecurityConfig holds the server master key that seals stored secrets (PBS API tokens, backup encryption keys) at rest AuditConfig controls how long audit log entries are kept and where they go before they are pruned
type AuthConfig ¶
type AuthConfig struct {
OIDC OIDCConfig `yaml:"oidc" json:"oidc"`
SessionTTL time.Duration `yaml:"session_ttl" json:"session_ttl"`
// InsecureDisable turns admin authentication off. Development only; the server
// refuses it unless started with --dev.
InsecureDisable bool `yaml:"insecure_disable" json:"insecure_disable"`
}
AuthConfig configures administrator authentication
type DatabaseConfig ¶
type DatabaseConfig struct {
URL string `yaml:"url" json:"url"`
MaxOpenConns int `yaml:"max_open_conns" json:"max_open_conns"`
MaxIdleConns int `yaml:"max_idle_conns" json:"max_idle_conns"`
ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" json:"conn_max_lifetime"`
AutoMigrate bool `yaml:"auto_migrate" json:"auto_migrate"`
}
DatabaseConfig configures the application PostgreSQL pool
type EmbeddedTemporalConfig ¶
type EmbeddedTemporalConfig struct {
BindIP string `yaml:"bind_ip" json:"bind_ip"`
// PortBase is the loopback frontend port; the other services use PortBase+1..+6
PortBase int `yaml:"port_base" json:"port_base"`
// DatabaseURL defaults to the application database URL (database name is replaced)
DatabaseURL string `yaml:"database_url" json:"database_url"`
// HistoryShards is immutable after the first start
HistoryShards int32 `yaml:"history_shards" json:"history_shards"`
Retention time.Duration `yaml:"retention" json:"retention"`
// ClusterName is immutable after the first start (default "fallbck"); set it to the
// existing cluster name when adopting databases created by another Temporal deployment
ClusterName string `yaml:"cluster_name" json:"cluster_name"`
}
EmbeddedTemporalConfig configures the in-process Temporal server
type OIDCConfig ¶
type OIDCConfig struct {
Issuer string `yaml:"issuer" json:"issuer"`
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret" json:"-"`
Scopes []string `yaml:"scopes" json:"scopes"`
// AllowedGroups restricts login to identities whose groups claim contains one of these (empty = any)
AllowedGroups []string `yaml:"allowed_groups" json:"allowed_groups"`
// AllowedEmails restricts login to these email addresses (empty = any)
AllowedEmails []string `yaml:"allowed_emails" json:"allowed_emails"`
// GroupsClaim is the ID token claim carrying group membership (default "groups")
GroupsClaim string `yaml:"groups_claim" json:"groups_claim"`
// BindingClaims are further ID token claims (string or list of strings) that
// "claim" role bindings can match, e.g. Entra app roles in "roles". Unset: roles.
// An empty list turns claim bindings off.
BindingClaims []string `yaml:"binding_claims" json:"binding_claims"`
}
OIDCConfig configures admin login through an OpenID Connect provider
func (OIDCConfig) EffectiveBindingClaims ¶ added in v1.0.0
func (c OIDCConfig) EffectiveBindingClaims() []string
EffectiveBindingClaims applies the default (roles) when binding_claims is unset
func (OIDCConfig) Enabled ¶
func (c OIDCConfig) Enabled() bool
Enabled reports whether the OIDC configuration is populated
func (OIDCConfig) Validate ¶
func (c OIDCConfig) Validate() error
Validate checks the configuration is usable
type SecurityConfig ¶ added in v0.13.0
type SecurityConfig struct {
// MasterKeyFile holds 64 hex characters; generated on first start when missing
// (default <data_dir>/master.key). Back it up together with the database: the
// sealed secrets, including backup encryption keys, are unreadable without it.
MasterKeyFile string `yaml:"master_key_file" json:"master_key_file"`
// MasterKey is the key itself (64 hex characters) for container deployments
// (FALLBCK_MASTER_KEY); it takes precedence over the file
MasterKey string `yaml:"master_key,omitempty" json:"-"`
}
type ServerConfig ¶
type ServerConfig struct {
// HTTPPort / HTTPBind: the single plaintext h2c listener behind the reverse proxy
HTTPPort int `yaml:"http_port" json:"http_port"`
HTTPBind string `yaml:"http_bind" json:"http_bind"`
// PublicURL is the reverse proxy's externally reachable URL (OIDC redirect,
// install script, enrollment response)
PublicURL string `yaml:"public_url" json:"public_url"`
// TrustedProxies are the CIDRs of reverse proxies whose X-Forwarded-For entries are
// believed when determining a client's IP (default: loopback and private ranges)
TrustedProxies []string `yaml:"trusted_proxies" json:"trusted_proxies"`
// JWTSecret signs sessions, agent tokens and tickets; empty = generated into
// <data_dir>/jwt.secret on first start
JWTSecret string `yaml:"jwt_secret" json:"jwt_secret"`
DataDir string `yaml:"data_dir" json:"data_dir"`
// AgentCABundlePath optionally points at a PEM bundle agents should trust for the
// public URL (private CAs); it is handed out at enrollment
AgentCABundlePath string `yaml:"agent_ca_bundle_path" json:"agent_ca_bundle_path"`
// Timezone (IANA name) governs cron schedules and next-run display; empty =
// auto-detect from TZ / the host zone, falling back to UTC
Timezone string `yaml:"timezone" json:"timezone"`
Auth AuthConfig `yaml:"auth" json:"auth"`
AgentTokens AgentTokensConfig `yaml:"agent_tokens" json:"agent_tokens"`
Database DatabaseConfig `yaml:"database" json:"database"`
Temporal TemporalServerConfig `yaml:"temporal" json:"temporal"`
Security SecurityConfig `yaml:"security" json:"security"`
Audit AuditConfig `yaml:"audit" json:"audit"`
}
ServerConfig is the fallbck-server configuration
func DefaultServerConfig ¶
func DefaultServerConfig() *ServerConfig
DefaultServerConfig returns the defaults for fallbck-server
func LoadServerConfig ¶
func LoadServerConfig(filePath string) (*ServerConfig, error)
LoadServerConfig loads the YAML file (if any) and applies environment overrides
func (*ServerConfig) EffectiveJWTSecretFile ¶ added in v0.14.12
func (c *ServerConfig) EffectiveJWTSecretFile() string
EffectiveJWTSecretFile is where a generated JWT secret lives
func (*ServerConfig) EffectiveMasterKeyFile ¶ added in v0.13.0
func (c *ServerConfig) EffectiveMasterKeyFile() string
EffectiveMasterKeyFile is the configured path or the default under the data directory
func (*ServerConfig) ProxyURL ¶
func (c *ServerConfig) ProxyURL() string
ProxyURL returns the externally reachable base URL of the PBS proxy gateway. The proxy is served by the main HTTP listener, so it lives under PublicURL.
func (*ServerConfig) PublicURLIsHTTPS ¶
func (c *ServerConfig) PublicURLIsHTTPS() bool
PublicURLIsHTTPS reports whether the public URL is served over TLS (cookie Secure flag)
func (*ServerConfig) ScheduleLocation ¶ added in v0.7.2
func (c *ServerConfig) ScheduleLocation() *time.Location
ScheduleLocation loads the configured timezone (UTC on any problem)
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate(dev bool) error
Validate checks the server configuration for consistency. dev reports whether the server was started with --dev (relaxes the authentication requirement).
type TemporalConfig ¶
type TemporalConfig struct {
HostPort string `yaml:"host_port" json:"host_port"`
Namespace string `yaml:"namespace" json:"namespace"`
EnableTLS bool `yaml:"enable_tls" json:"enable_tls"`
CACertPath string `yaml:"ca_cert_path" json:"ca_cert_path"`
ClientCertPath string `yaml:"client_cert_path" json:"client_cert_path"`
ClientKeyPath string `yaml:"client_key_path" json:"client_key_path"`
ServerName string `yaml:"server_name" json:"server_name"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
}
TemporalConfig is a Temporal *client* configuration (used for an external cluster)
func (*TemporalConfig) BuildTLSConfig ¶
func (tc *TemporalConfig) BuildTLSConfig() (*tls.Config, error)
BuildTLSConfig builds the client TLS configuration for an external Temporal cluster
type TemporalServerConfig ¶
type TemporalServerConfig struct {
Mode string `yaml:"mode" json:"mode"`
Namespace string `yaml:"namespace" json:"namespace"`
Embedded EmbeddedTemporalConfig `yaml:"embedded" json:"embedded"`
External TemporalConfig `yaml:"external" json:"external"`
UI TemporalUIConfig `yaml:"ui" json:"ui"`
}
TemporalServerConfig selects and configures the Temporal cluster the server uses
type TemporalUIConfig ¶
type TemporalUIConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
// Port is the loopback port the UI server listens on
Port int `yaml:"port" json:"port"`
// ReadOnly hides the UI's write actions (terminate, cancel, signal, reset,
// schedule edits). The UI is not label-scoped, so anyone with temporal:ui could
// otherwise stop any team's backups. Default true.
ReadOnly bool `yaml:"read_only" json:"read_only"`
}
TemporalUIConfig configures the embedded Temporal Web UI (served under /temporal/)