schon/scripts/Windows/run.ps1

70 lines
1.9 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
.\scripts\Windows\starter.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Write-Host "Verifying all images are present…" -ForegroundColor Green
$config = docker compose config --format json | ConvertFrom-Json
foreach ($prop in $config.services.PSObject.Properties)
{
$svc = $prop.Value
if (-not ($svc.PSObject.Properties.Name -contains 'image'))
{
continue
}
$image = $svc.PSObject.Properties['image'].Value
if (-not (docker image inspect $image))
{
Write-Error "Required images not found. Please run install.ps1 first."
exit 1
}
Write-Host " • Found image: $image"
}
Write-Host "Spinning services up..." -ForegroundColor Magenta
docker compose up --no-build --detach --wait
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Write-Host "Services are up and healthy!" -ForegroundColor Green
Write-Host "Completing pre-run tasks..." -ForegroundColor Magenta
docker compose exec app uv run python manage.py migrate --no-input
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
docker compose exec app uv run python manage.py initialize
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
docker compose exec app uv run python manage.py set_default_caches
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
docker compose exec app uv run python manage.py search_index --rebuild -f
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
docker compose exec app uv run python manage.py collectstatic --clear --no-input
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Write-Host "Pre-run tasks completed successfully!" -ForegroundColor Green
Write-Host "Cleaning unused Docker data..." -ForegroundColor Magenta
docker system prune -f
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Write-Host "Unused Docker data cleaned successfully!" -ForegroundColor Green
Write-Host "All done! eVibes is up and running!" -ForegroundColor Cyan