schon/scripts/Unix/restart.sh
Egor fureunoir Gorbunov e0e3c93e63 refactor(scripts): centralize static files collection in Docker entrypoint
Moved static files collection from platform-specific scripts to the Docker entrypoint script. Simplifies maintenance by eliminating redundant logic across Windows, Unix, and restart scripts.

Updated logo/icon settings to use `static()` for better flexibility.
2026-03-05 00:07:41 +03:00

67 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
source ./scripts/Unix/starter.sh
# Generate Prometheus web config from .env
log_step "Generating Prometheus web config..."
generate_prometheus_web_config
# Shutdown services
log_step "Shutting down..."
if ! output=$(docker compose down 2>&1); then
log_error "Failed to shut down services"
echo "$output"
exit 1
fi
log_success "Services were shut down successfully!"
# Rebuild and start services
log_step "Spinning services up with rebuild..."
if ! output=$(docker compose up -d --build --wait 2>&1); then
log_error "Failed to start services"
echo "$output"
exit 1
fi
log_success "Services are up and healthy!"
# Run pre-run tasks
log_step "Completing pre-run tasks..."
log_info " → Running migrations..."
if ! output=$(docker compose exec -T app uv run manage.py migrate --no-input --verbosity 0 2>&1); then
log_error "Migrations failed"
echo "$output"
exit 1
fi
log_info " → Initializing..."
if ! output=$(docker compose exec -T app uv run manage.py initialize 2>&1); then
log_error "Initialization failed"
echo "$output"
exit 1
fi
log_info " → Setting default caches..."
if ! output=$(docker compose exec -T app uv run manage.py set_default_caches 2>&1); then
log_error "Cache setup failed"
echo "$output"
exit 1
fi
log_info " → Rebuilding search index..."
if ! output=$(docker compose exec -T app uv run manage.py search_index --rebuild -f 2>&1); then
log_error "Search index rebuild failed"
echo "$output"
exit 1
fi
log_success "Pre-run tasks completed successfully!"
# Cleanup
log_step "Cleaning up unused Docker data..."
docker system prune -f >/dev/null 2>&1 || log_warning "Docker cleanup had issues, but continuing..."
log_success "Unused Docker data cleaned successfully!"
echo
log_result "All done! Schon is up and running!"