Fixes: 1) Standardize spacing in spinner commands for consistency; 2) Correct alignment of service lifecycle commands; Extra: Adjust wording for better clarity and uniformity in reboot.sh script.
39 lines
1.2 KiB
Bash
Executable file
39 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
SPINNER=('|' '/' '-' '\\')
|
|
COLORS=(97 37 90)
|
|
DELAY=0.1
|
|
|
|
run_with_spinner() {
|
|
local cmd="$1"
|
|
local msg="$2"
|
|
|
|
printf "\e[1m%s...\e[0m " "$msg"
|
|
eval "$cmd" &> /dev/null &
|
|
local pid=$!
|
|
|
|
local i=0
|
|
while kill -0 "$pid" 2>/dev/null; do
|
|
local frame=${SPINNER[i % ${#SPINNER[@]}]}
|
|
local color=${COLORS[i % ${#COLORS[@]}]}
|
|
printf "\e[${color}m%s\e[0m" "$frame"
|
|
sleep "$DELAY"
|
|
printf "\b"
|
|
((i++))
|
|
done
|
|
|
|
wait "$pid"
|
|
printf "\e[32m✔\e[0m\n"
|
|
}
|
|
|
|
echo
|
|
run_with_spinner "docker compose --ansi never down" "Stopping services"
|
|
run_with_spinner "docker compose --ansi never up -d --build" "Rebuilding & starting services"
|
|
run_with_spinner "docker compose exec app poetry run python manage.py migrate --no-input" "Applying database migrations"
|
|
run_with_spinner "docker compose exec app poetry run python manage.py collectstatic --no-input" "Collecting static files"
|
|
run_with_spinner "docker compose exec app poetry run python manage.py set_default_caches" "Setting default caches"
|
|
run_with_spinner "docker system prune -f" "Cleaning up unused Docker data"
|
|
|
|
echo -e "\e[1mAll done! eVibes is up and running.\e[0m"
|