Simplify: Just build frontend, manual deployment
All checks were successful
Build Frontend / Build Frontend (push) Successful in 7s
All checks were successful
Build Frontend / Build Frontend (push) Successful in 7s
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Deploy to Production
|
name: Build Frontend
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,8 +6,8 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build:
|
||||||
name: Deploy to turbotrades.dev
|
name: Build Frontend
|
||||||
runs-on: Turbo-Dev
|
runs-on: Turbo-Dev
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -19,9 +19,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Install Backend Dependencies
|
|
||||||
run: npm install --production
|
|
||||||
|
|
||||||
- name: Install Frontend Dependencies
|
- name: Install Frontend Dependencies
|
||||||
run: |
|
run: |
|
||||||
cd frontend
|
cd frontend
|
||||||
@@ -36,77 +33,8 @@ jobs:
|
|||||||
VITE_API_URL: https://api.turbotrades.dev
|
VITE_API_URL: https://api.turbotrades.dev
|
||||||
VITE_WS_URL: https://ws.turbotrades.dev
|
VITE_WS_URL: https://ws.turbotrades.dev
|
||||||
|
|
||||||
- name: Install SSH Client
|
- name: Success
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
echo "✅ Frontend built successfully!"
|
||||||
sudo apt-get install -y sshpass rsync
|
echo "📦 Build output: frontend/dist/"
|
||||||
|
echo "🎨 Ready for manual deployment"
|
||||||
- name: Deploy to Server
|
|
||||||
env:
|
|
||||||
SERVER_HOST: ${{ secrets.SERVER_HOST }}
|
|
||||||
SERVER_USER: ${{ secrets.SERVER_USER }}
|
|
||||||
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
echo "🚀 Starting deployment..."
|
|
||||||
|
|
||||||
# Deploy files via rsync
|
|
||||||
echo "📦 Syncing backend files..."
|
|
||||||
sshpass -p "$SERVER_PASSWORD" rsync -avz --delete \
|
|
||||||
--exclude 'node_modules' \
|
|
||||||
--exclude '.git' \
|
|
||||||
--exclude '.env' \
|
|
||||||
--exclude 'logs' \
|
|
||||||
-e "ssh -o StrictHostKeyChecking=no -p 22" \
|
|
||||||
./ ${SERVER_USER}@${SERVER_HOST}:/root/ttbackend/
|
|
||||||
|
|
||||||
echo "🎨 Syncing frontend build..."
|
|
||||||
sshpass -p "$SERVER_PASSWORD" rsync -avz --delete \
|
|
||||||
-e "ssh -o StrictHostKeyChecking=no -p 22" \
|
|
||||||
./frontend/dist/ ${SERVER_USER}@${SERVER_HOST}:/var/www/html/turbotrades/
|
|
||||||
|
|
||||||
echo "▶️ Running deployment commands on server..."
|
|
||||||
sshpass -p "$SERVER_PASSWORD" ssh -o StrictHostKeyChecking=no -p 22 ${SERVER_USER}@${SERVER_HOST} bash << 'EOF'
|
|
||||||
cd /root/ttbackend
|
|
||||||
|
|
||||||
# Install backend dependencies
|
|
||||||
echo "📦 Installing backend dependencies..."
|
|
||||||
npm install --production
|
|
||||||
|
|
||||||
# Set frontend permissions
|
|
||||||
echo "🔒 Setting frontend permissions..."
|
|
||||||
chown -R www-data:www-data /var/www/html/turbotrades
|
|
||||||
chmod -R 755 /var/www/html/turbotrades
|
|
||||||
|
|
||||||
# Restart backend with PM2
|
|
||||||
echo "🔄 Restarting backend..."
|
|
||||||
pm2 restart turbotrades-backend 2>/dev/null || pm2 start ecosystem.config.js --env production
|
|
||||||
pm2 save
|
|
||||||
|
|
||||||
echo "✅ Deployment complete!"
|
|
||||||
pm2 list
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Health Check
|
|
||||||
run: |
|
|
||||||
echo "⏳ Waiting for services to start..."
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
echo "🏥 Checking backend..."
|
|
||||||
curl -f https://api.turbotrades.dev/api/health || echo "⚠️ Backend check failed"
|
|
||||||
|
|
||||||
echo "🏥 Checking frontend..."
|
|
||||||
curl -f https://turbotrades.dev || echo "⚠️ Frontend check failed"
|
|
||||||
|
|
||||||
- name: Notify Success
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "✅ Deployment successful!"
|
|
||||||
echo "🌐 Frontend: https://turbotrades.dev"
|
|
||||||
echo "🔧 Backend: https://api.turbotrades.dev"
|
|
||||||
echo "💬 WebSocket: https://ws.turbotrades.dev"
|
|
||||||
|
|
||||||
- name: Notify Failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "❌ Deployment failed!"
|
|
||||||
echo "Check the logs above for details"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user