golem-flask-backend / deploy-safe.sh
mememechez's picture
Deploy final cleaned source code
ca28016
#!/bin/bash
echo "πŸš€ Safe Deployment Script for Aether AIβ„’"
echo "=================================="
# Set memory limits to prevent crashes
export NODE_OPTIONS="--max-old-space-size=1024"
# Check if we're in the right directory
if [ ! -f "package.json" ]; then
echo "❌ Error: Not in project directory. Run from project root."
exit 1
fi
# Step 1: Clean install (lighter)
echo "πŸ“¦ Installing dependencies (production only)..."
npm ci --only=production --silent
# Step 2: Build with memory limits (safer)
echo "πŸ—οΈ Building project with memory limits..."
npm run build:safe
if [ $? -ne 0 ]; then
echo "❌ Build failed. Trying even safer build..."
NODE_OPTIONS="--max-old-space-size=512" npm run build --no-lint
if [ $? -ne 0 ]; then
echo "❌ Build failed. System may need more memory. Try closing other apps."
exit 1
fi
fi
# Step 3: Deploy to Vercel (safer)
echo "🌐 Deploying to Vercel..."
npx vercel --prod --yes
echo "βœ… Deployment complete!"
echo "πŸ“ Next: Set up tunnel for backend at https://ngrok.com/"