-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.ps1
More file actions
53 lines (44 loc) · 1.59 KB
/
Copy pathstart.ps1
File metadata and controls
53 lines (44 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Start Solarch (Docker). First time? Run ./install.ps1 instead.
param(
[switch]$Detach,
[switch]$Build,
[switch]$Help
)
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
function Write-Brand([string]$Text) { Write-Host $Text -ForegroundColor DarkYellow }
function Write-Muted([string]$Text) { Write-Host $Text -ForegroundColor DarkGray }
function Write-Ok([string]$Text) { Write-Host " ✓ $Text" -ForegroundColor Green }
function Write-Fail([string]$Text) { Write-Host " ✗ $Text" -ForegroundColor Red }
function Test-EnvComplete([string]$Path = '.env') {
if (-not (Test-Path $Path)) { return $false }
$lines = Get-Content $Path
if (-not ($lines | Where-Object { $_ -match '^NEO4J_PASSWORD=.+' })) { return $false }
if (-not ($lines | Where-Object { $_ -match '^LLM_GENERATION_PROVIDER=.+' })) { return $false }
return $true
}
function Invoke-SolarchCompose {
Remove-Item Env:SOLARCH_BASIC_AUTH_USER -ErrorAction SilentlyContinue
Remove-Item Env:SOLARCH_BASIC_AUTH_HASH -ErrorAction SilentlyContinue
& docker compose @args
}
if ($Help) {
Write-Brand 'solarch start'
Write-Muted ' Usage: ./start.ps1 [-Detach] [-Build]'
Write-Muted ' First time: ./install.ps1'
exit 0
}
if (-not (Test-EnvComplete)) {
Write-Fail 'Run ./install.ps1 first (missing or incomplete .env).'
exit 1
}
$running = Invoke-SolarchCompose ps --status running -q web 2>$null
if ($running) {
Write-Ok 'Already running → http://localhost:3000'
exit 0
}
$args = @('up')
if ($Build) { $args += '--build' }
if ($Detach) { $args += '-d' }
Write-Ok 'Starting Solarch…'
Invoke-SolarchCompose @args