-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_prod.sh
More file actions
42 lines (33 loc) Β· 1.07 KB
/
start_prod.sh
File metadata and controls
42 lines (33 loc) Β· 1.07 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
#!/bin/bash
# Production startup script
echo "π Starting Package Registry Production Server..."
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "π¦ Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "π§ Activating virtual environment..."
source venv/bin/activate
# Install dependencies
echo "π Installing production dependencies..."
pip install -r requirements.txt
# Check environment file
if [ ! -f ".env" ]; then
echo "β Error: .env file not found!"
echo "Please create a .env file with production settings."
exit 1
fi
# Initialize database if it doesn't exist
if [ ! -f "registry.db" ]; then
echo "ποΈ Initializing database..."
python init_db.py
fi
# Create storage directories
echo "π Creating storage directories..."
mkdir -p storage/{docker,apt,npm,generic}
# Start with Gunicorn
echo "π Starting production server with Gunicorn..."
echo "π Server will be available at: http://localhost:${REGISTRY_PORT:-5000}"
echo ""
gunicorn --config gunicorn.conf.py app:app