JAA-ATS-Tool / start.sh
saitejatirunagari's picture
fix(hf): allow extensionless ESM imports in ever-jobs sidecar
10f8ea4
Raw
History Blame
1.6 kB
#!/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