Fixes: 1) Remove obsolete `reboot` scripts for Unix and Windows to prevent redundancy; 2) Update Windows `test.ps1` to handle omitted coverage patterns and improve error feedback. Extra: 1) Refactor Windows scripts (`make-messages.ps1`, `compile-messages.ps1`, `backup.ps1`) to use shared utilities for better consistency and output formatting; 2) Add spinner-based progress indicators to enhance user experience in interactive environments.
96 lines
2.5 KiB
PowerShell
96 lines
2.5 KiB
PowerShell
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
# Load shared utilities
|
|
$utilsPath = Join-Path $PSScriptRoot '..\lib\utils.ps1'
|
|
. $utilsPath
|
|
|
|
.\scripts\Windows\starter.ps1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
# Verify Docker images
|
|
Write-Step "Verifying all images are present…"
|
|
|
|
$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 2>$null))
|
|
{
|
|
Write-Error-Custom "Required images not found. Please run install.ps1 first."
|
|
exit 1
|
|
}
|
|
|
|
Write-Info " • Found image: $image"
|
|
}
|
|
|
|
# Start services
|
|
Write-Step "Spinning services up..."
|
|
docker compose up --no-build --detach --wait
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Failed to start services"
|
|
exit $LASTEXITCODE
|
|
}
|
|
Write-Success "Services are up and healthy!"
|
|
|
|
# Run pre-run tasks
|
|
Write-Step "Completing pre-run tasks..."
|
|
|
|
Write-Info " → Running migrations..."
|
|
docker compose exec app uv run manage.py migrate --no-input
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Migrations failed"
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Info " → Initializing..."
|
|
docker compose exec app uv run manage.py initialize
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Initialization failed"
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Info " → Setting default caches..."
|
|
docker compose exec app uv run manage.py set_default_caches
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Cache setup failed"
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Info " → Rebuilding search index..."
|
|
docker compose exec app uv run manage.py search_index --rebuild -f
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Search index rebuild failed"
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Info " → Collecting static files..."
|
|
docker compose exec app uv run manage.py collectstatic --clear --no-input
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error-Custom "Static files collection failed"
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Success "Pre-run tasks completed successfully!"
|
|
|
|
# Cleanup
|
|
Write-Step "Cleaning unused Docker data..."
|
|
docker system prune -f
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Warning-Custom "Docker cleanup had issues, but continuing..."
|
|
}
|
|
Write-Success "Unused Docker data cleaned successfully!"
|
|
|
|
Write-Result ""
|
|
Write-Result "All done! eVibes is up and running!"
|