edtech / scripts /start-backend.sh
CognxSafeTrack
fix(arch): HF inbound-only + seedDatabase export + DISABLE_WORKER + DISABLE_WHATSAPP_SEND
fe2f79f
raw
history blame contribute delete
998 Bytes
#!/bin/bash
set -ex
echo "Running database migrations..."
pnpm --filter @repo/database db:push
# On Hugging Face (DISABLE_WORKER=true), only run the API.
# The WhatsApp worker runs exclusively on Railway and calls graph.facebook.com from there.
if [ "${DISABLE_WORKER}" != "true" ]; then
echo "Starting WhatsApp Worker..."
if [ -f "apps/whatsapp-worker/dist/src/index.js" ]; then
node apps/whatsapp-worker/dist/src/index.js &
elif [ -f "apps/whatsapp-worker/dist/index.js" ]; then
node apps/whatsapp-worker/dist/index.js &
else
echo "WARNING: WhatsApp Worker build output missing — worker not started."
fi
else
echo "DISABLE_WORKER=true — Skipping worker startup (HF inbound-only mode)."
fi
echo "Starting API..."
if [ -f "apps/api/dist/src/index.js" ]; then
exec node apps/api/dist/src/index.js
elif [ -f "apps/api/dist/index.js" ]; then
exec node apps/api/dist/index.js
else
echo "ERROR: API build output missing!"
exit 1
fi