mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-12-15 00:35:47 -07:00
ENGINE: Cutover Pains and Fixes
This commit is contained in:
24
Borealis.ps1
24
Borealis.ps1
@@ -233,31 +233,31 @@ function Ensure-EngineWebInterface {
|
|||||||
[string]$ProjectRoot
|
[string]$ProjectRoot
|
||||||
)
|
)
|
||||||
|
|
||||||
$engineSource = Join-Path $ProjectRoot 'Engine\web-interface'
|
$engineDestination = Join-Path $ProjectRoot 'Engine\web-interface'
|
||||||
$legacySource = Join-Path $ProjectRoot 'Data\Server\WebUI'
|
$engineStageSource = Join-Path $ProjectRoot 'Data\Engine\web-interface'
|
||||||
|
|
||||||
if (-not (Test-Path $legacySource)) {
|
if (-not (Test-Path $engineStageSource)) {
|
||||||
return
|
throw "Engine web interface source missing at '$engineStageSource'."
|
||||||
}
|
}
|
||||||
|
|
||||||
$enginePackage = Join-Path $engineSource 'package.json'
|
$enginePackage = Join-Path $engineDestination 'package.json'
|
||||||
$engineSrcDir = Join-Path $engineSource 'src'
|
$engineSrcDir = Join-Path $engineDestination 'src'
|
||||||
if ((Test-Path $enginePackage) -and (Test-Path $engineSrcDir)) {
|
if ((Test-Path $enginePackage) -and (Test-Path $engineSrcDir)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $engineSource)) {
|
if (-not (Test-Path $engineDestination)) {
|
||||||
New-Item -Path $engineSource -ItemType Directory -Force | Out-Null
|
New-Item -Path $engineDestination -ItemType Directory -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
$preserve = @('.gitignore','README.md')
|
$preserve = @('.gitignore','README.md')
|
||||||
Get-ChildItem -Path $engineSource -Force | Where-Object { $preserve -notcontains $_.Name } |
|
Get-ChildItem -Path $engineDestination -Force | Where-Object { $preserve -notcontains $_.Name } |
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
Copy-Item (Join-Path $legacySource '*') $engineSource -Recurse -Force
|
Copy-Item (Join-Path $engineStageSource '*') $engineDestination -Recurse -Force
|
||||||
|
|
||||||
if (-not (Test-Path $enginePackage)) {
|
if (-not (Test-Path $enginePackage)) {
|
||||||
throw "Failed to stage Engine web interface into '$engineSource'."
|
throw "Failed to stage Engine web interface into '$engineDestination' from '$engineStageSource'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,7 +1415,7 @@ switch ($choice) {
|
|||||||
$dataSource = "Data"
|
$dataSource = "Data"
|
||||||
$engineSource = "$dataSource\Engine"
|
$engineSource = "$dataSource\Engine"
|
||||||
$engineDataDestination = "$venvFolder\Data\Engine"
|
$engineDataDestination = "$venvFolder\Data\Engine"
|
||||||
$webUIFallbackSource = "$dataSource\Server\web-interface"
|
$webUIFallbackSource = "$dataSource\Engine\web-interface"
|
||||||
$webUIDestination = "$venvFolder\web-interface"
|
$webUIDestination = "$venvFolder\web-interface"
|
||||||
$venvPython = Join-Path $venvFolder 'Scripts\python.exe'
|
$venvPython = Join-Path $venvFolder 'Scripts\python.exe'
|
||||||
$engineSourceAbsolute = Join-Path $scriptDir $engineSource
|
$engineSourceAbsolute = Join-Path $scriptDir $engineSource
|
||||||
|
|||||||
10
Borealis.sh
10
Borealis.sh
@@ -332,20 +332,20 @@ PY
|
|||||||
|
|
||||||
ensure_engine_webui_source() {
|
ensure_engine_webui_source() {
|
||||||
local engineSource="Engine/web-interface"
|
local engineSource="Engine/web-interface"
|
||||||
local legacySource="Data/Server/WebUI"
|
|
||||||
if [[ -d "${engineSource}/src" && -f "${engineSource}/package.json" ]]; then
|
if [[ -d "${engineSource}/src" && -f "${engineSource}/package.json" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [[ ! -d "$legacySource" ]]; then
|
local stageSource="Data/Engine/web-interface"
|
||||||
echo "${RED}Legacy WebUI source '$legacySource' not found.${RESET}" >&2
|
if [[ ! -d "$stageSource" ]]; then
|
||||||
|
echo "${RED}Engine web interface source '$stageSource' not found.${RESET}" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
mkdir -p "$engineSource"
|
mkdir -p "$engineSource"
|
||||||
find "$engineSource" -mindepth 1 -maxdepth 1 \
|
find "$engineSource" -mindepth 1 -maxdepth 1 \
|
||||||
! -name '.gitignore' ! -name 'README.md' -exec rm -rf {} +
|
! -name '.gitignore' ! -name 'README.md' -exec rm -rf {} +
|
||||||
cp -a "$legacySource/." "$engineSource/"
|
cp -a "$stageSource/." "$engineSource/"
|
||||||
if [[ ! -f "${engineSource}/package.json" ]]; then
|
if [[ ! -f "${engineSource}/package.json" ]]; then
|
||||||
echo "${RED}Failed to stage Engine web interface into '$engineSource'.${RESET}" >&2
|
echo "${RED}Failed to stage Engine web interface into '$engineSource' from '$stageSource'.${RESET}" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"name": "server_url",
|
"name": "server_url",
|
||||||
"label": "Borealis Server URL",
|
"label": "Borealis Server URL",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "http://localhost:5000",
|
"default": "https://localhost:5000",
|
||||||
"required": true,
|
"required": true,
|
||||||
"description": "URL of where the agent is going to reach-out to moving forward."
|
"description": "URL of where the agent is going to reach-out to moving forward."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ def _stage_web_interface_assets(logger: Optional[logging.Logger] = None, *, forc
|
|||||||
|
|
||||||
project_root = _project_root()
|
project_root = _project_root()
|
||||||
engine_web_root = project_root / "Engine" / "web-interface"
|
engine_web_root = project_root / "Engine" / "web-interface"
|
||||||
legacy_source = project_root / "Data" / "Server" / "WebUI"
|
stage_source = project_root / "Data" / "Engine" / "web-interface"
|
||||||
|
|
||||||
if not legacy_source.is_dir():
|
if not stage_source.is_dir():
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Engine web interface source missing: {legacy_source}"
|
f"Engine web interface source missing: {stage_source}"
|
||||||
)
|
)
|
||||||
|
|
||||||
index_path = engine_web_root / "index.html"
|
index_path = engine_web_root / "index.html"
|
||||||
@@ -92,14 +92,14 @@ def _stage_web_interface_assets(logger: Optional[logging.Logger] = None, *, forc
|
|||||||
if engine_web_root.exists():
|
if engine_web_root.exists():
|
||||||
shutil.rmtree(engine_web_root)
|
shutil.rmtree(engine_web_root)
|
||||||
|
|
||||||
shutil.copytree(legacy_source, engine_web_root)
|
shutil.copytree(stage_source, engine_web_root)
|
||||||
|
|
||||||
if not index_path.is_file():
|
if not index_path.is_file():
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Engine web interface staging failed; missing {index_path}"
|
f"Engine web interface staging failed; missing {index_path}"
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("Engine web interface staged from %s to %s", legacy_source, engine_web_root)
|
logger.info("Engine web interface staged from %s to %s", stage_source, engine_web_root)
|
||||||
return engine_web_root
|
return engine_web_root
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1838
Data/Engine/services/API/scheduled_jobs/legacy_job_scheduler.py
Normal file
1838
Data/Engine/services/API/scheduled_jobs/legacy_job_scheduler.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
try: # pragma: no cover - legacy module import guard
|
try: # pragma: no cover - Engine-local legacy scheduler shim
|
||||||
import job_scheduler as legacy_job_scheduler # type: ignore
|
from . import legacy_job_scheduler # type: ignore
|
||||||
except Exception as exc: # pragma: no cover - runtime guard
|
except Exception as exc: # pragma: no cover - runtime guard
|
||||||
legacy_job_scheduler = None # type: ignore
|
legacy_job_scheduler = None # type: ignore
|
||||||
_SCHEDULER_IMPORT_ERROR = exc
|
_SCHEDULER_IMPORT_ERROR = exc
|
||||||
@@ -36,8 +36,8 @@ if TYPE_CHECKING: # pragma: no cover - typing aide
|
|||||||
def _raise_scheduler_import() -> None:
|
def _raise_scheduler_import() -> None:
|
||||||
if _SCHEDULER_IMPORT_ERROR is not None:
|
if _SCHEDULER_IMPORT_ERROR is not None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Legacy job scheduler module could not be imported; ensure Data/Server/job_scheduler.py "
|
"Legacy job scheduler module could not be imported; ensure "
|
||||||
"remains available during the Engine migration."
|
"Data/Engine/services/API/scheduled_jobs/legacy_job_scheduler.py remains available."
|
||||||
) from _SCHEDULER_IMPORT_ERROR
|
) from _SCHEDULER_IMPORT_ERROR
|
||||||
|
|
||||||
|
|
||||||
@@ -79,4 +79,3 @@ def register_management(app: "Flask", adapters: "EngineServiceAdapters") -> None
|
|||||||
"""Ensure scheduled job routes are registered via the legacy scheduler."""
|
"""Ensure scheduled job routes are registered via the legacy scheduler."""
|
||||||
|
|
||||||
ensure_scheduler(app, adapters)
|
ensure_scheduler(app, adapters)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Borealis is a remote management platform with a simple, visual automation layer, enabling you to leverage scripts, Ansible playbooks, and advanced nodegraph-based automation workflows. I originally created Borealis to work towards consolidating the core functionality of several standalone automation platforms in my homelab, such as TacticalRMM, Ansible AWX, SemaphoreUI, and a few others.
|
Borealis is a remote management platform with a simple, visual automation layer, enabling you to leverage scripts, Ansible playbooks, and advanced nodegraph-based automation workflows. I originally created Borealis to work towards consolidating the core functionality of several standalone automation platforms in my homelab, such as TacticalRMM, Ansible AWX, SemaphoreUI, and a few others.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user