Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct {
Bind string `toml:"bind" json:"bind"`
Port int `toml:"port" json:"port"`
UseTLS bool `toml:"use_tls" json:"use-tls"`
TLSConfig TLSConfig `toml:"tls" json:"tls"`
CORSOrigins []string `toml:"cors_origins" json:"cors-origins"`
WebUI WebUI `toml:"webui" json:"webui"`
}
APIServer holds configuration for the API server worker
func (*APIServer) BindAddress ¶
BindAddress returns a host:port string.
type Config ¶
type Config struct {
Default Default `toml:"default" json:"default"`
APIServer APIServer `toml:"apiserver,omitempty" json:"apiserver,omitempty"`
Metrics Metrics `toml:"metrics,omitempty" json:"metrics,omitempty"`
Database Database `toml:"database,omitempty" json:"database,omitempty"`
Providers []Provider `toml:"provider,omitempty" json:"provider,omitempty"`
JWTAuth JWTAuth `toml:"jwt_auth" json:"jwt-auth"`
Logging Logging `toml:"logging" json:"logging"`
Proxy Proxy `toml:"proxy" json:"proxy"`
}
func (*Config) GetLoggingConfig ¶ added in v0.1.4
type ConnPurpose ¶ added in v0.2.2
type ConnPurpose string
ConnPurpose selects which connection profile a DSN is built for. Schema migrations get their own profile. An AutoMigrate over a large table can legitimately run far longer than any runtime query, so the runtime statement and lock timeouts must not apply to it.
const ( // ConnPurposeRuntime is the profile for normal query traffic. Query // timeouts apply. ConnPurposeRuntime ConnPurpose = "runtime" // ConnPurposeMigration is the profile for schema migrations. Query // timeouts are disabled. ConnPurposeMigration ConnPurpose = "migration" )
type DBBackendType ¶
type DBBackendType string
const ( // SQLiteBackend represents the SQLite3 DB backend SQLiteBackend DBBackendType = "sqlite3" // PostgreSQLBackend represents the PostgreSQL DB backend PostgreSQLBackend DBBackendType = "postgresql" // EnvironmentVariablePrefix is the prefix for all environment variables // that can not be used to get overwritten via the external provider EnvironmentVariablePrefix = "GARM" )
type Database ¶
type Database struct {
Debug bool `toml:"debug" json:"debug"`
DbBackend DBBackendType `toml:"backend" json:"backend"`
SQLite SQLite `toml:"sqlite3" json:"sqlite3"`
PostgreSQL PostgreSQL `toml:"postgresql" json:"postgresql"`
// Passphrase is used to encrypt any sensitive info before
// inserting it into the database. This is just temporary until
// we move to something like vault or barbican for secrets storage.
// Don't lose or change this. It will invalidate all encrypted data
// in the DB. This field must be set and must be exactly 32 characters.
Passphrase string `toml:"passphrase"`
}
Database is the database config entry
func (*Database) GormParams ¶
func (d *Database) GormParams(purpose ConnPurpose) (dbType DBBackendType, uri string, err error)
GormParams returns the database type and connection URI for the given connection purpose.
func (*Database) SQLiteBlobDatabaseConfig ¶ added in v0.2.0
type Default ¶
type Default struct {
// CallbackURL is the URL where the instances can send back status reports.
CallbackURL string `toml:"callback_url" json:"callback-url"`
// MetadataURL is the URL where instances can fetch information they may need
// to set themselves up.
MetadataURL string `toml:"metadata_url" json:"metadata-url"`
// WebhookURL is the URL that will be installed as a webhook target in github.
WebhookURL string `toml:"webhook_url" json:"webhook-url"`
// EnableWebhookManagement enables the webhook management API.
EnableWebhookManagement bool `toml:"enable_webhook_management" json:"enable-webhook-management"`
// LogFile is the location of the log file.
LogFile string `toml:"log_file,omitempty" json:"log-file"`
EnableLogStreamer *bool `toml:"enable_log_streamer,omitempty" json:"enable-log-streamer,omitempty"`
DebugServer bool `toml:"debug_server" json:"debug-server"`
}
type External ¶
type External struct {
// InterfaceVersion is the version of the interface that the external
// provider implements. This is used to ensure compatibility between
// the external provider and garm.
InterfaceVersion string `toml:"interface_version" json:"interface-version"`
// ConfigFile is the path on disk to a file which will be passed to
// the external binary as an environment variable: GARM_PROVIDER_CONFIG
// You can use this file for any configuration you need to do for the
// cloud your calling into, to create the compute resources.
ConfigFile string `toml:"config_file" json:"config-file"`
// ProviderDir is the path on disk to a folder containing an executable
// called "garm-external-provider".
ProviderDir string `toml:"provider_dir" json:"provider-dir"`
// ProviderExecutable is the full path to the executable that implements
// the provider. If specified, it will take precedence over the "garm-external-provider"
// executable in the ProviderDir.
ProviderExecutable string `toml:"provider_executable" json:"provider-executable"`
// EnvironmentVariables is a list of environment variable names that will be
// passed to the external binary together with their values.
EnvironmentVariables []string `toml:"environment_variables" json:"environment-variables"`
// ExecTimeoutSeconds is the maximum number of seconds a single invocation
// of the provider binary may run. When exceeded, the binary is killed and
// the operation fails; for instance creation this marks the instance as
// error and normal cleanup takes over. This bounds how long an instance
// can sit in the creating/deleting states if a provider binary hangs.
// A value of 0 (the default) disables the timeout.
ExecTimeoutSeconds uint `toml:"exec_timeout_seconds" json:"exec-timeout-seconds"`
}
External represents the config for an external provider. The external provider is a provider that delegates all operations to an external binary. This way, you can write your own logic in whatever programming language you wish, while still remaining compatible with garm.
func (*External) ExecTimeout ¶ added in v0.2.2
ExecTimeout returns the configured provider binary execution timeout as a time.Duration. A zero duration means no timeout is enforced.
func (*External) ExecutablePath ¶
func (*External) GetEnvironmentVariables ¶ added in v0.1.4
type JWTAuth ¶
type JWTAuth struct {
Secret string `toml:"secret" json:"secret"`
TimeToLive timeToLive `toml:"time_to_live" json:"time-to-live"`
}
JWTAuth holds settings used to generate JWT tokens
type Logging ¶ added in v0.1.4
type Logging struct {
// LogFile is the location of the log file.
LogFile string `toml:"log_file,omitempty" json:"log-file"`
// EnableLogStreamer enables the log streamer over websockets.
EnableLogStreamer *bool `toml:"enable_log_streamer,omitempty" json:"enable-log-streamer,omitempty"`
// LogLevel is the log level.
LogLevel LogLevel `toml:"log_level" json:"log-format"`
// LogFormat is the log format.
LogFormat LogFormat `toml:"log_format" json:"log-level"`
// LogSource enables the log source.
LogSource bool `toml:"log_source" json:"log-source"`
}
type Metrics ¶
type Metrics struct {
// DisableAuth defines if the API endpoint will be protected by
// JWT authentication
DisableAuth bool `toml:"disable_auth" json:"disable-auth"`
// Enable define if the API endpoint for metrics collection will
// be enabled
Enable bool `toml:"enable" json:"enable"`
// Period defines the internal period at which internal metrics are getting updated
// and propagated to the /metrics endpoint
Period time.Duration `toml:"period" json:"period"`
}
type PostgreSQL ¶ added in v0.2.2
type PostgreSQL struct {
Username string `toml:"username" json:"username"`
Password string `toml:"password" json:"password"`
Hostname string `toml:"hostname" json:"hostname"`
Port int `toml:"port" json:"port"`
Database string `toml:"database" json:"database"`
SSLMode string `toml:"sslmode" json:"sslmode"`
// Connection pool settings. Zero values use production-friendly defaults.
// MaxOpenConns is the maximum number of open connections to the database.
// Defaults to 25.
MaxOpenConns int `toml:"max_open_conns" json:"max_open_conns"`
// MaxIdleConns is the maximum number of idle connections in the pool.
// Defaults to 5.
MaxIdleConns int `toml:"max_idle_conns" json:"max_idle_conns"`
// ConnMaxLifetimeMins is the maximum lifetime of a connection in minutes.
// Defaults to 30.
ConnMaxLifetimeMins int `toml:"conn_max_lifetime_mins" json:"conn_max_lifetime_mins"`
// ConnMaxIdleTimeSecs is the maximum time a connection may be idle before
// being closed, in seconds. Defaults to 300 (5 minutes).
ConnMaxIdleTimeSecs int `toml:"conn_max_idle_time_secs" json:"conn_max_idle_time_secs"`
// Query timeouts. These bound how long a single query may run or wait,
// server side. They are the backstop for a query whose caller passed a
// context with no deadline. Zero uses the default, -1 disables.
//
// ConnectTimeoutSecs bounds the TCP connect and startup handshake.
// Defaults to 10.
ConnectTimeoutSecs int `toml:"connect_timeout_secs" json:"connect_timeout_secs"`
// StatementTimeoutSecs aborts any statement that runs longer than this.
// Defaults to 60. Schema migrations run on their own connection and are
// never subject to it.
StatementTimeoutSecs int `toml:"statement_timeout_secs" json:"statement_timeout_secs"`
// LockTimeoutSecs bounds how long a statement waits for a row lock before
// giving up. The read-modify-write transactions in the sql package take
// SELECT ... FOR UPDATE, which waits forever by default. Defaults to 30.
LockTimeoutSecs int `toml:"lock_timeout_secs" json:"lock_timeout_secs"`
}
PostgreSQL is the config entry for the postgresql section
func (*PostgreSQL) ConnectionString ¶ added in v0.2.2
func (p *PostgreSQL) ConnectionString(purpose ConnPurpose) (string, error)
ConnectionString returns a pgx-compatible DSN in libpq key=value format for the given connection purpose.
statement_timeout and lock_timeout are not recognised by pgx itself. It forwards unknown keys as session run-time parameters, so Postgres applies them as the session default for every connection opened from this DSN. They are the backstop for a query whose caller passed a context with no deadline. Without them such a query waits forever, and the goroutine that issued it is parked for as long as the server stays silent.
func (*PostgreSQL) Validate ¶ added in v0.2.2
func (p *PostgreSQL) Validate() error
Validate validates a PostgreSQL config entry and applies defaults for optional fields.
type Provider ¶
type Provider struct {
Name string `toml:"name" json:"name"`
ProviderType params.ProviderType `toml:"provider_type" json:"provider-type"`
Description string `toml:"description" json:"description"`
// DisableJITConfig explicitly disables JIT configuration and forces runner registration
// tokens to be used. This may happen if a provider has not yet been updated to support
// JIT configuration.
DisableJITConfig bool `toml:"disable_jit_config" json:"disable-jit-config"`
External External `toml:"external" json:"external"`
}
Provider holds access information for a particular provider. A provider offers compute resources on which we spin up self hosted runners.
type Proxy ¶ added in v0.2.2
type SQLite ¶
type SQLite struct {
DBFile string `toml:"db_file" json:"db-file"`
BusyTimeoutSeconds int `toml:"busy_timeout_seconds" json:"busy-timeout-seconds"`
}
SQLite is the config entry for the sqlite3 section
func (*SQLite) BlobDBFile ¶ added in v0.2.0
func (*SQLite) ConnectionString ¶
type TLSConfig ¶
type TLSConfig struct {
CRT string `toml:"certificate" json:"certificate"`
Key string `toml:"key" json:"key"`
}
TLSConfig is the API server TLS config
type WebUI ¶ added in v0.2.0
type WebUI struct {
EnableWebUI bool `toml:"enable" json:"enable"`
}
WebUI holds configuration for the web UI
func (*WebUI) GetWebappPath ¶ added in v0.2.0
GetWebappPath returns the webapp path with proper formatting