Manager: remove unsupported settings & rename existing one

Comment out all unused-but-desired-in-the-future settings, remove some
settings that will never be used, and rename `ssdp_discovery` to
`autodiscoverable`.
This commit is contained in:
Sybren A. Stüvel 2022-03-17 11:25:40 +01:00
parent 882c5ee478
commit 3c01c18634
2 changed files with 78 additions and 86 deletions

View File

@ -2,57 +2,46 @@ package config
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import (
"time"
"git.blender.org/flamenco/pkg/api"
)
// The default configuration, use DefaultConfig() to obtain a copy. // The default configuration, use DefaultConfig() to obtain a copy.
var defaultConfig = Conf{ var defaultConfig = Conf{
Base: Base{ Base: Base{
Meta: ConfMeta{Version: latestConfigVersion}, Meta: ConfMeta{Version: latestConfigVersion},
ManagerName: "Flamenco Manager", ManagerName: "Flamenco Manager",
Listen: ":8080", Listen: ":8080",
ListenHTTPS: ":8433", // ListenHTTPS: ":8433",
DatabaseDSN: "flamenco-manager.sqlite", DatabaseDSN: "flamenco-manager.sqlite",
TaskLogsPath: "./task-logs", TaskLogsPath: "./task-logs",
// DownloadTaskSleep: 10 * time.Minute, SSDPDiscovery: true,
// DownloadTaskRecheckThrottle: 10 * time.Second,
// TaskUpdatePushMaxInterval: 5 * time.Second, // ActiveTaskTimeoutInterval: 10 * time.Minute,
// TaskUpdatePushMaxCount: 3000, // ActiveWorkerTimeoutInterval: 1 * time.Minute,
// CancelTaskFetchInterval: 10 * time.Second,
ActiveTaskTimeoutInterval: 10 * time.Minute,
ActiveWorkerTimeoutInterval: 1 * time.Minute,
// FlamencoStr: defaultServerURL,
// // Days are assumed to be 24 hours long. This is not exactly accurate, but should // // Days are assumed to be 24 hours long. This is not exactly accurate, but should
// // be accurate enough for this type of cleanup. // // be accurate enough for this type of cleanup.
// TaskCleanupMaxAge: 14 * 24 * time.Hour, // TaskCleanupMaxAge: 14 * 24 * time.Hour,
SSDPDiscovery: false, // Only enable after SSDP discovery has been improved (avoid finding printers).
BlacklistThreshold: 3, // BlacklistThreshold: 3,
TaskFailAfterSoftFailCount: 3, // TaskFailAfterSoftFailCount: 3,
WorkerCleanupStatus: []string{string(api.WorkerStatusOffline)}, // WorkerCleanupStatus: []string{string(api.WorkerStatusOffline)},
TestTasks: TestTasks{ // TestTasks: TestTasks{
BlenderRender: BlenderRenderConfig{ // BlenderRender: BlenderRenderConfig{
JobStorage: "{job_storage}/test-jobs", // JobStorage: "{job_storage}/test-jobs",
RenderOutput: "{render}/test-renders", // RenderOutput: "{render}/test-renders",
}, // },
}, // },
Shaman: ShamanConfig{ // Shaman: ShamanConfig{
Enabled: true, // Enabled: true,
FileStorePath: defaultShamanFilestorePath, // FileStorePath: defaultShamanFilestorePath,
GarbageCollect: ShamanGarbageCollect{ // GarbageCollect: ShamanGarbageCollect{
Period: 24 * time.Hour, // Period: 24 * time.Hour,
MaxAge: 31 * 24 * time.Hour, // MaxAge: 31 * 24 * time.Hour,
ExtraCheckoutDirs: []string{}, // ExtraCheckoutDirs: []string{},
}, // },
}, // },
// JWT: jwtauth.Config{ // JWT: jwtauth.Config{
// DownloadKeysInterval: 1 * time.Hour, // DownloadKeysInterval: 1 * time.Hour,
@ -78,21 +67,21 @@ var defaultConfig = Conf{
}, },
}, },
// TODO: determine useful defaults for these. // TODO: determine useful defaults for these.
"job_storage": { // "job_storage": {
Direction: "twoway", // Direction: "twoway",
Values: VariableValues{ // Values: VariableValues{
VariableValue{Platform: "linux", Value: "/shared/flamenco/jobs"}, // VariableValue{Platform: "linux", Value: "/shared/flamenco/jobs"},
VariableValue{Platform: "windows", Value: "S:/flamenco/jobs"}, // VariableValue{Platform: "windows", Value: "S:/flamenco/jobs"},
VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/jobs"}, // VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/jobs"},
}, // },
}, // },
"render": { // "render": {
Direction: "twoway", // Direction: "twoway",
Values: VariableValues{ // Values: VariableValues{
VariableValue{Platform: "linux", Value: "/shared/flamenco/render"}, // VariableValue{Platform: "linux", Value: "/shared/flamenco/render"},
VariableValue{Platform: "windows", Value: "S:/flamenco/render"}, // VariableValue{Platform: "windows", Value: "S:/flamenco/render"},
VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/render"}, // VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/render"},
}, // },
}, // },
}, },
} }

View File

