-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 2.06 KB
/
Copy pathdeploy.yml
File metadata and controls
61 lines (54 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Production Deploy
on:
push:
branches: ["main"]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: SSH Remote Commands
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
# --- 0. PREPARE ENVIRONMENT ---
cd /root/NextVibe
git config --global --add safe.directory /root/NextVibe
# --- 1. STOP CRITICAL SERVICES ---
sudo systemctl stop nextvibe-moderation.service
# --- 2. HARD RESET (Nuclear Option) ---
echo "🔥 Forcing Git state..."
git fetch --all
git checkout main
git reset --hard origin/main
git clean -fd
git pull origin main
# --- 3. PYTHON UPDATE ---
echo "🐍 Updating Python..."
./backend/.venv/bin/pip install -r backend/modules.txt
./backend/.venv/bin/python backend/NextVibeAPI/manage.py migrate
./backend/.venv/bin/python backend/NextVibeAPI/manage.py collectstatic --noinput
# --- 4. GO REBUILD ---
echo "🐹 Rebuilding Go..."
cd moderation_service
rm -f moderator_bin
go build -o moderator_bin .
cd ..
# --- 5. NFT SERVICE UPDATE ---
echo "🦊 Updating NFT service..."
cd nft-service
bun install
cd ..
# --- 6. RESTART ALL ---
echo "🔄 Restarting Services..."
sudo systemctl restart nextvibe-backend.service
sudo systemctl restart nextvibe-realtime.service
sudo systemctl restart nextvibe-celery-beat.service
sudo systemctl restart nextvibe-celery-worker.service
sudo systemctl start nextvibe-moderation.service
sudo systemctl restart nextvibe-nft.service
sudo systemctl reload nginx
echo "✅ DEPLOYMENT FINISHED SUCCESSFULLY"