-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·64 lines (54 loc) · 1.6 KB
/
deploy.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.6 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
62
63
64
#!/bin/bash
# Deployment script for PDFResearcher
# Handles migrations and starts the application
set -e
echo "======================================"
echo "PDFResearcher Deployment Script"
echo "======================================"
echo ""
# Check if we're in the right directory
if [ ! -f "app/main.py" ]; then
echo "❌ Error: Must run from PDFResearcher root directory"
exit 1
fi
# Check Python version
python_version=$(python3 --version 2>&1 | awk '{print $2}')
echo "🐍 Python version: $python_version"
# Check if virtual environment exists
if [ -d "venv" ] || [ -d ".venv" ]; then
echo "📦 Activating virtual environment..."
if [ -d "venv" ]; then
source venv/bin/activate
else
source .venv/bin/activate
fi
else
echo "⚠️ No virtual environment found. Consider creating one:"
echo " python3 -m venv venv"
echo " source venv/bin/activate"
echo " pip install -r requirements.txt"
echo ""
fi
# Check if Alembic is installed
if ! python3 -c "import alembic" 2>/dev/null; then
echo "⚠️ Alembic not installed. Installing dependencies..."
pip install -r requirements.txt
fi
# Create data directory if it doesn't exist
mkdir -p data/uploads
echo "📁 Data directory ready"
# Fix migrations
echo ""
echo "🔧 Checking and fixing migrations..."
python3 fix_migrations.py || {
echo "⚠️ Migration fix failed, but continuing..."
}
# Start the application
echo ""
echo "🚀 Starting PDFResearcher..."
echo " Access at: http://localhost:2278"
echo ""
echo " Press Ctrl+C to stop"
echo ""
# Run the application
python3 -m app.main