Features: 1) Add docker compose command updates for improved compatibility.
Fixes: 1) Correct variable renaming and initial assignment in `run_with_spinner`. Extra: 1) General readability improvements and inline comment enhancements; 2) Update application name in final output message.
This commit is contained in:
parent
9bc982a6f1
commit
979e7fdac1
1 changed files with 19 additions and 11 deletions
|
|
@ -22,16 +22,16 @@ spinner() {
|
|||
}
|
||||
|
||||
run_with_spinner() {
|
||||
local args="$1" msg="$2" rc
|
||||
local cmd="$1" msg="$2" rc=0
|
||||
|
||||
printf "\e[36m%s... \e[0m" "$msg"
|
||||
|
||||
bash -c "docker --ansi never $args" &> /dev/null &
|
||||
bash -c "$cmd" &> /dev/null &
|
||||
local pid=$!
|
||||
|
||||
spinner "$pid" "$msg"
|
||||
|
||||
wait "$pid" || rc=$?
|
||||
rc=${rc:-0}
|
||||
if ! wait "$pid"; then rc=$?; fi
|
||||
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
printf "\r\e[32m✔\e[0m %s\n" "$msg"
|
||||
|
|
@ -42,11 +42,19 @@ run_with_spinner() {
|
|||
|
||||
echo
|
||||
|
||||
run_with_spinner "compose down" "Stopping services (down)"
|
||||
run_with_spinner "compose up -d --build" "Rebuilding & starting services"
|
||||
run_with_spinner "compose exec app poetry run python manage.py migrate --no-input" "Applying database migrations"
|
||||
run_with_spinner "compose exec app poetry run python manage.py collectstatic --no-input" "Collecting static files"
|
||||
run_with_spinner "compose exec app poetry run python manage.py set_default_caches" "Setting default caches"
|
||||
run_with_spinner "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 build" \
|
||||
"Rebuilding services"
|
||||
run_with_spinner "docker compose --ansi never up -d" \
|
||||
"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 "\n\e[1mAll done! Your application is up and running.\e[0m"
|
||||
echo -e "\n\e[1mAll done! eVibes is up and running.\e[0m"
|
||||
|
|
|
|||
Loading…
Reference in a new issue