From b28d6f14070eb064b7d5fdf2e8b23ca3259745d7 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Sun, 22 Jun 2025 15:03:43 +0300 Subject: [PATCH] Features: 1) Add Windows PowerShell script for database and media backups; Fixes: 1) Correct health check URL syntax in `docker-compose.yml`; Extra: N/A; --- docker-compose.yml | 2 +- scripts/Windows/backup.ps1 | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 scripts/Windows/backup.ps1 diff --git a/docker-compose.yml b/docker-compose.yml index d58d1535..bbbb781e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: condition: service_healthy logging: *default-logging healthcheck: - test: [ "CMD-SHELL", "curl -f http://localhost:8000/health/ || exit 1" ] + test: [ "CMD-SHELL", "curl -f http://localhost:8000/health || exit 1" ] interval: 30s timeout: 10s retries: 5 diff --git a/scripts/Windows/backup.ps1 b/scripts/Windows/backup.ps1 new file mode 100644 index 00000000..15fd02bb --- /dev/null +++ b/scripts/Windows/backup.ps1 @@ -0,0 +1,34 @@ +#!/usr/bin/env pwsh +Set-StrictMode -Version Latest +$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 "Starting database backup process..." -ForegroundColor Magenta +docker compose exec app poetry run python manage.py dbbackup +Write-Host "Database backup created under ./dbbackup" -ForegroundColor Green + +Write-Host "Starting media backup process..." -ForegroundColor Magenta +docker compose exec app poetry run python manage.py mediabackup +Write-Host "Media backup created under ./dbbackup" -ForegroundColor Green \ No newline at end of file