JAA-ATS-Tool / start.sh
saitejatirunagari's picture
fix: disable ever-jobs sidecar by default for clean/fast HF startup
76afa36
Raw
History Blame Contribute Delete
2.59 kB
#!/bin/bash
# Boot sequence for the HF Space: (optionally) the ever-jobs sidecar, then the
# FastAPI + Streamlit app.
#
# ever-jobs is DISABLED by default. Rationale:
# * It runs a NestJS process that cannot reliably run inside HF Spaces, and
# the upstream repo currently fails to boot on Node 20 with
# ERR_MODULE_NOT_FOUND (.../plugin.module — extensionless ESM imports).
# * Trying to start it spammed a scary stack trace and added an up-to-45s
# startup wait on EVERY boot, for zero benefit on HF.
# * The Direct Company ATS source (Greenhouse/Lever/Ashby) + the dedicated
# scrapers (LinkedIn/Indeed/Glassdoor/Remotive/WWR/Naukri) now cover bulk
# scraping without the Node sidecar.
#
# To re-enable it (e.g. on a host where Node works), set ENABLE_EVER_JOBS=1.
# To use a REMOTE sidecar, set EVER_JOBS_API_URL=https://your-host (the app
# health-checks that URL directly and never starts a local process).
ENABLE_EVER_JOBS="${ENABLE_EVER_JOBS:-0}"
if [ "$ENABLE_EVER_JOBS" = "1" ] || [ "$ENABLE_EVER_JOBS" = "true" ]; then
echo "=== Starting ever-jobs API on port 3001 (ENABLE_EVER_JOBS=$ENABLE_EVER_JOBS) ==="
cd /app/vendor/ever-jobs
export TS_NODE_TRANSPILE_ONLY=1
export TS_NODE_COMPILER_OPTIONS='{"module":"commonjs","moduleResolution":"node","esModuleInterop":true,"allowJs":true}'
npx nest start api > /tmp/ever-jobs.log 2>&1 &
EVER_JOBS_PID=$!
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
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 " Direct Company ATS + dedicated scrapers still work."
fi
else
echo "=== ever-jobs sidecar DISABLED (default) ==="
echo " Bulk scraping uses Direct Company ATS (Greenhouse/Lever/Ashby) +"
echo " dedicated scrapers (LinkedIn/Indeed/Glassdoor/Remotive/WWR/Naukri)."
echo " Set ENABLE_EVER_JOBS=1 to boot the local Node sidecar, or"
echo " EVER_JOBS_API_URL=<remote> to use a hosted one."
fi
echo "=== Starting FastAPI + Streamlit (via api_server.py) ==="
cd /app
exec python api_server.py