schon/scripts/Windows/reboot.ps1
Egor fureunoir Gorbunov f090b2ddc9 Features: 1) Add verbosity option for manage.py migrate and collectstatic commands in reboot scripts;
Fixes: 1) Remove unused sniffer_timeout in Elasticsearch settings;

Extra: 1) Minor adjustments to improve script output clarity.
2025-06-22 01:06:20 +03:00

51 lines
1.9 KiB
PowerShell

$ErrorActionPreference = 'Stop'
if (-not (Test-Path -Path ".\evibes" -PathType Container))
{
Write-Host "❌ Please run this script from the project's root (where the 'evibes' directory lives)." -ForegroundColor Red
exit 1
}
$purple = "`e[38;2;121;101;209m"
$reset = "`e[0m"
$artPath = Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) '..\ASCII_ART_EVIBES'
if (-not (Test-Path $artPath))
{
Write-Host "❌ Could not find ASCII art at $artPath" -ForegroundColor Red
exit 1
}
$art = Get-Content -Raw -Path $artPath
$art -split "`r?`n" | ForEach-Object {
Write-Host "$purple$_$reset"
}
Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray
Write-Host "Shutting down..." -ForegroundColor Magenta
docker compose down
Write-Host "Services were shut down successfully!" -ForegroundColor Green
Write-Host "Spinning services up..." -ForegroundColor Magenta
docker compose up -d --build --wait
Write-Host "Services are up and healthy!" -ForegroundColor Green
Write-Host "Applying migrations..." -ForegroundColor Magenta
docker compose exec app poetry run python manage.py migrate --no-input --verbosity 0
Write-Host "Migrations applied successfully!" -ForegroundColor Green
Write-Host "Collecting static files..." -ForegroundColor Magenta
docker compose exec app poetry run python manage.py collectstatic --no-input --verbosity 0
Write-Host "Static files collected successfully!" -ForegroundColor Green
Write-Host "Setting default caches..." -ForegroundColor Magenta
docker compose exec app poetry run python manage.py set_default_caches
Write-Host "Default caches set successfully!" -ForegroundColor Green
Write-Host "Cleaning up unused Docker data..." -ForegroundColor Magenta
docker system prune -f
Write-Host "Unused Docker data cleaned successfully!" -ForegroundColor Green
Write-Host "All done! eVibes is up and running!" -ForegroundColor Cyan