Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FactsGenerator ¶
type FactsGenerator func(ctx context.Context, opts RuntimeOptions, log *logrus.Entry) (map[string]any, error)
FactsGenerator gathers facts
type Instance ¶
type Instance interface {
// Run starts running the command line
Run(ctx context.Context) error
// Application allows adding additional commands to the CLI application that will be built
Application() *fisk.Application
// CommonConfigure performs basic setup that a command added using Application() might need
CommonConfigure() (RuntimeOptions, *logrus.Entry, error)
}
Instance is an instance of the Choria Machine Room Agent
type Options ¶
type Options struct {
// Name is the name reported in --help and other output from the command line
Name string `json:"name"`
// Contact will be shown during --help
Contact string `json:"contact"`
// Help will be shown during --help as the main command help
Help string `json:"help"`
// Version will be reported in --version and elsewhere
Version string `json:"version"`
// MachineSigningKey hex encoded ed25519 key used to sign autonomous agents
MachineSigningKey string `json:"machine_signing_key"`
// FactsRefreshInterval sets an interval to refresh facts on, 10 minutes by default and cannot be less than 1 minute
FactsRefreshInterval time.Duration `json:"facts_refresh_interval"`
// ConfigBucketPrefix will replicate only a subset of keys from the backend to the site
ConfigBucketPrefix string `json:"config_bucket_prefix"`
// Plugins are additional plugins like autonomous agents to add to the build
Plugins map[string]plugin.Pluggable `json:"-"`
// AdditionalFacts will be called during fact generation and the result will be shallow merged with the standard facts
AdditionalFacts FactsGenerator `json:"-"`
// ReadyFunc is an optional function that will be called once provisioning completes and system is fully initialized
ReadyFunc ReadyFunc `json:"-"`
// Args are parsed instead of os.Args if Args is not nil
Args []string `json:"-"`
// facts related opt-outs
// NoStandardFacts disables gathering all standard facts
NoStandardFacts bool `json:"no_standard_facts,omitempty"`
// NoMemoryFacts disables built-in memory fact gathering
NoMemoryFacts bool `json:"no_memory_facts,omitempty"`
// NoSwapFacts disables built-in swap facts gathering
NoSwapFacts bool `json:"no_swap_facts,omitempty"`
// NoCPUFacts disables built-in cpu facts gathering
NoCPUFacts bool `json:"no_cpu_facts,omitempty"`
// NoDiskFacts disables built-in disk facts gathering
NoDiskFacts bool `json:"no_disk_facts,omitempty"`
// NoHostFacts disables built-in host facts gathering
NoHostFacts bool `json:"no_host_facts,omitempty"`
// NoNetworkFacts disables built-in network interface facts gathering
NoNetworkFacts bool `json:"no_network_facts,omitempty"`
// ConfigurationDirectory is the directory the configuration file is stored in (RO)
ConfigurationDirectory string `json:"configuration_directory"`
// MachinesDirectory is where autonomous agents are stored (RO)
MachinesDirectory string `json:"machines_directory"`
// ProvisioningJWTFile is the path to provisioning jwt file, defaults to provisioning.jwt in the options dir (RO)
ProvisioningJWTFile string `json:"provisioning_jwt_file"`
// FactsFile is the path to the facts file which default to instance.json in the options dir (RO)
FactsFile string `json:"facts_file"`
// ServerSeedFile is the path to the server seed file that will exist after provisioning (RO)
ServerSeedFile string `json:"server_seed_file"`
// ServerJWTFile is the path to the server jwt file that will exist after provisioning (RO)
ServerJWTFile string `json:"server_jwt_file"`
// ServerStatusFile is where the server will regularly write its status (RO)
ServerStatusFile string `json:"server_status_file"`
// ServerSubmissionDirectory is the directory holding the submission spool (RO)
ServerSubmissionDirectory string `json:"server_submission_directory"`
// ServerSubmissionSpoolSize is the maximum size of the submission spool (RO)
ServerSubmissionSpoolSize int `json:"server_submission_spool_size"`
// CommandPath is the path to the command being run, defaults to argv[0] (RO)
CommandPath string `json:"command_path"`
// ServerStorageDirectory the directory where state is stored (RO)
ServerStorageDirectory string `json:"server_storage_directory"`
// NatsNeySeedFile is a path to a nkey seed created at start
NatsNeySeedFile string `json:"nats_ney_seed_file"`
// NatsCredentialsFile is a path to the nats credentials file holding data received during provisioning
NatsCredentialsFile string `json:"nats_credentials_file"`
// StartTime the time the process started (RO)
StartTime time.Time `json:"start_time"`
}
Options holds configuration and runtime derived paths, members marked RO are set during CommonConfigure(), setting them has no effect
type ReadyFunc ¶
type ReadyFunc func(ctx context.Context, opts RuntimeOptions, log *logrus.Entry)
ReadyFunc is a custom function that will be called after provisioning and initialization
type RuntimeOptions ¶
type RuntimeOptions interface {
// Name is the configured application name
Name() string
// Version is the running version
Version() string
// CommandPath is the full path to the command being executed
CommandPath() string
// MachineSigningKey is the ed25519 public key used to sign autonomous agents and other items
MachineSigningKey() string
// FactsRefreshInterval is the frequency facts will be refreshed on disk
FactsRefreshInterval() time.Duration
// NoStandardFacts indicates if all built-in facts are disabled
NoStandardFacts() bool
// NoMemoryFacts indicates if built-in memory facts will be gathered
NoMemoryFacts() bool
// NoSwapFacts indicates if built-in swap facts will be gathered
NoSwapFacts() bool
// NoCPUFacts indicates if built-in cpu facts will be gathered
NoCPUFacts() bool
// NoDiskFacts indicates if built-in disk facts will be gathered
NoDiskFacts() bool
// NoHostFacts indicates if built-in host facts will be gathered
NoHostFacts() bool
// NoNetworkFacts indicates if built-in network facts will be gathered
NoNetworkFacts() bool
// ConfigurationDirectory is the path where configuration and other runtime files will be stored
ConfigurationDirectory() string
// MachinesDirectory is the directory where autonomous agents will be stored
MachinesDirectory() string
// ProvisioningJWTFile is the file issued by the SaaS provider used during provisioning
ProvisioningJWTFile() string
// FactsFile is a file holding instance data
FactsFile() string
// SeedFile is a ed25519 seed issued by the Choria Organization Issuer during provisioning
SeedFile() string
// JWTFile is the JWT file issued during provisioning
JWTFile() string
// StatusFile is a regularly updated file holding internal status of the Choria Backplane Server
StatusFile() string
// SubmissionDirectory is a spool directory that will hold messages submitted via Choria Submit
SubmissionDirectory() string
// SubmissionSpoolSize is the maximum size of the spool
SubmissionSpoolSize() int
// StorageDirectory is where JetStream and other state is kept
StorageDirectory() string
// NatsNeySeedFile is a NKey created during provisioning that could optionally be used to authenticate to the SaaS
NatsNeySeedFile() string
// NatsCredentialsFile is a NATS credential that, if provisioning signed a nats JWT, will hold a valid cred for accessing the SaaS backend
NatsCredentialsFile() string
// StartTime is the time this instance was started
StartTime() time.Time
// ConfigBucketPrefix will replicate only a subset of keys from the backend to the site
ConfigBucketPrefix() string
}
RuntimeOptions provides read only access to run-time state and configuration
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