@ -62,45 +62,46 @@ type ConfMeta struct {
} }
// Base contains those settings that are shared by all configuration versions. // Base contains those settings that are shared by all configuration versions.
// Various settings are commented out, because they were brought in from
// Flamenco 2 but not implemented yet.
type Base struct { type Base struct {
Meta ConfMeta `yaml:"_meta"` Meta ConfMeta `yaml:"_meta"`
ManagerName string `yaml:"manager_name"` ManagerName string `yaml:"manager_name"`
DatabaseDSN string `yaml:"database_url"` DatabaseDSN string `yaml:"database"`
TaskLogsPath string `yaml:"task_logs_path"` TaskLogsPath string `yaml:"task_logs_path"`
Listen string `yaml:"listen"` Listen string `yaml:"listen"`
ListenHTTPS string `yaml:"listen_https"` // ListenHTTPS string `yaml:"listen_https"`
OwnURL string `yaml:"own_url"` // sent to workers via SSDP/UPnP
// TLS certificate management. TLSxxx has priority over ACME. // TLS certificate management. TLSxxx has priority over ACME.
TLSKey string `yaml:"tlskey"` // TLSKey string `yaml:"tlskey"`
TLSCert string `yaml:"tlscert"` // TLSCert string `yaml:"tlscert"`
ACMEDomainName string `yaml:"acme_domain_name"` // for the ACME Let's Encrypt client // ACMEDomainName string `yaml:"acme_domain_name"` // for the ACME Let's Encrypt client
ActiveTaskTimeoutInterval time.Duration `yaml:"active_task_timeout_interval"` // ActiveTaskTimeoutInterval time.Duration `yaml:"active_task_timeout_interval"`
ActiveWorkerTimeoutInterval time.Duration `yaml:"active_worker_timeout_interval"` // ActiveWorkerTimeoutInterval time.Duration `yaml:"active_worker_timeout_interval"`
WorkerCleanupMaxAge time.Duration `yaml:"worker_cleanup_max_age"` // WorkerCleanupMaxAge time.Duration `yaml:"worker_cleanup_max_age"`
WorkerCleanupStatus []string `yaml:"worker_cleanup_status"` // WorkerCleanupStatus []string `yaml:"worker_cleanup_status"`
/* This many failures (on a given job+task type combination) will ban a worker /* This many failures (on a given job+task type combination) will ban a worker
* from that task type on that job. */ * from that task type on that job. */
BlacklistThreshold int `yaml:"blacklist_threshold"` // BlacklistThreshold int `yaml:"blacklist_threshold"`
// When this many workers have tried the task and failed, it will be hard-failed // When this many workers have tried the task and failed, it will be hard-failed
// (even when there are workers left that could technically retry the task). // (even when there are workers left that could technically retry the task).
TaskFailAfterSoftFailCount int `yaml:"task_fail_after_softfail_count"` // TaskFailAfterSoftFailCount int `yaml:"task_fail_after_softfail_count"`
SSDPDiscovery bool `yaml:"ssdp_discovery"` SSDPDiscovery bool `yaml:"autodiscoverable"`
TestTasks TestTasks `yaml:"test_tasks"` // TestTasks TestTasks `yaml:"test_tasks"`
// Shaman configuration settings. // Shaman configuration settings.
Shaman ShamanConfig `yaml:"shaman"` // Shaman ShamanConfig `yaml:"shaman"`
// Authentication settings. // Authentication settings.
// JWT jwtauth.Config `yaml:"user_authentication"` // JWT jwtauth.Config `yaml:"user_authentication"`
WorkerRegistrationSecret string `yaml:"worker_registration_secret"` // WorkerRegistrationSecret string `yaml:"worker_registration_secret"`
// Dynamic worker pools (Azure Batch, Google Compute, AWS, that sort). // Dynamic worker pools (Azure Batch, Google Compute, AWS, that sort).
// DynamicPoolPlatforms *dppoller.Config `yaml:"dynamic_pool_platforms,omitempty"` // DynamicPoolPlatforms *dppoller.Config `yaml:"dynamic_pool_platforms,omitempty"`
@ -453,32 +454,34 @@ func (c *Conf) Write(filename string) error {
// HasCustomTLS returns true if both the TLS certificate and key files are configured. // HasCustomTLS returns true if both the TLS certificate and key files are configured.
func (c *Conf) HasCustomTLS() bool { func (c *Conf) HasCustomTLS() bool {
return c.TLSCert != "" && c.TLSKey != "" // return c.TLSCert != "" && c.TLSKey != ""
return false
} }
// HasTLS returns true if either a custom certificate or ACME/Let's Encrypt is used. // HasTLS returns true if either a custom certificate or ACME/Let's Encrypt is used.
func (c *Conf) HasTLS() bool { func (c *Conf) HasTLS() bool {
return c.ACMEDomainName != "" || c.HasCustomTLS() // return c.ACMEDomainName != "" || c.HasCustomTLS()
return false
} }
func (c *Conf) checkTLS() { func (c *Conf) checkTLS() {
hasTLS := c.HasCustomTLS() // hasTLS := c.HasCustomTLS()
if hasTLS && c.ListenHTTPS == "" { // if hasTLS && c.ListenHTTPS == "" {
c.ListenHTTPS = c.Listen // c.ListenHTTPS = c.Listen
c.Listen = "" // c.Listen = ""
} // }
if !hasTLS || c.ACMEDomainName == "" { // if !hasTLS || c.ACMEDomainName == "" {
return // return
} // }
log.Warn(). // log.Warn().
Str("tlscert", c.TLSCert). // Str("tlscert", c.TLSCert).
Str("tlskey", c.TLSKey). // Str("tlskey", c.TLSKey).
Str("acme_domain_name", c.ACMEDomainName). // Str("acme_domain_name", c.ACMEDomainName).
Msg("ACME/Let's Encrypt will not be used because custom certificate is specified") // Msg("ACME/Let's Encrypt will not be used because custom certificate is specified")
c.ACMEDomainName = "" // c.ACMEDomainName = ""
} }
func (c *Conf) parseURLs() { func (c *Conf) parseURLs() {