chitfund/deploy-frontend-simple.sh

28 lines
931 B
Bash
Executable File

#!/bin/bash
###############################################################################
# Simple Frontend Deployment - Quick Version
###############################################################################
SERVER_IP="192.168.8.148"
cd /home/luckychit/apps/chitfund/luckychit
echo "🔧 Updating API URL..."
sed -i "s|http://localhost:3000/api|http://${SERVER_IP}:3000/api|g" lib/core/services/api_service.dart
echo "📦 Getting dependencies..."
flutter pub get
echo "🏗️ Building web app..."
flutter build web --release
echo "🚀 Deploying..."
mkdir -p /var/www/luckychit
cp -r build/web/* /var/www/luckychit/
chown -R www-data:www-data /var/www/luckychit
echo "🔄 Restoring original file..."
git checkout lib/core/services/api_service.dart 2>/dev/null || sed -i "s|http://${SERVER_IP}:3000/api|http://localhost:3000/api|g" lib/core/services/api_service.dart
echo "✅ Done! Visit: http://${SERVER_IP}"