Initial commit: Virtual Board Member AI System foundation
This commit is contained in:
72
scripts/deploy-dev.sh
Normal file
72
scripts/deploy-dev.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Deploying Virtual Board Member AI System (Development)"
|
||||
|
||||
# Check if Docker is running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Docker is not running. Please start Docker and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if required files exist
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "📝 Creating .env file from template..."
|
||||
cp env.example .env
|
||||
echo "⚠️ Please update .env file with your configuration values"
|
||||
fi
|
||||
|
||||
# Create necessary directories
|
||||
echo "📁 Creating necessary directories..."
|
||||
mkdir -p logs uploads temp
|
||||
|
||||
# Build and start services
|
||||
echo "🐳 Starting Docker services..."
|
||||
docker-compose -f docker-compose.dev.yml down --remove-orphans
|
||||
docker-compose -f docker-compose.dev.yml build --no-cache
|
||||
docker-compose -f docker-compose.dev.yml up -d
|
||||
|
||||
# Wait for services to be healthy
|
||||
echo "⏳ Waiting for services to be ready..."
|
||||
sleep 30
|
||||
|
||||
# Check service health
|
||||
echo "🔍 Checking service health..."
|
||||
docker-compose -f docker-compose.dev.yml ps
|
||||
|
||||
# Initialize database
|
||||
echo "🗄️ Initializing database..."
|
||||
docker-compose -f docker-compose.dev.yml exec -T postgres psql -U vbm_user -d vbm_db -f /docker-entrypoint-initdb.d/init-db.sql
|
||||
|
||||
# Install Python dependencies
|
||||
echo "📦 Installing Python dependencies..."
|
||||
if command -v poetry &> /dev/null; then
|
||||
poetry install
|
||||
else
|
||||
echo "⚠️ Poetry not found, using pip..."
|
||||
pip install -r requirements.txt
|
||||
fi
|
||||
|
||||
# Run database migrations
|
||||
echo "🔄 Running database migrations..."
|
||||
# TODO: Add Alembic migration commands
|
||||
|
||||
# Run tests
|
||||
echo "🧪 Running tests..."
|
||||
python -m pytest tests/ -v
|
||||
|
||||
echo "✅ Deployment completed successfully!"
|
||||
echo ""
|
||||
echo "📊 Service URLs:"
|
||||
echo " - Application: http://localhost:8000"
|
||||
echo " - API Documentation: http://localhost:8000/docs"
|
||||
echo " - Health Check: http://localhost:8000/health"
|
||||
echo " - Prometheus: http://localhost:9090"
|
||||
echo " - Grafana: http://localhost:3000"
|
||||
echo " - Kibana: http://localhost:5601"
|
||||
echo " - Jaeger: http://localhost:16686"
|
||||
echo ""
|
||||
echo "🔧 Next steps:"
|
||||
echo " 1. Update .env file with your API keys and configuration"
|
||||
echo " 2. Start the application: poetry run uvicorn app.main:app --reload"
|
||||
echo " 3. Access the API documentation at http://localhost:8000/docs"
|
||||
68
scripts/init-db.sql
Normal file
68
scripts/init-db.sql
Normal file
@@ -0,0 +1,68 @@
|
||||
-- Database initialization script for Virtual Board Member AI System
|
||||
|
||||
-- Create extensions
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
|
||||
|
||||
-- Create custom types
|
||||
DO $$ BEGIN
|
||||
CREATE TYPE user_role AS ENUM (
|
||||
'board_member',
|
||||
'executive',
|
||||
'executive_assistant',
|
||||
'analyst',
|
||||
'auditor',
|
||||
'admin'
|
||||
);
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
|
||||
DO $$ BEGIN
|
||||
CREATE TYPE document_type AS ENUM (
|
||||
'report',
|
||||
'presentation',
|
||||
'minutes',
|
||||
'financial',
|
||||
'legal',
|
||||
'other'
|
||||
);
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
|
||||
DO $$ BEGIN
|
||||
CREATE TYPE commitment_status AS ENUM (
|
||||
'pending',
|
||||
'in_progress',
|
||||
'completed',
|
||||
'overdue',
|
||||
'cancelled'
|
||||
);
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
|
||||
-- Create indexes for better performance
|
||||
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
|
||||
CREATE INDEX IF NOT EXISTS idx_users_username ON users(username);
|
||||
CREATE INDEX IF NOT EXISTS idx_users_role ON users(role);
|
||||
CREATE INDEX IF NOT EXISTS idx_documents_created_at ON documents(created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_documents_type ON documents(document_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_commitments_deadline ON commitments(deadline);
|
||||
CREATE INDEX IF NOT EXISTS idx_commitments_status ON commitments(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_audit_logs_timestamp ON audit_logs(timestamp);
|
||||
CREATE INDEX IF NOT EXISTS idx_audit_logs_user_id ON audit_logs(user_id);
|
||||
|
||||
-- Create full-text search indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_documents_content_fts ON documents USING gin(to_tsvector('english', content));
|
||||
CREATE INDEX IF NOT EXISTS idx_commitments_description_fts ON commitments USING gin(to_tsvector('english', description));
|
||||
|
||||
-- Create trigram indexes for fuzzy search
|
||||
CREATE INDEX IF NOT EXISTS idx_documents_title_trgm ON documents USING gin(title gin_trgm_ops);
|
||||
CREATE INDEX IF NOT EXISTS idx_commitments_description_trgm ON commitments USING gin(description gin_trgm_ops);
|
||||
|
||||
-- Grant permissions
|
||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO vbm_user;
|
||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO vbm_user;
|
||||
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO vbm_user;
|
||||
68
scripts/start-dev.sh
Normal file
68
scripts/start-dev.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Development startup script for Virtual Board Member AI System
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting Virtual Board Member AI System (Development Mode)"
|
||||
|
||||
# Check if Docker is running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Docker is not running. Please start Docker and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if .env file exists
|
||||
if [ ! -f .env ]; then
|
||||
echo "📝 Creating .env file from template..."
|
||||
cp env.example .env
|
||||
echo "⚠️ Please update .env file with your configuration before continuing."
|
||||
echo " You can edit .env file and run this script again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create necessary directories
|
||||
echo "📁 Creating necessary directories..."
|
||||
mkdir -p logs uploads temp
|
||||
|
||||
# Start services with Docker Compose
|
||||
echo "🐳 Starting services with Docker Compose..."
|
||||
docker-compose -f docker-compose.dev.yml up -d
|
||||
|
||||
# Wait for services to be ready
|
||||
echo "⏳ Waiting for services to be ready..."
|
||||
sleep 30
|
||||
|
||||
# Check if services are healthy
|
||||
echo "🔍 Checking service health..."
|
||||
if ! docker-compose -f docker-compose.dev.yml ps | grep -q "healthy"; then
|
||||
echo "⚠️ Some services may not be fully ready. Check with: docker-compose -f docker-compose.dev.yml ps"
|
||||
fi
|
||||
|
||||
# Install Python dependencies (if not in container)
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "🐍 Setting up Python environment..."
|
||||
python -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install poetry
|
||||
poetry install
|
||||
else
|
||||
echo "🐍 Python environment already exists."
|
||||
fi
|
||||
|
||||
echo "✅ Virtual Board Member AI System is starting up!"
|
||||
echo ""
|
||||
echo "📊 Service URLs:"
|
||||
echo " - Application: http://localhost:8000"
|
||||
echo " - API Documentation: http://localhost:8000/docs"
|
||||
echo " - Health Check: http://localhost:8000/health"
|
||||
echo " - Grafana: http://localhost:3000 (admin/admin)"
|
||||
echo " - Prometheus: http://localhost:9090"
|
||||
echo " - Kibana: http://localhost:5601"
|
||||
echo " - Jaeger: http://localhost:16686"
|
||||
echo " - MinIO Console: http://localhost:9001 (minioadmin/minioadmin)"
|
||||
echo ""
|
||||
echo "📝 To view logs: docker-compose -f docker-compose.dev.yml logs -f"
|
||||
echo "🛑 To stop services: docker-compose -f docker-compose.dev.yml down"
|
||||
echo ""
|
||||
echo "🎉 Development environment is ready!"
|
||||
Reference in New Issue
Block a user