From 3c01c1863459bf0dbba96e1a74b81ddda23f8f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 17 Mar 2022 11:25:40 +0100 Subject: [PATCH] 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`. --- internal/manager/config/defaults.go | 97 +++++++++++++---------------- internal/manager/config/settings.go | 67 ++++++++++---------- 2 files changed, 78 insertions(+), 86 deletions(-) diff --git a/internal/manager/config/defaults.go b/internal/manager/config/defaults.go index f168d2ba..9e7ebcdc 100644 --- a/internal/manager/config/defaults.go +++ b/internal/manager/config/defaults.go @@ -2,57 +2,46 @@ package config // 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. var defaultConfig = Conf{ Base: Base{ Meta: ConfMeta{Version: latestConfigVersion}, - ManagerName: "Flamenco Manager", - Listen: ":8080", - ListenHTTPS: ":8433", - DatabaseDSN: "flamenco-manager.sqlite", - TaskLogsPath: "./task-logs", - // DownloadTaskSleep: 10 * time.Minute, - // DownloadTaskRecheckThrottle: 10 * time.Second, - // TaskUpdatePushMaxInterval: 5 * time.Second, - // TaskUpdatePushMaxCount: 3000, - // CancelTaskFetchInterval: 10 * time.Second, - ActiveTaskTimeoutInterval: 10 * time.Minute, - ActiveWorkerTimeoutInterval: 1 * time.Minute, - // FlamencoStr: defaultServerURL, + ManagerName: "Flamenco Manager", + Listen: ":8080", + // ListenHTTPS: ":8433", + DatabaseDSN: "flamenco-manager.sqlite", + TaskLogsPath: "./task-logs", + SSDPDiscovery: true, + + // ActiveTaskTimeoutInterval: 10 * time.Minute, + // ActiveWorkerTimeoutInterval: 1 * time.Minute, // // Days are assumed to be 24 hours long. This is not exactly accurate, but should // // be accurate enough for this type of cleanup. // TaskCleanupMaxAge: 14 * 24 * time.Hour, - SSDPDiscovery: false, // Only enable after SSDP discovery has been improved (avoid finding printers). - BlacklistThreshold: 3, - TaskFailAfterSoftFailCount: 3, + // BlacklistThreshold: 3, + // TaskFailAfterSoftFailCount: 3, - WorkerCleanupStatus: []string{string(api.WorkerStatusOffline)}, + // WorkerCleanupStatus: []string{string(api.WorkerStatusOffline)}, - TestTasks: TestTasks{ - BlenderRender: BlenderRenderConfig{ - JobStorage: "{job_storage}/test-jobs", - RenderOutput: "{render}/test-renders", - }, - }, + // TestTasks: TestTasks{ + // BlenderRender: BlenderRenderConfig{ + // JobStorage: "{job_storage}/test-jobs", + // RenderOutput: "{render}/test-renders", + // }, + // }, - Shaman: ShamanConfig{ - Enabled: true, - FileStorePath: defaultShamanFilestorePath, - GarbageCollect: ShamanGarbageCollect{ - Period: 24 * time.Hour, - MaxAge: 31 * 24 * time.Hour, - ExtraCheckoutDirs: []string{}, - }, - }, + // Shaman: ShamanConfig{ + // Enabled: true, + // FileStorePath: defaultShamanFilestorePath, + // GarbageCollect: ShamanGarbageCollect{ + // Period: 24 * time.Hour, + // MaxAge: 31 * 24 * time.Hour, + // ExtraCheckoutDirs: []string{}, + // }, + // }, // JWT: jwtauth.Config{ // DownloadKeysInterval: 1 * time.Hour, @@ -78,21 +67,21 @@ var defaultConfig = Conf{ }, }, // TODO: determine useful defaults for these. - "job_storage": { - Direction: "twoway", - Values: VariableValues{ - VariableValue{Platform: "linux", Value: "/shared/flamenco/jobs"}, - VariableValue{Platform: "windows", Value: "S:/flamenco/jobs"}, - VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/jobs"}, - }, - }, - "render": { - Direction: "twoway", - Values: VariableValues{ - VariableValue{Platform: "linux", Value: "/shared/flamenco/render"}, - VariableValue{Platform: "windows", Value: "S:/flamenco/render"}, - VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/render"}, - }, - }, + // "job_storage": { + // Direction: "twoway", + // Values: VariableValues{ + // VariableValue{Platform: "linux", Value: "/shared/flamenco/jobs"}, + // VariableValue{Platform: "windows", Value: "S:/flamenco/jobs"}, + // VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/jobs"}, + // }, + // }, + // "render": { + // Direction: "twoway", + // Values: VariableValues{ + // VariableValue{Platform: "linux", Value: "/shared/flamenco/render"}, + // VariableValue{Platform: "windows", Value: "S:/flamenco/render"}, + // VariableValue{Platform: "darwin", Value: "/Volumes/Shared/flamenco/render"}, + // }, + // }, }, } diff --git a/internal/manager/config/settings.go b/internal/manager/config/settings.go index 7da116ac..4cb93b38 100644 --- a/internal/manager/config/settings.go +++ b/internal/manager/config/settings.go @@ -62,45 +62,46 @@ type ConfMeta struct { } // 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 { Meta ConfMeta `yaml:"_meta"` ManagerName string `yaml:"manager_name"` - DatabaseDSN string `yaml:"database_url"` + DatabaseDSN string `yaml:"database"` TaskLogsPath string `yaml:"task_logs_path"` Listen string `yaml:"listen"` - ListenHTTPS string `yaml:"listen_https"` - OwnURL string `yaml:"own_url"` // sent to workers via SSDP/UPnP + // ListenHTTPS string `yaml:"listen_https"` // TLS certificate management. TLSxxx has priority over ACME. - TLSKey string `yaml:"tlskey"` - TLSCert string `yaml:"tlscert"` - ACMEDomainName string `yaml:"acme_domain_name"` // for the ACME Let's Encrypt client + // TLSKey string `yaml:"tlskey"` + // TLSCert string `yaml:"tlscert"` + // ACMEDomainName string `yaml:"acme_domain_name"` // for the ACME Let's Encrypt client - ActiveTaskTimeoutInterval time.Duration `yaml:"active_task_timeout_interval"` - ActiveWorkerTimeoutInterval time.Duration `yaml:"active_worker_timeout_interval"` + // ActiveTaskTimeoutInterval time.Duration `yaml:"active_task_timeout_interval"` + // ActiveWorkerTimeoutInterval time.Duration `yaml:"active_worker_timeout_interval"` - WorkerCleanupMaxAge time.Duration `yaml:"worker_cleanup_max_age"` - WorkerCleanupStatus []string `yaml:"worker_cleanup_status"` + // WorkerCleanupMaxAge time.Duration `yaml:"worker_cleanup_max_age"` + // WorkerCleanupStatus []string `yaml:"worker_cleanup_status"` /* This many failures (on a given job+task type combination) will ban a worker * 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 // (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 ShamanConfig `yaml:"shaman"` + // Shaman ShamanConfig `yaml:"shaman"` // Authentication settings. // 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). // 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. 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. func (c *Conf) HasTLS() bool { - return c.ACMEDomainName != "" || c.HasCustomTLS() + // return c.ACMEDomainName != "" || c.HasCustomTLS() + return false } func (c *Conf) checkTLS() { - hasTLS := c.HasCustomTLS() + // hasTLS := c.HasCustomTLS() - if hasTLS && c.ListenHTTPS == "" { - c.ListenHTTPS = c.Listen - c.Listen = "" - } + // if hasTLS && c.ListenHTTPS == "" { + // c.ListenHTTPS = c.Listen + // c.Listen = "" + // } - if !hasTLS || c.ACMEDomainName == "" { - return - } + // if !hasTLS || c.ACMEDomainName == "" { + // return + // } - log.Warn(). - Str("tlscert", c.TLSCert). - Str("tlskey", c.TLSKey). - Str("acme_domain_name", c.ACMEDomainName). - Msg("ACME/Let's Encrypt will not be used because custom certificate is specified") - c.ACMEDomainName = "" + // log.Warn(). + // Str("tlscert", c.TLSCert). + // Str("tlskey", c.TLSKey). + // Str("acme_domain_name", c.ACMEDomainName). + // Msg("ACME/Let's Encrypt will not be used because custom certificate is specified") + // c.ACMEDomainName = "" } func (c *Conf) parseURLs() {