Fix premature Connection Refused by polling for server health instead of a hardcoded 5s sleep, since Paperclip takes ~10-15s to fully start

This commit is contained in:
Jannik committed 2026-10-01 18:35:49 +02:00
1 parent 5a04aa0409
commit 7b29df68a0
1 file changed
+8 -1
+8 -1
View File
@@ -449,7 +449,14 @@ main() {
docker exec -u node paperclip_app npx paperclipai onboard --yes --bind lan >/dev/null 2>&1 &
sleep 15
docker restart paperclip_app >/dev/null
sleep 5
log "Waiting for Paperclip to start..."
for i in {1..20}; do
if docker exec paperclip_app curl -s http://127.0.0.1:3100/api/health >/dev/null 2>&1; then
log "Paperclip is up and responding!"
break
fi
sleep 2
done
bootstrap_url=$(docker exec -u node paperclip_app npx paperclipai auth bootstrap-ceo 2>/dev/null || echo "")
if [[ -n "${bootstrap_url}" ]]; then