File size: 1,562 Bytes
bc8b116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4003507
 
 
 
 
 
 
 
 
bc8b116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

echo "=========================================="
echo "  para.AI v3.0 - SQLite Test Version"
echo "=========================================="
echo ""

# Verificar variáveis de ambiente obrigatórias
if [ -z "$GROQ_API_KEY" ]; then
    echo "⚠️  WARNING: GROQ_API_KEY not set!"
    echo "   LLM features will be limited"
fi

# Criar diretórios se não existirem
mkdir -p /app/data /app/logs
mkdir -p /app/data/files /app/data/uploads /app/data/outputs /app/data/temp /app/data/backups

# Verificar se arquivo SQLite existe
if [ ! -f "/app/data/para_ai.db" ]; then
    echo "📁 Creating SQLite database..."
    touch /app/data/para_ai.db
    chmod 666 /app/data/para_ai.db

    # Executar migrations (se houver)
    if [ -d "/app/alembic" ]; then
        echo "🔄 Running Alembic migrations..."
        alembic upgrade head || echo "⚠️  Migrations failed (continuing anyway)"
    fi
fi

# Otimizar SQLite
#echo "⚙️  Configuring SQLite..."
#sqlite3 /app/data/para_ai.db <<EOF
#PRAGMA journal_mode=WAL;
#PRAGMA synchronous=NORMAL;
#PRAGMA cache_size=10000;
#PRAGMA foreign_keys=ON;
#PRAGMA auto_vacuum=FULL;
#.quit
#EOF

# Informações do sistema
echo ""
echo "📊 System Info:"
echo "  • Python: $(python --version)"
echo "  • Database: SQLite"
echo "  • DB File: /app/data/para_ai.db"
echo "  • DB Size: $(du -h /app/data/para_ai.db 2>/dev/null | cut -f1 || echo '0B')"
echo "  • Environment: $APP_ENV"
echo "  • Debug: ${DEBUG:-true}"
echo ""

# Executar comando
echo "🚀 Starting API..."
echo ""
exec "$@"