Features: 1) Add error handling for subprocess execution with non-zero exit codes; 2) Update service messages for better clarity.
Fixes: 1) Ensure `run_with_spinner` handles subprocess errors gracefully by setting and resetting execution flags; 2) Prevent script termination on `docker compose down` failures. Extra: 1) Improve inline comments and messaging; 2) Minor adjustments to enhance script maintainability.
This commit is contained in:
parent
e7ba7dde0f
commit
d8bc92ced0
1 changed files with 14 additions and 7 deletions
|
|
@ -24,16 +24,23 @@ run_with_spinner() {
|
|||
((i++))
|
||||
done
|
||||
|
||||
set +e
|
||||
wait "$pid"
|
||||
local rc=$?
|
||||
set -e
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
printf "\e[33m(! exit %d)\e[0m " "$rc"
|
||||
fi
|
||||
|
||||
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"
|
||||
run_with_spinner "docker compose --ansi never down || true" "Stopping services"
|
||||
run_with_spinner "docker compose --ansi never up -d --build" "Rebuilding & starting services"
|
||||
run_with_spinner "docker compose --ansi never exec app poetry run python manage.py migrate --no-input" "Applying database migrations"
|
||||
run_with_spinner "docker compose --ansi never exec app poetry run python manage.py collectstatic --no-input" "Collecting static files"
|
||||
run_with_spinner "docker compose --ansi never 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"
|
||||
echo -e "\e[1mAll done! Your application is up and running.\e[0m"
|
||||
|
|
|
|||
Loading…
Reference in a new issue