-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·52 lines (43 loc) · 1.68 KB
/
deploy.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.68 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
#!/bin/bash
# ============================================================
# PopyCast — Deploy Script for VPS
# Usage: bash deploy.sh
# Requirements: Docker, Docker Compose on the server
# ============================================================
set -e
APP_DIR="/opt/dubtab"
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
echo "🚀 PopyCast Deploy"
echo "================================"
# --- Check Docker ---
if ! command -v docker &>/dev/null; then
echo "📦 Docker not found. Installing..."
curl -fsSL https://get.docker.com | sh
systemctl enable docker --now
fi
if ! docker compose version &>/dev/null; then
echo "📦 Docker Compose plugin not found. Installing..."
apt-get install -y docker-compose-plugin 2>/dev/null || true
fi
# --- Copy project files ---
echo "📁 Deploying to $APP_DIR..."
mkdir -p "$APP_DIR"
rsync -av --exclude='.git' --exclude='node_modules' --exclude='frontend/dist' \
--exclude='data' --exclude='*.pyc' --exclude='__pycache__' \
"$REPO_DIR/" "$APP_DIR/"
cd "$APP_DIR"
mkdir -p data/images data/media
# Fix permissions so the container can write to the DB and media
chmod 666 data/dubtab.db 2>/dev/null || true
chmod 777 data/media data/images 2>/dev/null || true
# --- Restart ---
echo "🔄 Restarting services..."
docker compose down --remove-orphans 2>/dev/null || true
docker compose up -d --build
echo ""
echo "✅ Deployment complete!"
echo "================================"
echo "Frontend: http://$(curl -s ifconfig.me 2>/dev/null || hostname -I | awk '{print $1}'):8505"
echo "Backend: http://$(curl -s ifconfig.me 2>/dev/null || hostname -I | awk '{print $1}'):8555/docs"
echo ""
echo "Logs: docker compose -f $APP_DIR/docker-compose.yml logs -f"