From b931d583b88a645260201393bfd28480329cc168 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Wed, 26 Feb 2025 13:10:17 +1300 Subject: [PATCH 1/2] Use the new deployments orchestrator by default If you need the 'classic' orchestrator then the UI can be enabled in `runtime.exs` and the deployment can be switched over, but the new orchestrator should be the default. --- lib/nerves_hub/deployments/deployment.ex | 5 ++++- ...13215925_set_default_deployment_orchestrator_strategy.exs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/nerves_hub/deployments/deployment.ex b/lib/nerves_hub/deployments/deployment.ex index 980cc602f..b5f4f7549 100644 --- a/lib/nerves_hub/deployments/deployment.ex +++ b/lib/nerves_hub/deployments/deployment.ex @@ -75,7 +75,10 @@ defmodule NervesHub.Deployments.Deployment do field(:device_count, :integer, virtual: true) # temporary addition while we feature test a new deployment management strategy - field(:orchestrator_strategy, Ecto.Enum, values: [:multi, :distributed], default: :multi) + field(:orchestrator_strategy, Ecto.Enum, + values: [:multi, :distributed], + default: :distributed + ) timestamps() end diff --git a/priv/repo/migrations/20250213215925_set_default_deployment_orchestrator_strategy.exs b/priv/repo/migrations/20250213215925_set_default_deployment_orchestrator_strategy.exs index c98fafc14..dba03ce58 100644 --- a/priv/repo/migrations/20250213215925_set_default_deployment_orchestrator_strategy.exs +++ b/priv/repo/migrations/20250213215925_set_default_deployment_orchestrator_strategy.exs @@ -5,6 +5,6 @@ defmodule NervesHub.Repo.Migrations.SetDefaultDeploymentOrchestratorStrategy do alias NervesHub.Repo def change do - Repo.update_all(Deployment, set: [orchestrator_strategy: "multi"]) + Repo.update_all(Deployment, set: [orchestrator_strategy: "distributed"]) end end From 7d187db0ff6e00b354b0dcea3f047e1a60567b1c Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Wed, 26 Feb 2025 13:41:41 +1300 Subject: [PATCH 2/2] Address some test issues related to switching to the distributed orchestrator --- lib/nerves_hub/deployments/distributed/orchestrator.ex | 4 +++- test/nerves_hub_web/channels/websocket_test.exs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/nerves_hub/deployments/distributed/orchestrator.ex b/lib/nerves_hub/deployments/distributed/orchestrator.ex index 720be47aa..fae692d10 100644 --- a/lib/nerves_hub/deployments/distributed/orchestrator.ex +++ b/lib/nerves_hub/deployments/distributed/orchestrator.ex @@ -279,7 +279,9 @@ defmodule NervesHub.Deployments.Distributed.Orchestrator do def start_orchestrator( %Deployment{is_active: true, orchestrator_strategy: :distributed} = deployment ) do - ProcessHub.start_child(:deployment_orchestrators, child_spec(deployment)) + if Application.get_env(:nerves_hub, :deploy_env) != "test" do + ProcessHub.start_child(:deployment_orchestrators, child_spec(deployment)) + end end def start_orchestrator(_) do diff --git a/test/nerves_hub_web/channels/websocket_test.exs b/test/nerves_hub_web/channels/websocket_test.exs index 1a594fcb9..4d8b7a34c 100644 --- a/test/nerves_hub_web/channels/websocket_test.exs +++ b/test/nerves_hub_web/channels/websocket_test.exs @@ -6,7 +6,7 @@ defmodule NervesHubWeb.WebsocketTest do alias NervesHub.AuditLogs alias NervesHub.AuditLogs.AuditLog alias NervesHub.Deployments - alias NervesHub.Deployments.Orchestrator + alias NervesHub.Deployments.Distributed.Orchestrator alias NervesHub.Devices alias NervesHub.Devices.Connections alias NervesHub.Devices.Device