From 3dc220f5da3a02233e0394616f4c5abb8c4bbf65 Mon Sep 17 00:00:00 2001 From: Forrest <6546409+frrist@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:08:59 -0700 Subject: [PATCH] fix: node type trinary state (#4400) --- cmd/cli/serve/serve.go | 5 +++++ pkg/config/types/default_config.go | 2 +- pkg/setup/setup.go | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/cli/serve/serve.go b/cmd/cli/serve/serve.go index 9b10c5547a..34a9eedc28 100644 --- a/cmd/cli/serve/serve.go +++ b/cmd/cli/serve/serve.go @@ -118,6 +118,11 @@ func serve(cmd *cobra.Command, cfg types.Bacalhau, fsRepo *repo.FsRepo) error { isRequesterNode := cfg.Orchestrator.Enabled isComputeNode := cfg.Compute.Enabled + if !(isComputeNode || isRequesterNode) { + log.Warn().Msg("neither --compute nor --orchestrator were provided, defaulting to orchestrator node.") + isRequesterNode = true + } + networkConfig, err := getNetworkConfig(cfg) if err != nil { return err diff --git a/pkg/config/types/default_config.go b/pkg/config/types/default_config.go index dfbf8e3bb7..cfc39bd357 100644 --- a/pkg/config/types/default_config.go +++ b/pkg/config/types/default_config.go @@ -31,7 +31,7 @@ var Default = Bacalhau{ }, NameProvider: "puuid", Orchestrator: Orchestrator{ - Enabled: true, + Enabled: false, Host: "0.0.0.0", Port: 4222, NodeManager: NodeManager{ diff --git a/pkg/setup/setup.go b/pkg/setup/setup.go index 23d68b6c1f..a266fb11f8 100644 --- a/pkg/setup/setup.go +++ b/pkg/setup/setup.go @@ -70,6 +70,8 @@ func SetupBacalhauRepoForTesting(t testing.TB) (*repo.FsRepo, types.Bacalhau) { t.Setenv(config.KeyAsEnvVar(types.UpdateConfigIntervalKey), "0") cfgValues := map[string]any{ types.DataDirKey: path, + // callers of this method currently assume it creates an orchestrator node. + types.OrchestratorEnabledKey: true, } // the BACALHAU_NODE_IPFS_CONNECT env var is only bound if it's corresponding flags are registered.