#!/bin/bash
# Start neucodec worker with R2 model cache
export DATABASE_URL="postgresql://postgres.exlkkfpymkpqlxulurel:Chibhakaku%402001@aws-0-us-west-2.pooler.supabase.com:6543/postgres"
export R2_ENDPOINT_URL="https://cb908ed13329eb7b186e06ab51bda190.r2.cloudflarestorage.com"
export R2_ACCESS_KEY_ID="c3c9190ae7ff98b10271ea8db6940210"
export R2_SECRET_ACCESS_KEY="eab9394d02b48a865634105b92c74751ec9a311c56884f7aead5d76476c6b576"
export R2_BUCKET_SFT_DATA="finalsftdata"

cd /app
pkill -f "worker.py" 2>/dev/null || true
sleep 1
nohup python3 worker.py --worker-id "$1" > /app/worker.log 2>&1 &
echo "Started worker $1 PID=$!"
