File size: 1,211 Bytes
4863c30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Deploy Catacomb Underwriter Service to Devnet

set -e

echo "=== Deploying Catacomb Underwriter Service to Devnet ==="

# Check if .env exists
if [ ! -f .env ]; then
    echo "Creating .env from .env.example..."
    cp .env.example .env
    echo "⚠️  Please edit .env with your actual devnet credentials:"
    echo "   - DATABASE_URL (PostgreSQL)"
    echo "   - REDIS_URL (Redis)"
    echo "   - STRIPE_SECRET_KEY (test mode)"
    echo "   - STRIPE_PUBLISHABLE_KEY (test mode)"
    echo "   - SECRET_KEY"
    exit 1
fi

# Install dependencies
echo "Installing Python dependencies..."
pip install -r requirements.txt

# Initialize database
echo "Initializing database..."
python -c "
from database import get_database_manager
db = get_database_manager()
db.initialize_schema()
print('Database schema initialized')
"

# Start Redis (if not running)
echo "Checking Redis..."
if ! redis-cli ping > /dev/null 2>&1; then
    echo "⚠️  Redis not running. Start Redis with: redis-server"
    echo "   For distributed scaling, use Redis Cluster"
fi

# Start the service
echo "Starting underwriter service on port 5002..."
export FLASK_ENV=production
export FLASK_DEBUG=0
python underwriter_app.py