Add debug flag to cluster to disable FFmpeg check

This commit is contained in:
Ingo Oppermann 2023-07-10 11:07:24 +02:00
parent ba9227dc96
commit 71b613371a
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
4 changed files with 25 additions and 7 deletions

View File

@ -508,6 +508,9 @@ func (a *api) start(ctx context.Context) error {
CoreSkills: a.ffmpeg.Skills(),
IPLimiter: a.sessionsLimiter,
Logger: a.log.logger.core.WithComponent("Cluster"),
Debug: cluster.DebugConfig{
DisableFFmpegCheck: cfg.Cluster.Debug.DisableFFmpegCheck,
},
})
if err != nil {
return fmt.Errorf("unable to create cluster: %w", err)

View File

@ -93,6 +93,10 @@ type Peer struct {
Address string
}
type DebugConfig struct {
DisableFFmpegCheck bool
}
type Config struct {
ID string // ID of the node
Name string // Name of the node
@ -109,6 +113,8 @@ type Config struct {
IPLimiter net.IPLimiter
Logger log.Logger
Debug DebugConfig
}
type cluster struct {
@ -166,6 +172,8 @@ type cluster struct {
barrierLock sync.RWMutex
limiter net.IPLimiter
debugDisableFFmpegCheck bool
}
var ErrDegraded = errors.New("cluster is currently degraded")
@ -199,6 +207,8 @@ func New(ctx context.Context, config Config) (Cluster, error) {
barrier: map[string]bool{},
limiter: config.IPLimiter,
debugDisableFFmpegCheck: config.Debug.DisableFFmpegCheck,
}
if c.config == nil {
@ -1012,12 +1022,14 @@ func (c *cluster) checkClusterNodes() ([]string, error) {
return nil, fmt.Errorf("node %s has a different configuration: %w", id, err)
}
skills, err := node.CoreSkills()
if err != nil {
return nil, fmt.Errorf("node %s has no FFmpeg skills available: %w", id, err)
}
if !c.skills.Equal(skills) {
return nil, fmt.Errorf("node %s has mismatching FFmpeg skills", id)
if !c.debugDisableFFmpegCheck {
skills, err := node.CoreSkills()
if err != nil {
return nil, fmt.Errorf("node %s has no FFmpeg skills available: %w", id, err)
}
if !c.skills.Equal(skills) {
return nil, fmt.Errorf("node %s has mismatching FFmpeg skills", id)
}
}
for _, name := range config.Host.Name {

View File

@ -296,6 +296,7 @@ func (d *Config) init() {
d.vars.Register(value.NewInt64(&d.Cluster.SyncInterval, 5), "cluster.sync_interval_sec", "CORE_CLUSTER_SYNC_INTERVAL_SEC", nil, "Interval between aligning the process in the cluster DB with the processes on the nodes", true, false)
d.vars.Register(value.NewInt64(&d.Cluster.NodeRecoverTimeout, 120), "cluster.node_recover_timeout_sec", "CORE_CLUSTER_NODE_RECOVER_TIMEOUT_SEC", nil, "Timeout for a node to recover before rebalancing the processes", true, false)
d.vars.Register(value.NewInt64(&d.Cluster.EmergencyLeaderTimeout, 10), "cluster.emergency_leader_timeout_sec", "CORE_CLUSTER_EMERGENCY_LEADER_TIMEOUT_SEC", nil, "Timeout for establishing the emergency leadership after lost contact to raft leader", true, false)
d.vars.Register(value.NewBool(&d.Cluster.Debug.DisableFFmpegCheck, false), "cluster.debug.disable_ffmpeg_check", "CORE_CLUSTER_DEBUG_DISABLE_FFMPEG_CHECK", nil, "Disable checking for identical FFmpeg versions on all nodes", false, false)
}
// Validate validates the current state of the Config for completeness and sanity. Errors are

View File

@ -180,13 +180,15 @@ type Data struct {
} `json:"resources"`
Cluster struct {
Enable bool `json:"enable"`
Debug bool `json:"debug"`
Address string `json:"address"` // ip:port
Peers []string `json:"peers"`
StartupTimeout int64 `json:"startup_timeout_sec" format:"int64"` // seconds
SyncInterval int64 `json:"sync_interval_sec" format:"int64"` // seconds
NodeRecoverTimeout int64 `json:"node_recover_timeout_sec" format:"int64"` // seconds
EmergencyLeaderTimeout int64 `json:"emergency_leader_timeout_sec" format:"int64"` // seconds
Debug struct {
DisableFFmpegCheck bool `json:"disable_ffmpeg_check"`
} `json:"debug"`
} `json:"cluster"`
}