Spaces:
Running

File size: 651 Bytes
5b9f744
 
 
2b47929
 
 
 
5b9f744
2b47929
 
 
4829b9f
2b47929
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

# Logging function
log() {
    echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1"
}

log "πŸš€ Starting MicroFunnel Backend..."
log "πŸ“‚ Working Directory: $(pwd)"
log "πŸ‘€ User: $(whoami)"

# 1. Run Migrations
log "πŸ› οΈ Running Database Migrations..."
if alembic upgrade head; then
    log "βœ… Migrations applied successfully."
else
    log "❌ Migration failed!"
    exit 1
fi

# 2. Verify Port
PORT="${PORT:-8000}"
log "πŸ”Œ Starting Server on 0.0.0.0:$PORT"

# 3. Start Uvicorn
# Use exec to replace shell process with uvicorn for signal handling
exec python -m uvicorn app.main:app --host 0.0.0.0 --port "$PORT" --log-level info