Restore scratch setup bootstrap and live frontdoor sweep

This commit is contained in:
master
2026-03-09 01:42:24 +02:00
parent abda749ffd
commit c9686edf07
13 changed files with 766 additions and 63 deletions

View File

@@ -273,6 +273,57 @@ function Initialize-EnvFile {
}
}
function Get-ComposeEnvValue([string]$key) {
$envFile = Join-Path $ComposeDir '.env'
if (-not (Test-Path $envFile)) {
return $null
}
foreach ($line in Get-Content $envFile) {
if ($line -match "^\s*$key=(.+)$") {
return $matches[1].Trim()
}
}
return $null
}
function Get-FrontdoorNetworkName {
if (-not [string]::IsNullOrWhiteSpace($env:FRONTDOOR_NETWORK)) {
return $env:FRONTDOOR_NETWORK.Trim()
}
$configured = Get-ComposeEnvValue 'FRONTDOOR_NETWORK'
if (-not [string]::IsNullOrWhiteSpace($configured)) {
return $configured
}
return 'stellaops_frontdoor'
}
function Ensure-FrontdoorNetwork {
$networkName = Get-FrontdoorNetworkName
if ([string]::IsNullOrWhiteSpace($networkName)) {
Write-Fail 'Unable to resolve the frontdoor Docker network name.'
exit 1
}
$existingNetworks = @(docker network ls --format '{{.Name}}' 2>$null)
if ($existingNetworks -contains $networkName) {
Write-Ok "Frontdoor network available ($networkName)"
return
}
Write-Warn "Frontdoor network missing ($networkName); creating it now."
docker network create $networkName | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Fail "Failed to create frontdoor network ($networkName)."
exit 1
}
Write-Ok "Created frontdoor network ($networkName)"
}
# ─── 4. Start infrastructure ───────────────────────────────────────────────
function Start-Infrastructure {
@@ -368,6 +419,7 @@ function Build-Images {
function Start-Platform {
Write-Step 'Starting full Stella Ops platform'
Ensure-FrontdoorNetwork
Push-Location $ComposeDir
try {
docker compose -f docker-compose.stella-ops.yml up -d

View File

@@ -190,6 +190,44 @@ ensure_env() {
fi
}
get_compose_env_value() {
local key="$1"
local env_file="${COMPOSE_DIR}/.env"
[[ -f "$env_file" ]] || return 1
awk -F= -v key="$key" '$1 == key { print substr($0, index($0, "=") + 1); exit }' "$env_file"
}
get_frontdoor_network_name() {
if [[ -n "${FRONTDOOR_NETWORK:-}" ]]; then
printf '%s\n' "$FRONTDOOR_NETWORK"
return
fi
local configured
configured="$(get_compose_env_value FRONTDOOR_NETWORK || true)"
if [[ -n "$configured" ]]; then
printf '%s\n' "$configured"
return
fi
printf '%s\n' 'stellaops_frontdoor'
}
ensure_frontdoor_network() {
local network_name
network_name="$(get_frontdoor_network_name)"
if docker network inspect "$network_name" >/dev/null 2>&1; then
ok "Frontdoor network available ($network_name)"
return
fi
warn "Frontdoor network missing ($network_name); creating it now."
docker network create "$network_name" >/dev/null
ok "Created frontdoor network ($network_name)"
}
# ─── 4. Start infrastructure ───────────────────────────────────────────────
start_infra() {
@@ -259,6 +297,7 @@ build_images() {
start_platform() {
step 'Starting full Stella Ops platform'
ensure_frontdoor_network
cd "$COMPOSE_DIR"
docker compose -f docker-compose.stella-ops.yml up -d
ok 'Platform services started'