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 AuthConfig
- type DatabaseConfig
- type EmbeddedTemporalConfig
- type OIDCConfig
- type ServerConfig
- 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 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 packaged fallbck-db-agent state directory
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
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"`
// 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 fallbck-db-agent (spool, tools, credential profiles)
DBBackup dbbackup.Config `yaml:"db_backup,omitempty" json:"db_backup"`
}
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) 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).
type AgentTokensConfig ¶
AgentTokensConfig configures agent bearer tokens
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"`
}
OIDCConfig configures admin login through an OpenID Connect provider
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 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"`
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"`
}
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) 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"`
ConnectTimeout time.Duration `yaml:"connect_timeout" json:"connect_timeout"`
}
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"`
}
TemporalUIConfig configures the embedded Temporal Web UI (served under /temporal/)