Spaces:
Running
Running
File size: 1,603 Bytes
53c3899 10f8ea4 53c3899 10f8ea4 53c3899 10f8ea4 53c3899 10f8ea4 53c3899 10f8ea4 53c3899 10f8ea4 53c3899 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/bin/bash
# Start ever-jobs NestJS API in background, then Streamlit.
#
# ever-jobs uses extensionless ESM imports which Node 20 strict mode rejects
# (ERR_MODULE_NOT_FOUND for .../plugin.module). NODE_OPTIONS allows them.
#
# If ever-jobs fails anyway, Streamlit still launches and dedicated scrapers
# (LinkedIn/Indeed/Glassdoor/Remotive/WWR/Naukri) keep working — only the
# 160+ "ever-jobs" platforms are skipped that session.
echo "=== Starting ever-jobs API on port 3001 ==="
cd /app/vendor/ever-jobs
NODE_OPTIONS="--experimental-specifier-resolution=node" npx nest start api > /tmp/ever-jobs.log 2>&1 &
EVER_JOBS_PID=$!
# Shorter wait — 45s max. ts-node compile on first start usually takes ~20s.
# Don't block Streamlit launch for longer than that even if ever-jobs hangs.
echo "Waiting for ever-jobs to be ready (up to 45s)..."
READY=0
for i in $(seq 1 22); do
if curl -sf http://localhost:3001/health > /dev/null 2>&1; then
echo "ever-jobs ready after ${i}x2s"
READY=1
break
fi
# Check if the process died early
if ! kill -0 $EVER_JOBS_PID 2>/dev/null; then
echo "ever-jobs process exited early — see error below:"
tail -20 /tmp/ever-jobs.log 2>/dev/null
break
fi
sleep 2
done
if [ $READY -eq 0 ]; then
echo "WARNING: ever-jobs did not start — 160+ platforms will be skipped this session."
echo " Dedicated scrapers (LinkedIn/Indeed/Glassdoor/Remotive/WWR/Naukri) still work."
fi
echo "=== Starting Streamlit ==="
cd /app
exec streamlit run ui.py --server.port=7860 --server.address=0.0.0.0
|