feat: add rolling updates for production deployment (#175)

* feat: rolling update uvicorn workers

* script fixes
This commit is contained in:
Abhishek 2026-03-02 14:44:04 +05:30 committed by GitHub
parent ad6261333d
commit aed5a782fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 785 additions and 497 deletions

View file

@ -42,17 +42,17 @@ kill_process_tree() {
descendants=$(get_descendants "$pid")
# Kill children first (bottom-up), then parent
# Kill the parent first so supervisors don't respawn children
if kill -0 "$pid" 2>/dev/null; then
kill "$signal" "$pid" 2>/dev/null || true
fi
# Then kill any remaining descendants
for desc_pid in $descendants; do
if kill -0 "$desc_pid" 2>/dev/null; then
kill "$signal" "$desc_pid" 2>/dev/null || true
fi
done
# Kill the parent
if kill -0 "$pid" 2>/dev/null; then
kill "$signal" "$pid" 2>/dev/null || true
fi
}
###############################################################################
@ -113,14 +113,14 @@ for pidfile in "${pid_files[@]}"; do
# Final check
if kill -0 "$oldpid" 2>/dev/null; then
echo " Error: Failed to stop $name (PID $oldpid)"
((failed_count++))
failed_count=$((failed_count + 1))
else
echo " Stopped $name (forced)"
((stopped_count++))
stopped_count=$((stopped_count + 1))
fi
else
echo " Stopped $name"
((stopped_count++))
stopped_count=$((stopped_count + 1))
fi
else
echo "Service $name (PID $oldpid) is not running"
@ -130,8 +130,8 @@ for pidfile in "${pid_files[@]}"; do
fi
done
# Clean up any port tracking files for uvicorn
rm -f "$RUN_DIR/uvicorn.port" "$RUN_DIR/uvicorn_new.port" "$RUN_DIR/uvicorn_old.pid"
# Clean up any port tracking files for uvicorn and band tracking
rm -f "$RUN_DIR/uvicorn.port" "$RUN_DIR/uvicorn_new.port" "$RUN_DIR/uvicorn_old.pid" "$RUN_DIR/active_band"
###############################################################################
### SUMMARY