schon/scripts/Unix/run.sh
Egor fureunoir Gorbunov 0dc3daaa4f Features: 1) Add fallback for missing jq in image verification; 2) Enhance verbosity control for management commands in run.sh; 3) Update generate-environment-file.sh to use consistent variable names and handle CORS origins dynamically.
Fixes: 1) Correct `.env` export script to handle sorted variables without associative arrays; 2) Fix incomplete `.env` output in `generate-environment-file.sh`.

Extra: 1) Improve code readability and maintainability across shell scripts; 2) Standardize echo statements and reduce excessive formatting.
2025-10-28 15:31:26 +03:00

42 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
source ./scripts/Unix/starter.sh
echo "Verifying all images are present..."
if command -v jq >/dev/null 2>&1; then
images=$(docker compose config --format json | jq -r '.services[].image // empty')
if [ -n "$images" ]; then
for image in $images; do
if ! docker image inspect "$image" > /dev/null 2>&1; then
echo "Required images not found. Please run install.sh first." >&2
exit 1
fi
echo " - Found image: $image"
done
fi
else
echo "jq is not installed; skipping image verification step."
fi
echo "Spinning services up..."
docker compose up --no-build --detach --wait
echo "Services are up and healthy!"
echo "Applying migrations..."
docker compose exec app uv run python manage.py migrate --no-input --verbosity 0
echo "Migrations applied successfully!"
echo "Collecting static files..."
docker compose exec app uv run python manage.py collectstatic --clear --no-input --verbosity 0
echo "Static files collected successfully!"
echo "Setting default caches..."
docker compose exec app uv run python manage.py set_default_caches
echo "Default caches set successfully!"
echo "Cleaning unused Docker data..."
docker system prune -f
echo "Unused Docker data cleaned successfully!"
echo "All done! eVibes is up and running!"